Skip to content

Commit 25ccb7c

Browse files
committed
fix
1 parent e7a8360 commit 25ccb7c

6 files changed

Lines changed: 19 additions & 10 deletions

File tree

_doc/examples/plot_export_with_modelbuilder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def generate_text(
6565
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
6666
if not os.path.exists(filename):
6767
print(f"-- creating... on {device} into {filename!r}")
68-
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, torch_dtype=torch.bfloat16)
68+
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME, dtype=torch.bfloat16)
6969
model = model.to(device)
7070
config = model.config
7171
else:

_doc/technical/plot_generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
tokenizer = AutoTokenizer.from_pretrained(model_id)
4848
else:
4949
model_id = "microsoft/phi-1_5"
50-
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto")
50+
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto")
5151
tokenizer = AutoTokenizer.from_pretrained(model_id)
5252
config = get_pretrained_config(model_id)
5353
task = task = task_from_id(model_id)

_unittests/ut_tasks/try_tasks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def test_text_generation_phi4_moe(self):
263263
model = AutoModelForCausalLM.from_pretrained(
264264
model_path,
265265
device_map="cuda",
266-
torch_dtype="auto",
266+
dtype="auto",
267267
trust_remote_code=True,
268268
# if you do not use Ampere or later GPUs, change attention to "eager"
269269
# _attn_implementation='flash_attention_2',
@@ -352,7 +352,7 @@ def test_imagetext2text_generation_idefics(self):
352352
mid = "HuggingFaceM4/tiny-random-idefics"
353353
processor = AutoProcessor.from_pretrained(mid)
354354
model = IdeficsForVisionText2Text.from_pretrained(
355-
mid, torch_dtype=torch.bfloat16, device_map="auto"
355+
mid, dtype=torch.bfloat16, device_map="auto"
356356
)
357357

358358
prompt = [
@@ -699,7 +699,7 @@ def test_falcon_mamba_dev(self):
699699
"text-generation",
700700
model=model,
701701
tokenizer=tokenizer,
702-
torch_dtype=torch.bfloat16,
702+
dtype=torch.bfloat16,
703703
trust_remote_code=True,
704704
device_map="auto",
705705
)
@@ -736,7 +736,7 @@ def test_falcon_mamba_7b(self):
736736
"text-generation",
737737
model=model,
738738
tokenizer=tokenizer,
739-
torch_dtype=torch.bfloat16,
739+
dtype=torch.bfloat16,
740740
trust_remote_code=True,
741741
device_map="auto",
742742
)
@@ -802,7 +802,7 @@ def test_text_to_image(self):
802802
from diffusers import StableDiffusionPipeline
803803

804804
model_id = "diffusers/tiny-torch-full-checker" # "stabilityai/stable-diffusion-2"
805-
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(
805+
pipe = StableDiffusionPipeline.from_pretrained(model_id, dtype=torch.float16).to(
806806
"cuda"
807807
)
808808

_unittests/ut_xrun_doc/test_documentation_examples.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ def add_test_methods(cls):
8585

8686
# transformers
8787

88+
if not reason and not has_dot and name in {"plot_export_with_modelbuilder.py"}:
89+
reason = "downloading"
90+
8891
if (
8992
not reason
9093
and name in {"plot_export_tiny_llm.py", "plot_export_tiny_llm_patched.py"}

onnx_diagnostic/ci_models/export_phi4_mm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ def main(
794794
model_id,
795795
config=config,
796796
trust_remote_code=True,
797-
torch_dtype=torch_dtype,
797+
dtype=torch_dtype,
798798
device_map=device,
799799
attn_implementation="sdpa",
800800
).eval()

onnx_diagnostic/investigate/input_observer.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,11 @@ def remove_inputs(self, input_names: Sequence[str | int]):
851851
self._best_candidate.remove_inputs(input_names)
852852

853853
for name_or_pos in sorted(input_names, reverse=True):
854-
if self.default_values and name_or_pos in self.default_values:
854+
if (
855+
isinstance(name_or_pos, str)
856+
and self.default_values
857+
and name_or_pos in self.default_values
858+
):
855859
del self.default_values[name_or_pos]
856860
if self.value_if_missing and name_or_pos in self.value_if_missing:
857861
del self.value_if_missing[name_or_pos]
@@ -862,7 +866,7 @@ def remove_inputs(self, input_names: Sequence[str | int]):
862866
not self.args_name_and_position
863867
), f"Not implemented when {self.args_name_and_position=}"
864868
input_names_str = {
865-
(self.signature_name[i] if isinstance(i, int) else i) for i in input_names
869+
(self.signature_names[i] if isinstance(i, int) else i) for i in input_names
866870
}
867871
self.signature_names = [
868872
name for name in self.signature_names if name not in input_names_str
@@ -1269,4 +1273,6 @@ def check_discrepancies(
12691273

12701274
def remove_inputs(self, input_names: Sequence[str | int]):
12711275
"""Lets the users drops inputs."""
1276+
if self.info is None:
1277+
raise RuntimeError("No input was captured.")
12721278
self.info.remove_inputs(input_names)

0 commit comments

Comments
 (0)