Skip to content

Commit

Permalink
Address reviewer feedback
Browse files Browse the repository at this point in the history
- min torchao version
- remove TODO
  • Loading branch information
BenjaminBossan committed Sep 13, 2024
1 parent 147f022 commit 38294eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source/developer_guides/quantization.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ model = get_peft_model(base_model, peft_config)

### Caveats:

- Use the most recent versions of torchao and transformers for best results.
- Use the most recent versions of torchao (>= v0.4.0) and transformers (> 4.42).
- Only linear layers are currently supported.
- `quant_type = "int4_weight_only"` is currently not supported.
- `NF4` is not implemented in transformers as of yet and is thus also not supported.
Expand Down
13 changes: 12 additions & 1 deletion src/peft/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,15 @@ def is_hqq_available():

@lru_cache
def is_torchao_available():
return importlib.util.find_spec("torchao") is not None
if importlib.util.find_spec("torchao") is None:
return False

TORCHAO_MINIMUM_VERSION = packaging.version.parse("0.4.0")
torchao_version = packaging.version.parse(importlib_metadata.version("torchao"))

if torchao_version < TORCHAO_MINIMUM_VERSION:
raise ImportError(
f"Found an incompatible version of auto-gptq. Found version {torchao_version}, "
f"but only versions above {TORCHAO_MINIMUM_VERSION} are supported"
)
return True
1 change: 0 additions & 1 deletion src/peft/tuners/lora/torchao.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def unmerge(self) -> None:
del weight

def __repr__(self) -> str:
# TODO
rep = super().__repr__()
return rep.replace("lora.Linear", f"lora.{self.__class__.__name__}")

Expand Down

0 comments on commit 38294eb

Please sign in to comment.