From 91a36c855702df41516f8b2cee0ce74bc7f8c7c4 Mon Sep 17 00:00:00 2001 From: Kye Date: Fri, 5 Jan 2024 18:00:34 -0500 Subject: [PATCH] [FIX][HuggingfaceLLM] --- block.py | 2 +- pyproject.toml | 2 +- swarms/models/huggingface.py | 5 ++--- swarms/structs/blockslist.py | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/block.py b/block.py index c5a76910..93894245 100644 --- a/block.py +++ b/block.py @@ -94,4 +94,4 @@ blocks_by_parent_description = swarm.get_by_parent_description( # Run the block in the swarm inference = swarm.run_block(toolagent, "Hello World") -print(inference) \ No newline at end of file +print(inference) diff --git a/pyproject.toml b/pyproject.toml index e0602d43..fb6cc323 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "3.4.1" +version = "3.4.2" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] diff --git a/swarms/models/huggingface.py b/swarms/models/huggingface.py index 8e74cff5..cdfa9de3 100644 --- a/swarms/models/huggingface.py +++ b/swarms/models/huggingface.py @@ -131,7 +131,7 @@ class HuggingfaceLLM(AbstractLLM): temperature: float = 0.7, top_k: int = 40, top_p: float = 0.8, - dtype = torch.bfloat16, + dtype=torch.bfloat16, *args, **kwargs, ): @@ -189,7 +189,6 @@ class HuggingfaceLLM(AbstractLLM): self.model_id, *args, **kwargs ).to(self.device) - def print_error(self, error: str): """Print error""" print(colored(f"Error: {error}", "red")) @@ -264,7 +263,7 @@ class HuggingfaceLLM(AbstractLLM): *args, **kwargs, ) - + return self.tokenizer.decode( outputs[0], skip_special_tokens=True ) diff --git a/swarms/structs/blockslist.py b/swarms/structs/blockslist.py index 8448454c..b2a4db08 100644 --- a/swarms/structs/blockslist.py +++ b/swarms/structs/blockslist.py @@ -75,8 +75,8 @@ class BlocksList(BaseStructure): def get_all(self): return self.blocks - - def run_block(self, block: Any, task: str, *args, **kwargs): + + def run_block(self, block: Any, task: str, *args, **kwargs): """Run the block for the specified task. Args: