Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOGS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Change Logs
0.7.11
++++++

* :pr:`220`: adds a patch for PR `#40791 <https://github.com/huggingface/transformers/pull/40791>`_ in transformers

0.7.10
++++++

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
from ...ext_test_case import has_transformers
from ...helpers.torch_helper import is_torchdynamo_exporting

patch_is_initialized = pv.Version(transformers.__version__) > pv.Version("4.56.99")


if patch_masking_utils:
# Introduced in 4.52
from transformers.masking_utils import (
Expand Down Expand Up @@ -213,6 +216,8 @@ def lazy_initialization(self, key_states: torch.Tensor):
new_shape[-2] = 0
self.keys = torch.empty(new_shape, dtype=self.dtype, device=self.device)
self.values = torch.empty(new_shape, dtype=self.dtype, device=self.device)
if patch_is_initialized:
self.is_initialized = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I image before this PR, we got AttributeError?



def _patch_make_causal_mask(
Expand Down
13 changes: 12 additions & 1 deletion onnx_diagnostic/torch_models/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def _make_folder_name(
dtype: Optional[Union[str, torch.dtype]] = None,
device: Optional[Union[str, torch.device]] = None,
subfolder: Optional[str] = None,
opset: Optional[int] = None,
) -> str:
"Creates a filename unique based on the given options."
els = [model_id.replace("/", "_")]
Expand All @@ -136,6 +137,8 @@ def _make_folder_name(
else:
raise AssertionError(f"unexpected value for device={device}, sdev={sdev!r}")
els.append(sdev)
if opset is not None:
els.append(f"op{opset}")
return "-".join(els)


Expand Down Expand Up @@ -412,7 +415,13 @@ def validate_model(
folder_name = None
if dump_folder:
folder_name = _make_folder_name(
model_id, exporter, optimization, dtype=dtype, device=device, subfolder=subfolder
model_id,
exporter,
optimization,
dtype=dtype,
device=device,
subfolder=subfolder,
opset=opset,
)
dump_folder = os.path.join(dump_folder, folder_name)
if not os.path.exists(dump_folder):
Expand Down Expand Up @@ -1509,6 +1518,8 @@ def call_torch_export_custom(
"default+onnxruntime+os_ort",
None,
}
if optimization == "none":
optimization = ""
assert (
optimization in available
), f"unexpected value for optimization={optimization}, available={available}"
Expand Down
Loading