File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ def _is_package_available(pkg_name: str):
186186_gguf_available , _gguf_version = _is_package_available ("gguf" )
187187_torchao_available , _torchao_version = _is_package_available ("torchao" )
188188_bitsandbytes_available , _bitsandbytes_version = _is_package_available ("bitsandbytes" )
189-
189+ _torchao_available , _torchao_version = _is_package_available ( "torchao" )
190190
191191_optimum_quanto_available = importlib .util .find_spec ("optimum" ) is not None
192192if _optimum_quanto_available :
@@ -725,6 +725,21 @@ def is_optimum_quanto_version(operation: str, version: str):
725725 return compare_versions (parse (_optimum_quanto_version ), operation , version )
726726
727727
728+ def is_torchao_version (operation : str , version : str ):
729+ """
730+ Compares the current Accelerate version to a given reference with an operation.
731+
732+ Args:
733+ operation (`str`):
734+ A string representation of an operator, such as `">"` or `"<="`
735+ version (`str`):
736+ A version string
737+ """
738+ if not _torch_available :
739+ return False
740+ return compare_versions (parse (_torchao_version ), operation , version )
741+
742+
728743def get_objects_from_module (module ):
729744 """
730745 Returns a dict of object names and values in a module, while skipping private/internal objects
You can’t perform that action at this time.
0 commit comments