System Info
transformers: v4.27.0
Who can help?
@sgugger @muellerzr
Information
Tasks
Reproduction
I was use this code.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "facebook/xglm-1.7B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model_8bit = AutoModelForCausalLM.from_pretrained(model_name, load_in_8bit=True, device_map='auto')
Error:
Overriding torch_dtype=None with `torch_dtype=torch.float16` due to requirements of `bitsandbytes` to enable model loading in mixed int8. Either pass torch_dtype=torch.float16 or don't pass this argument at all to remove this warning.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[5], line 3
1 model_name = "facebook/xglm-1.7B"
2 tokenizer = AutoTokenizer.from_pretrained(model_name)
----> 3 model_8bit = AutoModelForCausalLM.from_pretrained(model_name, load_in_8bit=True, device_map='auto')
File /usr/local/lib/python3.8/dist-packages/transformers/models/auto/auto_factory.py:471, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
469 elif type(config) in cls._model_mapping.keys():
470 model_class = _get_model_class(config, cls._model_mapping)
--> 471 return model_class.from_pretrained(
472 pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs
473 )
474 raise ValueError(
475 f"Unrecognized configuration class {config.__class__} for this kind of AutoModel: {cls.__name__}.\n"
476 f"Model type should be one of {', '.join(c.__name__ for c in cls._model_mapping.keys())}."
477 )
File /usr/local/lib/python3.8/dist-packages/transformers/modeling_utils.py:2556, in PreTrainedModel.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
2550 special_dtypes = {
2551 name: torch.float32
2552 for name, _ in model.named_parameters()
2553 if any(m in name for m in keep_in_fp32_modules)
2554 }
2555 if model._no_split_modules is None:
-> 2556 raise ValueError(f"{model.__class__.__name__} does not support `device_map='{device_map}'` yet.")
2557 no_split_modules = model._no_split_modules
2558 if device_map not in ["auto", "balanced", "balanced_low_0", "sequential"]:
ValueError: XGLMForCausalLM does not support `device_map='auto'` yet.
Expected behavior
XGLMForCausalLM should support device_map='auto'.
System Info
transformers: v4.27.0
Who can help?
@sgugger @muellerzr
Information
Tasks
examplesfolder (such as GLUE/SQuAD, ...)Reproduction
I was use this code.
Error:
Expected behavior
XGLMForCausalLM should support
device_map='auto'.