From fde09d6bd306c2b07652fc368de5da179fd3f456 Mon Sep 17 00:00:00 2001 From: Kye <kye@apacmediasolutions.com> Date: Wed, 31 Jan 2024 21:31:48 -0500 Subject: [PATCH 1/5] [EXAMPLE][Tool Agent] --- playground/agents/tool_agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playground/agents/tool_agent.py b/playground/agents/tool_agent.py index 93e07ff3..91b576a4 100644 --- a/playground/agents/tool_agent.py +++ b/playground/agents/tool_agent.py @@ -33,4 +33,4 @@ agent = ToolAgent( generated_data = agent.run(task) # Print the generated data -print(generated_data) +print(f"Generated data: {generated_data}") From 5569a5daf8ecc0d5b51d715f518da3b1b5a4c68b Mon Sep 17 00:00:00 2001 From: Kye <kye@apacmediasolutions.com> Date: Wed, 31 Jan 2024 21:33:58 -0500 Subject: [PATCH 2/5] [BUFG][ToolAgent] --- playground/agents/tool_agent.py | 2 +- swarms/agents/tool_agent.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/playground/agents/tool_agent.py b/playground/agents/tool_agent.py index 91b576a4..3cd93fbd 100644 --- a/playground/agents/tool_agent.py +++ b/playground/agents/tool_agent.py @@ -26,7 +26,7 @@ task = ( # Create an instance of the ToolAgent class agent = ToolAgent( - model=model, tokenizer=tokenizer, json_schema=json_schema + name="dolly-function-agent", description="Ana gent to create a child data", model=model, tokenizer=tokenizer, json_schema=json_schema ) # Run the agent to generate the person's information diff --git a/swarms/agents/tool_agent.py b/swarms/agents/tool_agent.py index d9359471..f6d9f6e8 100644 --- a/swarms/agents/tool_agent.py +++ b/swarms/agents/tool_agent.py @@ -61,11 +61,11 @@ class ToolAgent(AbstractLLM): def __init__( self, - name: str, - description: str, - model: Any, - tokenizer: Any, - json_schema: Any, + name: str = None, + description: str = None, + model: Any = None, + tokenizer: Any = None, + json_schema: Any = None, max_number_tokens: int = 500, *args, **kwargs, From 18b8a5d602d1249d141716ef550bff64bde8ae98 Mon Sep 17 00:00:00 2001 From: Kye <kye@apacmediasolutions.com> Date: Wed, 31 Jan 2024 21:40:37 -0500 Subject: [PATCH 3/5] [REFACTOR][ToolAgent][name and description] --- playground/agents/tool_agent.py | 6 +++++- swarms/agents/tool_agent.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/playground/agents/tool_agent.py b/playground/agents/tool_agent.py index 3cd93fbd..71d10bb8 100644 --- a/playground/agents/tool_agent.py +++ b/playground/agents/tool_agent.py @@ -26,7 +26,11 @@ task = ( # Create an instance of the ToolAgent class agent = ToolAgent( - name="dolly-function-agent", description="Ana gent to create a child data", model=model, tokenizer=tokenizer, json_schema=json_schema + name="dolly-function-agent", + description="Ana gent to create a child data", + model=model, + tokenizer=tokenizer, + json_schema=json_schema, ) # Run the agent to generate the person's information diff --git a/swarms/agents/tool_agent.py b/swarms/agents/tool_agent.py index f6d9f6e8..8e6adf9d 100644 --- a/swarms/agents/tool_agent.py +++ b/swarms/agents/tool_agent.py @@ -61,8 +61,8 @@ class ToolAgent(AbstractLLM): def __init__( self, - name: str = None, - description: str = None, + name: str = "Function Calling Agent", + description: str = "Generates a function based on the input json schema and the task", model: Any = None, tokenizer: Any = None, json_schema: Any = None, From 537f81f93272cd6e3b57ffb72e7b0b083807efde Mon Sep 17 00:00:00 2001 From: Kye <kye@apacmediasolutions.com> Date: Wed, 31 Jan 2024 21:46:09 -0500 Subject: [PATCH 4/5] [REFACTOR][ToolAgent] --- playground/agents/tool_agent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/playground/agents/tool_agent.py b/playground/agents/tool_agent.py index 71d10bb8..0a95f42c 100644 --- a/playground/agents/tool_agent.py +++ b/playground/agents/tool_agent.py @@ -4,7 +4,9 @@ from swarms import ToolAgent # Load the pre-trained model and tokenizer model = AutoModelForCausalLM.from_pretrained( - "databricks/dolly-v2-12b" + "databricks/dolly-v2-12b", + load_in_4bit=True, + device_map="auto", ) tokenizer = AutoTokenizer.from_pretrained("databricks/dolly-v2-12b") From a552a983730c98b2b7d9da386ea4dc7053166657 Mon Sep 17 00:00:00 2001 From: Kye <kye@apacmediasolutions.com> Date: Wed, 31 Jan 2024 21:59:54 -0500 Subject: [PATCH 5/5] [EXAMPLES][Cleanup][Kosmos] --- playground/models/kosmos2_example.py | 10 ---------- playground/models/kosmos_two_example.py | 11 ----------- pyproject.toml | 2 +- 3 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 playground/models/kosmos2_example.py delete mode 100644 playground/models/kosmos_two_example.py diff --git a/playground/models/kosmos2_example.py b/playground/models/kosmos2_example.py deleted file mode 100644 index 6fc4df02..00000000 --- a/playground/models/kosmos2_example.py +++ /dev/null @@ -1,10 +0,0 @@ -from swarms.models.kosmos2 import Kosmos2 -from PIL import Image - - -model = Kosmos2.initialize() - -image = Image.open("images/swarms.jpg") - -detections = model(image) -print(detections) diff --git a/playground/models/kosmos_two_example.py b/playground/models/kosmos_two_example.py deleted file mode 100644 index 8bf583cd..00000000 --- a/playground/models/kosmos_two_example.py +++ /dev/null @@ -1,11 +0,0 @@ -from swarms.models.kosmos_two import Kosmos - -# Initialize Kosmos -kosmos = Kosmos() - -# Perform multimodal grounding -out = kosmos.multimodal_grounding( - "Find the red apple in the image.", "images/swarms.jpeg" -) - -print(out) diff --git a/pyproject.toml b/pyproject.toml index c9f0c28d..f4971b47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "4.0.1" +version = "4.0.2" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez <kye@apac.ai>"]