From 574c1ae66e5fd78fb8c3d5eea7ebfd63e0502b34 Mon Sep 17 00:00:00 2001 From: Kye Date: Tue, 5 Dec 2023 11:08:32 -0800 Subject: [PATCH] [TETSS] --- swarms/models/huggingface.py | 5 +++-- tests/models/test_gpt4_vision_api.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/swarms/models/huggingface.py b/swarms/models/huggingface.py index 295949f5..88620654 100644 --- a/swarms/models/huggingface.py +++ b/swarms/models/huggingface.py @@ -272,7 +272,7 @@ class HuggingfaceLLM: try: inputs = self.tokenizer.encode( task, return_tensors="pt" - ).to(self.device) + ) # self.log.start() @@ -451,7 +451,8 @@ class HuggingfaceLLM: The new device to use for inference. """ self.device = device - self.model.to(self.device) + if self.model is not None: + self.model.to(self.device) def set_max_length(self, max_length): """Set max_length""" diff --git a/tests/models/test_gpt4_vision_api.py b/tests/models/test_gpt4_vision_api.py index c716bb7c..14d53f74 100644 --- a/tests/models/test_gpt4_vision_api.py +++ b/tests/models/test_gpt4_vision_api.py @@ -36,7 +36,7 @@ def test_encode_image(vision_api): def test_run_success(vision_api): expected_response = { - "choices": [{"text": "This is the model's response."}] + "This is the model's response." } with patch( "requests.post",