From 368aa92ab2f9c4ecccdb43e4f1516764ab1f01d4 Mon Sep 17 00:00:00 2001 From: Kye Date: Mon, 15 Jan 2024 04:20:57 -0500 Subject: [PATCH] [FEAT][TogetherModel] --- playground/models/together.py | 10 ++++++++++ pyproject.toml | 2 +- swarms/models/__init__.py | 2 ++ swarms/structs/blockdevice.py | 11 ++++++++--- swarms/structs/load_balancer.py | 21 +++++++++++++++++++++ 5 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 playground/models/together.py diff --git a/playground/models/together.py b/playground/models/together.py new file mode 100644 index 00000000..f791247d --- /dev/null +++ b/playground/models/together.py @@ -0,0 +1,10 @@ +from swarms import TogetherModel + +# Initialize the model with your parameters +model = TogetherModel( + model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1", + max_tokens=1000, +) + +# Run the model +model.run("Generate a blog post about the best way to make money online.") \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 13470c90..b62bf65d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "3.5.5" +version = "3.5.6" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] diff --git a/swarms/models/__init__.py b/swarms/models/__init__.py index 9339b8e2..6a884648 100644 --- a/swarms/models/__init__.py +++ b/swarms/models/__init__.py @@ -22,6 +22,7 @@ from swarms.models.modelscope_pipeline import ModelScopePipeline from swarms.models.modelscope_llm import ( ModelScopeAutoModel, ) # noqa: E402 +from swarms.models.together import TogetherModel # noqa: E402 ################# MultiModal Models from swarms.models.base_multimodal_model import ( @@ -93,4 +94,5 @@ __all__ = [ "CogAgent", "ModelScopePipeline", "ModelScopeAutoModel", + "TogetherModel", ] diff --git a/swarms/structs/blockdevice.py b/swarms/structs/blockdevice.py index 49e3fba7..96b8c8e6 100644 --- a/swarms/structs/blockdevice.py +++ b/swarms/structs/blockdevice.py @@ -3,9 +3,14 @@ from dataclasses import dataclass @dataclass class BlockDevice: - device: str - cluster: str - description: str + """ + Represents a block device. + + Attributes: + device (str): The device name. + cluster (str): The cluster name. + description (str): A description of the block device. + """ def __init__(self, device: str, cluster: str, description: str): self.device = device diff --git a/swarms/structs/load_balancer.py b/swarms/structs/load_balancer.py index 8efa9ec3..f0038335 100644 --- a/swarms/structs/load_balancer.py +++ b/swarms/structs/load_balancer.py @@ -4,6 +4,27 @@ from swarms.structs.base import BaseStructure class LoadBalancer(BaseStructure): + """ + A load balancer class that distributes tasks among multiple workers. + + Args: + num_workers (int): The number of worker processes to create. + agents (Optional[List]): A list of agents to assign to the load balancer. + *args: Variable length argument list. + **kwargs: Arbitrary keyword arguments. + + Attributes: + num_workers (int): The number of worker processes. + agents (Optional[List]): A list of agents assigned to the load balancer. + tasks (List): A list of tasks to be executed. + results (List): A list of results from the executed tasks. + workers (List): A list of worker processes. + + Methods: + add_task: Add a task to the load balancer. + + """ + def __init__( self, num_workers: int = 1,