Skip to content

Commit c8fa8cd

Browse files
Fixed issue of No custom_IO file found during compile through CLI
1 parent b4ed383 commit c8fa8cd

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

QEfficient/cloud/custom_yaml.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from pathlib import Path
21
import warnings
2+
from pathlib import Path
3+
34

45
class CustomIOGenerator:
56
"""
@@ -86,7 +87,7 @@ def generate(self) -> dict:
8687
custom_io_lang = {}
8788
for name in output_names.get("lang", []):
8889
if name.endswith("_RetainedState"):
89-
base = name[:-len("_RetainedState")]
90+
base = name[: -len("_RetainedState")]
9091
dtype = "float16" if "vision_embeds" in name else self.kv_cache_dtype
9192
custom_io_lang[base] = dtype
9293
custom_io_lang[name] = dtype
@@ -112,7 +113,7 @@ def generate(self) -> dict:
112113
custom_io = {}
113114
for name in output_names:
114115
if name.endswith("_RetainedState"):
115-
base = name[:-len("_RetainedState")]
116+
base = name[: -len("_RetainedState")]
116117
dtype = "float16" if "pixel_values" in name else self.kv_cache_dtype
117118
custom_io[base] = dtype
118119
custom_io[name] = dtype
@@ -136,7 +137,7 @@ def generate(self) -> dict:
136137
custom_io = {"input_features": self.kv_cache_dtype}
137138
for name in output_names:
138139
if name.endswith("_RetainedState"):
139-
base = name[:-len("_RetainedState")]
140+
base = name[: -len("_RetainedState")]
140141
custom_io[base] = self.kv_cache_dtype
141142
custom_io[name] = self.kv_cache_dtype
142143
self.dump(custom_io, self.dtype_suffix)

QEfficient/cloud/export.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
from QEfficient.base.common import QEFFCommonLoader
1313
from QEfficient.utils import check_and_assign_cache_dir
1414
from QEfficient.utils.logging_utils import logger
15+
1516
from .custom_yaml import generate_custom_io
17+
1618
# Specifically for Docker images.
1719
ROOT_DIR = os.path.dirname(os.path.abspath(""))
1820

@@ -108,4 +110,4 @@ def main(
108110
help="Set full batch size to enable continuous batching mode, default is None",
109111
)
110112
args = parser.parse_args()
111-
main(**args.__dict__)
113+
main(**args.__dict__)

QEfficient/compile/compile_helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def compile(
171171
Returns:
172172
:str: Path to compiled ``qpc`` package.
173173
"""
174-
174+
175175
if full_batch_size and batch_size != 1:
176176
raise ValueError("Only either batch_size or full_batch_size should be greater than one")
177177

@@ -185,7 +185,7 @@ def compile(
185185
path=specialization_json_path,
186186
full_batch_size=full_batch_size,
187187
)
188-
188+
189189
dtype_suffix = "int8" if mxint8 else "fp16"
190190
source_path = f"./custom_io_{dtype_suffix}.yaml"
191191
destination_path = os.path.join(os.path.dirname(qpc_path), f"custom_io_{dtype_suffix}.yaml")
@@ -244,4 +244,4 @@ def compile(
244244
else:
245245
logger.info(f"Compiled QPC files can be found here: {qpc_path}")
246246

247-
return qpc_path
247+
return qpc_path

0 commit comments

Comments
 (0)