Skip to content

Commit 35a4bb3

Browse files
author
Amit Raj
committed
Code cleaning and removed redundant code
Signed-off-by: Amit Raj <[email protected]>
1 parent 753ae8d commit 35a4bb3

File tree

11 files changed

+607
-508
lines changed

11 files changed

+607
-508
lines changed

QEfficient/base/modeling_qeff.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,30 @@ def _model_offloaded_check(self) -> None:
121121
raise RuntimeError(error_msg)
122122

123123
@property
124-
@abstractmethod
125-
def model_name(self) -> str: ...
124+
def model_name(self) -> str:
125+
"""
126+
Get the model class name without QEff/QEFF prefix.
127+
128+
This property extracts the underlying model's class name and removes
129+
any QEff or QEFF prefix that may have been added during wrapping.
130+
131+
Returns:
132+
str: Model class name (e.g., "CLIPTextModel" instead of "QEffCLIPTextModel")
133+
"""
134+
mname = self.model.__class__.__name__
135+
if mname.startswith("QEff") or mname.startswith("QEFF"):
136+
mname = mname[4:]
137+
return mname
138+
139+
@property
140+
def get_model_config(self) -> Dict:
141+
"""
142+
Get the model configuration as a dictionary.
143+
144+
Returns:
145+
Dict: The configuration dictionary of the underlying HuggingFace model
146+
"""
147+
return self.model.config.__dict__
126148

127149
@abstractmethod
128150
def export(self, export_dir: Optional[str] = None) -> Path:
@@ -268,8 +290,7 @@ def _export(
268290
input_names=input_names,
269291
output_names=output_names,
270292
dynamic_axes=dynamic_axes,
271-
opset_version=17,
272-
# verbose=True,
293+
opset_version=constants.ONNX_EXPORT_OPSET,
273294
**export_kwargs,
274295
)
275296
logger.info("PyTorch export successful")
@@ -454,7 +475,6 @@ def _compile(
454475

455476
command.append(f"-aic-binary-dir={qpc_path}")
456477
logger.info(f"Running compiler: {' '.join(command)}")
457-
print(command)
458478
try:
459479
subprocess.run(command, capture_output=True, check=True)
460480
except subprocess.CalledProcessError as e:

QEfficient/diffusers/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -----------------------------------------------------------------------------
2+
#
3+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
# ----------------------------------------------------------------------------
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# -----------------------------------------------------------------------------
2+
#
3+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
# ----------------------------------------------------------------------------

QEfficient/diffusers/pipelines/flux/flux_config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"description": "Default configuration for Flux pipeline",
3-
"model_type": "flux",
43

54
"modules":
65
{

0 commit comments

Comments
 (0)