Skip to content

Commit 6625cd3

Browse files
authored
[Transform] Fix accelerate import to keep it as optional dependency (#480)
Import has_offloaded_params from compressed_tensors.utils.offload instead of accelerate.utils directly. This ensures accelerate remains optional and the package can be imported without it installed. The utils.offload module already has proper fallback handling with @check_accelerate decorator that returns False when accelerate is not available. Fixes ModuleNotFoundError when importing compressed_tensors without accelerate.
1 parent 07f3b78 commit 6625cd3

File tree

1 file changed

+1
-1
lines changed
  • src/compressed_tensors/transform

1 file changed

+1
-1
lines changed

src/compressed_tensors/transform/apply.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
from typing import Dict
1616

1717
import torch
18-
from accelerate.utils import has_offloaded_params
1918
from compressed_tensors import TRANSFORM_CONFIG_NAME
2019
from compressed_tensors.transform import TransformConfig, TransformFactory
20+
from compressed_tensors.utils.offload import has_offloaded_params
2121

2222

2323
__all__ = ["apply_transform_config"]

0 commit comments

Comments
 (0)