Skip to content

Spd fix for release 1.20 #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025
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: 1 addition & 1 deletion QEfficient/transformers/models/modeling_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ def __init__(
self.num_layers = model.config.num_hidden_layers
self.continuous_batching = continuous_batching
self.model.qaic_config = qaic_config

self.pretrained_model_name_or_path = kwargs.get("pretrained_model_name_or_path", None)
self.model, transformed = SpDTransform.apply(self.model, qaic_config, **kwargs)
self.is_tlm = transformed
self.pretrained_model_name_or_path = kwargs.get("pretrained_model_name_or_path", None)
Expand Down
2 changes: 2 additions & 0 deletions QEfficient/transformers/models/pytorch_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ class SpDTransform:
@classmethod
def apply(cls, model: nn.Module, qaic_config: Optional[dict] = None, **kwargs) -> Tuple[nn.Module, bool]:
transformed = False
pretrained_model_name_or_path_temp = kwargs.pop("pretrained_model_name_or_path", None)
if qaic_config is None or (speculative_model_type := qaic_config.get("speculative_model_type")) is None:
return model, transformed
elif speculative_model_type not in (
Expand All @@ -524,6 +525,7 @@ def apply(cls, model: nn.Module, qaic_config: Optional[dict] = None, **kwargs) -
raise NotImplementedError(
f"model class {model_class} does not yet support returning multiple logits to keep."
)
kwargs["pretrained_model_name_or_path"] = pretrained_model_name_or_path_temp
return model, transformed


Expand Down