diff --git a/pyproject.toml b/pyproject.toml index 5c30cca4..e5fb11f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ backoff = "2.2.1" marshmallow = "3.19.0" datasets = "2.10.1" optimum = "1.15.0" -diffusers = "0.17.1" +diffusers = "*" PyPDF2 = "3.0.1" accelerate = "0.22.0" sentencepiece = "0.1.98" diff --git a/requirements.txt b/requirements.txt index 2ac7e502..d0dedf2e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,7 +40,7 @@ albumentations basicsr termcolor==2.2.0 controlnet-aux -diffusers==0.17.1 +diffusers einops==0.7.0 imageio==2.25.1 opencv-python-headless==4.8.1.78 diff --git a/swarms/models/kosmos_two.py b/swarms/models/kosmos_two.py index b953ddf9..6bc4d810 100644 --- a/swarms/models/kosmos_two.py +++ b/swarms/models/kosmos_two.py @@ -10,6 +10,7 @@ from transformers import AutoModelForVision2Seq, AutoProcessor from swarms.models.base_multimodal_model import BaseMultiModalModel + # utils def is_overlapping(rect1, rect2): x1, y1, x2, y2 = rect1 diff --git a/swarms/swarms/__init__.py b/swarms/swarms/__init__.py index ed39abfb..38ee6fb9 100644 --- a/swarms/swarms/__init__.py +++ b/swarms/swarms/__init__.py @@ -2,6 +2,7 @@ from swarms.structs.autoscaler import AutoScaler from swarms.swarms.model_parallizer import ModelParallelizer from swarms.swarms.multi_agent_collab import MultiAgentCollaboration from swarms.swarms.base import AbstractSwarm + # from swarms.swarms.team import Team __all__ = [ diff --git a/swarms/swarms/team.py b/swarms/swarms/team.py index d4482db9..36c773e2 100644 --- a/swarms/swarms/team.py +++ b/swarms/swarms/team.py @@ -21,12 +21,16 @@ class Team(BaseModel): """ tasks: Optional[List[Task]] = Field(description="List of tasks") - agents: Optional[List[Agent]] = Field(description="List of agents in this Team.") + agents: Optional[List[Agent]] = Field( + description="List of agents in this Team." + ) architecture = Field( - description="architecture that the Team will follow.", default="sequential" + description="architecture that the Team will follow.", + default="sequential", ) verbose: bool = Field( - description="Verbose mode for the Agent Execution", default=False + description="Verbose mode for the Agent Execution", + default=False, ) config: Optional[Json] = Field( description="Configuration of the Team.", default=None @@ -37,19 +41,27 @@ class Team(BaseModel): if not values.get("config") and ( not values.get("agents") and not values.get("tasks") ): - raise ValueError("Either agents and task need to be set or config.") + raise ValueError( + "Either agents and task need to be set or config." + ) if values.get("config"): config = json.loads(values.get("config")) if not config.get("agents") or not config.get("tasks"): - raise ValueError("Config should have agents and tasks.") + raise ValueError( + "Config should have agents and tasks." + ) - values["agents"] = [Agent(**agent) for agent in config["agents"]] + values["agents"] = [ + Agent(**agent) for agent in config["agents"] + ] tasks = [] for task in config["tasks"]: task_agent = [ - agt for agt in values["agents"] if agt.role == task["agent"] + agt + for agt in values["agents"] + if agt.role == task["agent"] ][0] del task["agent"] tasks.append(Task(**task, agent=task_agent)) @@ -92,4 +104,4 @@ class Team(BaseModel): def __log(self, message): if self.verbose: - print(message) \ No newline at end of file + print(message) diff --git a/tests/models/test_ssd_1b.py b/tests/models/test_ssd_1b.py index 95f322ef..39e4264e 100644 --- a/tests/models/test_ssd_1b.py +++ b/tests/models/test_ssd_1b.py @@ -162,5 +162,3 @@ def test_ssd1b_repr_str(ssd1b_model): image_url = ssd1b_model(task) assert repr(ssd1b_model) == f"SSD1B(image_url={image_url})" assert str(ssd1b_model) == f"SSD1B(image_url={image_url})" - - diff --git a/tests/tools/test_base.py b/tests/tools/test_tools_base.py similarity index 100% rename from tests/tools/test_base.py rename to tests/tools/test_tools_base.py diff --git a/tests/utils/test_class_args_wrapper.py b/tests/utils/test_class_args_wrapper.py index 67a8a7fa..a222ffe9 100644 --- a/tests/utils/test_class_args_wrapper.py +++ b/tests/utils/test_class_args_wrapper.py @@ -3,7 +3,6 @@ from io import StringIO from contextlib import redirect_stdout from swarms.utils.class_args_wrapper import print_class_parameters from swarms.structs.agent import Agent -from swarms.structs.autoscaler import Autoscaler from fastapi import FastAPI from fastapi.testclient import TestClient @@ -23,19 +22,6 @@ def test_print_class_parameters_agent(): assert output == expected_output -def test_print_class_parameters_autoscaler(): - f = StringIO() - with redirect_stdout(f): - print_class_parameters(Autoscaler) - output = f.getvalue().strip() - # Replace with the expected output for Autoscaler class - expected_output = ( - "Parameter: min_agents, Type: \nParameter:" - " max_agents, Type: " - ) - assert output == expected_output - - def test_print_class_parameters_error(): with pytest.raises(TypeError): print_class_parameters("Not a class") @@ -43,7 +29,7 @@ def test_print_class_parameters_error(): @app.get("/parameters/{class_name}") def get_parameters(class_name: str): - classes = {"Agent": Agent, "Autoscaler": Autoscaler} + classes = {"Agent": Agent} if class_name in classes: return print_class_parameters( classes[class_name], api_format=True @@ -63,17 +49,6 @@ def test_get_parameters_agent(): assert response.json() == expected_output -def test_get_parameters_autoscaler(): - response = client.get("/parameters/Autoscaler") - assert response.status_code == 200 - # Replace with the expected output for Autoscaler class - expected_output = { - "min_agents": "", - "max_agents": "", - } - assert response.json() == expected_output - - def test_get_parameters_not_found(): response = client.get("/parameters/NonexistentClass") assert response.status_code == 200 diff --git a/tests/utils/test_subprocess_code_interpreter.py b/tests/utils/test_subprocess_code_interpreter.py index 01f45da4..3ce54530 100644 --- a/tests/utils/test_subprocess_code_interpreter.py +++ b/tests/utils/test_subprocess_code_interpreter.py @@ -75,6 +75,3 @@ def test_handle_stream_output(interpreter, monkeypatch): monkeypatch.setattr("sys.stdout", mock_readline()) # More test code needed here to simulate and assert the behavior of handle_stream_output - - -# More tests needed for run method, error handling, and edge cases.