Skip to content

Commit 0bd77c9

Browse files
committed
add new ones
1 parent 2b14038 commit 0bd77c9

File tree

13 files changed

+40
-40
lines changed

13 files changed

+40
-40
lines changed

docs/source/en/model_doc/barthez.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ from transformers import pipeline
4444
pipeline = pipeline(
4545
task="fill-mask",
4646
model="moussaKam/barthez",
47-
torch_dtype=torch.float16,
47+
dtype=torch.float16,
4848
device=0
4949
)
5050
pipeline("Les plantes produisent <mask> grâce à un processus appelé photosynthèse.")
@@ -62,7 +62,7 @@ tokenizer = AutoTokenizer.from_pretrained(
6262
)
6363
model = AutoModelForMaskedLM.from_pretrained(
6464
"moussaKam/barthez",
65-
torch_dtype=torch.float16,
65+
dtype=torch.float16,
6666
device_map="auto",
6767
)
6868
inputs = tokenizer("Les plantes produisent <mask> grâce à un processus appelé photosynthèse.", return_tensors="pt").to(model.device)

docs/source/en/model_doc/cohere2.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ from transformers import pipeline
4747
pipeline = pipeline(
4848
task="text-generation",
4949
model="CohereLabs/c4ai-command-r7b-12-2024",
50-
torch_dtype=torch.float16,
50+
dtype=torch.float16,
5151
device_map=0
5252
)
5353

@@ -67,7 +67,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
6767
tokenizer = AutoTokenizer.from_pretrained("CohereLabs/c4ai-command-r7b-12-2024")
6868
model = AutoModelForCausalLM.from_pretrained(
6969
"CohereLabs/c4ai-command-r7b-12-2024",
70-
torch_dtype=torch.float16,
70+
dtype=torch.float16,
7171
device_map="auto",
7272
attn_implementation="sdpa"
7373
)
@@ -90,7 +90,7 @@ print(tokenizer.decode(output[0], skip_special_tokens=True))
9090

9191
```bash
9292
# pip install -U flash-attn --no-build-isolation
93-
transformers-cli chat CohereLabs/c4ai-command-r7b-12-2024 --torch_dtype auto --attn_implementation flash_attention_2
93+
transformers-cli chat CohereLabs/c4ai-command-r7b-12-2024 --dtype auto --attn_implementation flash_attention_2
9494
```
9595

9696
</hfoption>
@@ -108,7 +108,7 @@ bnb_config = BitsAndBytesConfig(load_in_4bit=True)
108108
tokenizer = AutoTokenizer.from_pretrained("CohereLabs/c4ai-command-r7b-12-2024")
109109
model = AutoModelForCausalLM.from_pretrained(
110110
"CohereLabs/c4ai-command-r7b-12-2024",
111-
torch_dtype=torch.float16,
111+
dtype=torch.float16,
112112
device_map="auto",
113113
quantization_config=bnb_config,
114114
attn_implementation="sdpa"

docs/source/en/model_doc/cohere2_vision.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ model_id = "CohereLabs/command-a-vision-07-2025"
4848

4949
processor = AutoProcessor.from_pretrained(model_id)
5050
model = AutoModelForImageTextToText.from_pretrained(
51-
model_id, device_map="auto", torch_dtype=torch.float16
51+
model_id, device_map="auto", dtype=torch.float16
5252
)
5353

5454
# Format message with the Command-A-Vision chat template

docs/source/en/model_doc/deformable_detr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import torch
4949
pipeline = pipeline(
5050
"object-detection",
5151
model="SenseTime/deformable-detr",
52-
torch_dtype=torch.float16,
52+
dtype=torch.float16,
5353
device_map=0
5454
)
5555

docs/source/en/model_doc/detr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import torch
4444
pipeline = pipeline(
4545
"object-detection",
4646
model="facebook/detr-resnet-50",
47-
torch_dtype=torch.float16,
47+
dtype=torch.float16,
4848
device_map=0
4949
)
5050

docs/source/en/model_doc/mt5.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ from transformers import pipeline
4444
pipeline = pipeline(
4545
task="text2text-generation",
4646
model="csebuetnlp/mT5_multilingual_XLSum",
47-
torch_dtype=torch.float16,
47+
dtype=torch.float16,
4848
device=0
4949
)
5050
pipeline("""Plants are remarkable organisms that produce their own food using a method called photosynthesis.
@@ -64,7 +64,7 @@ tokenizer = AutoTokenizer.from_pretrained(
6464
)
6565
model = AutoModelForSeq2SeqLM.from_pretrained(
6666
"csebuetnlp/mT5_multilingual_XLSum",
67-
torch_dtype=torch.float16,
67+
dtype=torch.float16,
6868
device_map="auto",
6969
)
7070

@@ -102,7 +102,7 @@ quantization_config = BitsAndBytesConfig(
102102
)
103103
model = AutoModelForSeq2SeqLM.from_pretrained(
104104
"csebuetnlp/mT5_multilingual_XLSum",
105-
torch_dtype=torch.bfloat16,
105+
dtype=torch.bfloat16,
106106
device_map="auto",
107107
quantization_config=quantization_config
108108
)

docs/source/ko/cache_explanation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, DynamicCache, infe
104104
device = f"{infer_device()}:0"
105105

106106
model_id = "meta-llama/Llama-2-7b-chat-hf"
107-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map=device)
107+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map=device)
108108
tokenizer = AutoTokenizer.from_pretrained(model_id)
109109

110110
past_key_values = DynamicCache()
@@ -150,7 +150,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, DynamicCache, infe
150150
device = f"{infer_device()}:0"
151151

152152
model_id = "meta-llama/Llama-2-7b-chat-hf"
153-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map=device)
153+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map=device)
154154
tokenizer = AutoTokenizer.from_pretrained(model_id)
155155

156156
messages = [{"role": "user", "content": "You are a helpful assistant."}]
@@ -176,7 +176,7 @@ import torch
176176
from transformers import AutoTokenizer, AutoModelForCausalLM, DynamicCache
177177

178178
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
179-
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf", torch_dtype=torch.float16, device_map="auto")
179+
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf", dtype=torch.float16, device_map="auto")
180180
inputs = tokenizer("Hello, my name is", return_tensors="pt").to(model.device)
181181

182182
# 캐시를 반환하려면 `return_dict_in_generate=True`가 필요하고 `return_legacy_cache`는 반환된 캐시를

src/transformers/models/gpt_oss/convert_gpt_oss_weights_to_hf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def write_model(
265265

266266
gc.collect()
267267
print("Reloading the model to check if it's saved correctly.")
268-
GptOssForCausalLM.from_pretrained(model_path, torch_dtype=torch.bfloat16, device_map="auto")
268+
GptOssForCausalLM.from_pretrained(model_path, dtype=torch.bfloat16, device_map="auto")
269269
print("Model reloaded successfully.")
270270

271271
# generation config

src/transformers/quantizers/quantizer_mxfp4.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,17 @@ def validate_environment(self, *args, **kwargs):
126126
"Please use a quantized checkpoint or remove the CPU or disk device from the device_map."
127127
)
128128

129-
def update_torch_dtype(self, torch_dtype: "torch.dtype") -> "torch.dtype":
130-
if torch_dtype is None:
131-
torch_dtype = torch.bfloat16
129+
def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype":
130+
if dtype is None:
131+
dtype = torch.bfloat16
132132
logger.info(
133-
"Overriding torch_dtype=%s with `torch_dtype=torch.bfloat16` due to "
133+
"Overriding dtype=%s with `dtype=torch.bfloat16` due to "
134134
"requirements of `fbgemm-gpu` to enable model loading in fp4. "
135-
"Pass your own torch_dtype to specify the dtype of the remaining non-linear layers or pass"
136-
" torch_dtype=torch.bfloat16 to remove this warning.",
137-
torch_dtype,
135+
"Pass your own dtype to specify the dtype of the remaining non-linear layers or pass"
136+
" dtype=torch.bfloat16 to remove this warning.",
137+
dtype,
138138
)
139-
return torch_dtype
139+
return dtype
140140

141141
def check_quantized_param(
142142
self,

tests/models/cohere2_vision/test_modeling_cohere2_vision.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def tearDown(self):
186186

187187
def get_model(self, dummy=True):
188188
device_type, major, _ = get_device_properties()
189-
torch_dtype = torch.float16
189+
dtype = torch.float16
190190

191191
# too large to fit into A10
192192
config = Cohere2VisionConfig.from_pretrained(self.model_checkpoint)
@@ -197,7 +197,7 @@ def get_model(self, dummy=True):
197197
model = Cohere2VisionForConditionalGeneration.from_pretrained(
198198
self.model_checkpoint,
199199
config=config,
200-
torch_dtype=torch_dtype,
200+
dtype=dtype,
201201
device_map="auto",
202202
)
203203
return model

0 commit comments

Comments
 (0)