Skip to content

Commit 5ba241d

Browse files
committed
add new ones
1 parent 1968636 commit 5ba241d

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
@@ -46,7 +46,7 @@ from transformers import pipeline
4646
pipeline = pipeline(
4747
task="fill-mask",
4848
model="moussaKam/barthez",
49-
torch_dtype=torch.float16,
49+
dtype=torch.float16,
5050
device=0
5151
)
5252
pipeline("Les plantes produisent <mask> grâce à un processus appelé photosynthèse.")
@@ -64,7 +64,7 @@ tokenizer = AutoTokenizer.from_pretrained(
6464
)
6565
model = AutoModelForMaskedLM.from_pretrained(
6666
"moussaKam/barthez",
67-
torch_dtype=torch.float16,
67+
dtype=torch.float16,
6868
device_map="auto",
6969
)
7070
inputs = tokenizer("Les plantes produisent <mask> grâce à un processus appelé photosynthèse.", return_tensors="pt").to("cuda")

docs/source/en/model_doc/cohere2.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ from transformers import pipeline
3232
pipeline = pipeline(
3333
task="text-generation",
3434
model="CohereLabs/c4ai-command-r7b-12-2024",
35-
torch_dtype=torch.float16,
35+
dtype=torch.float16,
3636
device_map=0
3737
)
3838

@@ -52,7 +52,7 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
5252
tokenizer = AutoTokenizer.from_pretrained("CohereLabs/c4ai-command-r7b-12-2024")
5353
model = AutoModelForCausalLM.from_pretrained(
5454
"CohereLabs/c4ai-command-r7b-12-2024",
55-
torch_dtype=torch.float16,
55+
dtype=torch.float16,
5656
device_map="auto",
5757
attn_implementation="sdpa"
5858
)
@@ -75,7 +75,7 @@ print(tokenizer.decode(output[0], skip_special_tokens=True))
7575

7676
```bash
7777
# pip install -U flash-attn --no-build-isolation
78-
transformers-cli chat CohereLabs/c4ai-command-r7b-12-2024 --torch_dtype auto --attn_implementation flash_attention_2
78+
transformers-cli chat CohereLabs/c4ai-command-r7b-12-2024 --dtype auto --attn_implementation flash_attention_2
7979
```
8080

8181
</hfoption>
@@ -93,7 +93,7 @@ bnb_config = BitsAndBytesConfig(load_in_4bit=True)
9393
tokenizer = AutoTokenizer.from_pretrained("CohereLabs/c4ai-command-r7b-12-2024")
9494
model = AutoModelForCausalLM.from_pretrained(
9595
"CohereLabs/c4ai-command-r7b-12-2024",
96-
torch_dtype=torch.float16,
96+
dtype=torch.float16,
9797
device_map="auto",
9898
quantization_config=bnb_config,
9999
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
@@ -31,7 +31,7 @@ model_id = "CohereLabs/command-a-vision-07-2025"
3131

3232
processor = AutoProcessor.from_pretrained(model_id)
3333
model = AutoModelForImageTextToText.from_pretrained(
34-
model_id, device_map="auto", torch_dtype=torch.float16
34+
model_id, device_map="auto", dtype=torch.float16
3535
)
3636

3737
# 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
@@ -48,7 +48,7 @@ import torch
4848
pipeline = pipeline(
4949
"object-detection",
5050
model="SenseTime/deformable-detr",
51-
torch_dtype=torch.float16,
51+
dtype=torch.float16,
5252
device_map=0
5353
)
5454

docs/source/en/model_doc/detr.md

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

docs/source/en/model_doc/mt5.md

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

@@ -103,7 +103,7 @@ quantization_config = BitsAndBytesConfig(
103103
)
104104
model = AutoModelForSeq2SeqLM.from_pretrained(
105105
"csebuetnlp/mT5_multilingual_XLSum",
106-
torch_dtype=torch.bfloat16,
106+
dtype=torch.bfloat16,
107107
device_map="auto",
108108
quantization_config=quantization_config
109109
)

docs/source/ko/cache_explanation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ import torch
102102
from transformers import AutoTokenizer, AutoModelForCausalLM, DynamicCache
103103

104104
model_id = "meta-llama/Llama-2-7b-chat-hf"
105-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="cuda:0")
105+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cuda:0")
106106
tokenizer = AutoTokenizer.from_pretrained(model_id)
107107

108108
past_key_values = DynamicCache()
@@ -146,7 +146,7 @@ import torch
146146
from transformers import AutoTokenizer, AutoModelForCausalLM, DynamicCache
147147

148148
model_id = "meta-llama/Llama-2-7b-chat-hf"
149-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="cuda:0")
149+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cuda:0")
150150
tokenizer = AutoTokenizer.from_pretrained(model_id)
151151

152152
messages = [{"role": "user", "content": "You are a helpful assistant."}]
@@ -172,7 +172,7 @@ import torch
172172
from transformers import AutoTokenizer, AutoModelForCausalLM, DynamicCache
173173

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

178178
# 캐시를 반환하려면 `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
@@ -119,17 +119,17 @@ def validate_environment(self, *args, **kwargs):
119119
"Please use a quantized checkpoint or remove the CPU or disk device from the device_map."
120120
)
121121

122-
def update_torch_dtype(self, torch_dtype: "torch.dtype") -> "torch.dtype":
123-
if torch_dtype is None:
124-
torch_dtype = torch.bfloat16
122+
def update_dtype(self, dtype: "torch.dtype") -> "torch.dtype":
123+
if dtype is None:
124+
dtype = torch.bfloat16
125125
logger.info(
126-
"Overriding torch_dtype=%s with `torch_dtype=torch.bfloat16` due to "
126+
"Overriding dtype=%s with `dtype=torch.bfloat16` due to "
127127
"requirements of `fbgemm-gpu` to enable model loading in fp4. "
128-
"Pass your own torch_dtype to specify the dtype of the remaining non-linear layers or pass"
129-
" torch_dtype=torch.bfloat16 to remove this warning.",
130-
torch_dtype,
128+
"Pass your own dtype to specify the dtype of the remaining non-linear layers or pass"
129+
" dtype=torch.bfloat16 to remove this warning.",
130+
dtype,
131131
)
132-
return torch_dtype
132+
return dtype
133133

134134
def check_quantized_param(
135135
self,

tests/models/cohere2_vision/test_modeling_cohere2_vision.py

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

189189
def get_model(self, dummy=True):
190190
device_type, major, _ = get_device_properties()
191-
torch_dtype = torch.float16
191+
dtype = torch.float16
192192

193193
# too large to fit into A10
194194
config = Cohere2VisionConfig.from_pretrained(self.model_checkpoint)
@@ -199,7 +199,7 @@ def get_model(self, dummy=True):
199199
model = Cohere2VisionForConditionalGeneration.from_pretrained(
200200
self.model_checkpoint,
201201
config=config,
202-
torch_dtype=torch_dtype,
202+
dtype=dtype,
203203
device_map="auto",
204204
)
205205
return model

0 commit comments

Comments
 (0)