Spaces:
Sleeping
Sleeping
Update huggingface_llm.py
Browse files- huggingface_llm.py +9 -3
huggingface_llm.py
CHANGED
@@ -11,8 +11,8 @@ class HuggingFaceLLM(LLM):
|
|
11 |
max_tokens: int = Field(default=256, description="Maximum number of tokens to generate")
|
12 |
device: str = Field(default="cpu", description="Device to run the model on")
|
13 |
|
14 |
-
_model: Any = PrivateAttr()
|
15 |
-
_tokenizer: Any = PrivateAttr()
|
16 |
|
17 |
def __init__(self, **kwargs):
|
18 |
super().__init__(**kwargs)
|
@@ -51,4 +51,10 @@ class HuggingFaceLLM(LLM):
|
|
51 |
|
52 |
@property
|
53 |
def _identifying_params(self) -> Dict[str, Any]:
|
54 |
-
return {"model_id": self.model_id, "temperature": self.temperature, "max_tokens": self.max_tokens, "device": self.device}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
max_tokens: int = Field(default=256, description="Maximum number of tokens to generate")
|
12 |
device: str = Field(default="cpu", description="Device to run the model on")
|
13 |
|
14 |
+
_model: Optional[Any] = PrivateAttr(default=None)
|
15 |
+
_tokenizer: Optional[Any] = PrivateAttr(default=None)
|
16 |
|
17 |
def __init__(self, **kwargs):
|
18 |
super().__init__(**kwargs)
|
|
|
51 |
|
52 |
@property
|
53 |
def _identifying_params(self) -> Dict[str, Any]:
|
54 |
+
return {"model_id": self.model_id, "temperature": self.temperature, "max_tokens": self.max_tokens, "device": self.device}
|
55 |
+
|
56 |
+
def __setattr__(self, name, value):
|
57 |
+
if name in ["_model", "_tokenizer"]:
|
58 |
+
object.__setattr__(self, name, value)
|
59 |
+
else:
|
60 |
+
super().__setattr__(name, value)
|