Skip to content

Commit e8f35bb

Browse files
Merge pull request #153 from chichun-charlie-liu/main
fix: fix available_packages
2 parents 9b75c10 + 6d70339 commit e8f35bb

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

fms_mo/utils/import_utils.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616
Utils for storing what optional dependencies are available
1717
"""
1818

19+
# Standard
20+
import pkgutil
21+
import sys
22+
1923
# Third Party
2024
from transformers.utils.import_utils import _is_package_available
2125
import torch
2226

27+
all_available_modules = []
28+
for finder, name, ispkg in pkgutil.iter_modules(sys.path):
29+
all_available_modules.append(name)
30+
2331
optional_packages = [
2432
"gptqmodel",
2533
"gptqmodel_exllama_kernels",
@@ -37,7 +45,9 @@
3745

3846
available_packages = {}
3947
for package in optional_packages:
40-
available_packages[package] = _is_package_available(package)
48+
available_packages[package] = (
49+
_is_package_available(package) or package in all_available_modules
50+
)
4151

4252
# cutlass is detected through torch.ops.cutlass_gemm
4353
available_packages["cutlass"] = hasattr(torch.ops, "cutlass_gemm") and hasattr(

tests/build/test_launch_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def _validate_quantization_output(base_dir, quant_method):
250250
assert os.path.exists(os.path.join(base_dir, "tokenizer.json")) is True
251251
assert os.path.exists(os.path.join(base_dir, "special_tokens_map.json")) is True
252252
assert os.path.exists(os.path.join(base_dir, "tokenizer_config.json")) is True
253-
assert os.path.exists(os.path.join(base_dir, "tokenizer.model")) is True
253+
# assert os.path.exists(os.path.join(base_dir, "tokenizer.model")) is True
254254

255255
# Check quantized model files exist
256256
if quant_method == "gptq":

0 commit comments

Comments
 (0)