Skip to content

Commit

Permalink
add quantization support on MacOS (#1407)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Spycsh and pre-commit-ci[bot] committed Nov 22, 2023
1 parent 1a46aad commit 16d6a06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions neural_compressor/benchmark.py
Expand Up @@ -510,11 +510,10 @@ def fit(model, conf, b_dataloader=None, b_func=None):

if b_dataloader is not None:
check_dataloader(b_dataloader)

assert sys.platform in ["linux", "win32"], "only support platform windows and linux..."
assert sys.platform in ["linux", "win32", "darwin"], "platform not supported..."
# disable multi-instance for running benchmark on GPU device
set_all_env_var(conf)
if conf.device == "gpu":
if conf.device == "gpu" or sys.platform == "darwin":
set_env_var("NC_ENV_CONF", True, overwrite_existing=True)

if conf.diagnosis and os.environ.get("NC_ENV_CONF", None) in [None, "False"]:
Expand Down
5 changes: 4 additions & 1 deletion neural_compressor/utils/utility.py
Expand Up @@ -249,7 +249,10 @@ def __init__(self):
b"\xB8\x07\x00\x00\x00" b"\x0f\xa2" b"\xC3", # mov eax, 7 # cpuid # ret
)
self._bf16 = bool(eax & (1 << 5))
self._sockets = self.get_number_of_sockets()
if "arch" in info and "ARM" in info["arch"]: # pragma: no cover
self._sockets = 1
else:
self._sockets = self.get_number_of_sockets()
self._cores = psutil.cpu_count(logical=False)
self._cores_per_socket = int(self._cores / self._sockets)

Expand Down

0 comments on commit 16d6a06

Please sign in to comment.