Skip to content

Commit

Permalink
Fix reading model info in get_adapter_info() for HF (#695)
Browse files Browse the repository at this point in the history
The config key on HF side has not changed from `adapter_transformers`.
Thus, currently the model name is never returned correctly for HF
adapters.

This is required to fix the HF hub inference widgets.
  • Loading branch information
calpt authored May 8, 2024
1 parent 7a946c8 commit 6ab8185
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/adapters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,9 @@ def get_adapter_info(adapter_id: str, source: str = "ah") -> Optional[AdapterInf
return AdapterInfo(
source="hf",
adapter_id=model_info.modelId,
model_name=model_info.config.get("adapters", {}).get("model_name") if model_info.config else None,
model_name=model_info.config.get("adapter_transformers", {}).get("model_name")
if model_info.config
else None,
username=model_info.modelId.split("/")[0],
sha1_checksum=model_info.sha,
)
Expand Down

0 comments on commit 6ab8185

Please sign in to comment.