Skip to content

Commit ffed450

Browse files
author
Amit Raj
committed
Code cleaning and removed redundant code
Signed-off-by: Amit Raj <amitraj@qti.qualcommm.com>
1 parent e0b80fa commit ffed450

File tree

11 files changed

+607
-548
lines changed

11 files changed

+607
-548
lines changed

QEfficient/base/modeling_qeff.py

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

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

123145
@abstractmethod
124146
def export(self, export_dir: Optional[str] = None) -> Path:
@@ -251,8 +273,7 @@ def _export(
251273
input_names=input_names,
252274
output_names=output_names,
253275
dynamic_axes=dynamic_axes,
254-
opset_version=17,
255-
# verbose=True,
276+
opset_version=constants.ONNX_EXPORT_OPSET,
256277
**export_kwargs,
257278
)
258279
logger.info("PyTorch export successful")
@@ -430,7 +451,6 @@ def _compile(
430451

431452
command.append(f"-aic-binary-dir={qpc_path}")
432453
logger.info(f"Running compiler: {' '.join(command)}")
433-
print(command)
434454
try:
435455
subprocess.run(command, capture_output=True, check=True)
436456
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)