Skip to content

Commit 729526f

Browse files
huggingface: Undefined model_id fix (#31358)
**Description:** This change fixes the undefined model_id issue when instantiating [ChatHuggingFace](https://github.com/langchain-ai/langchain/blob/master/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py#L306) **Issue:** Fixes #31357 @baskaryan @hwchase17
1 parent b7f3474 commit 729526f

File tree

1 file changed

+1
-1
lines changed
  • libs/partners/huggingface/langchain_huggingface/chat_models

1 file changed

+1
-1
lines changed

libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,12 +775,12 @@ def _resolve_model_id(self) -> None:
775775
elif _is_huggingface_pipeline(self.llm):
776776
from transformers import AutoTokenizer # type: ignore[import]
777777

778+
self.model_id = self.model_id or self.llm.model_id
778779
self.tokenizer = (
779780
AutoTokenizer.from_pretrained(self.model_id)
780781
if self.tokenizer is None
781782
else self.tokenizer
782783
)
783-
self.model_id = self.llm.model_id
784784
return
785785
elif _is_huggingface_endpoint(self.llm):
786786
self.model_id = self.llm.repo_id or self.llm.model

0 commit comments

Comments
 (0)