Skip to content

Commit

Permalink
[MIGRATION]
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Sep 12, 2024
1 parent 6c9f76d commit e9d8f1a
Show file tree
Hide file tree
Showing 28 changed files with 62 additions and 64 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[![Multi-Modality](agorabanner.png)](https://discord.com/servers/agora-999382051935506503)

# Swarms Models

[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb)


2 changes: 1 addition & 1 deletion swarm_models/base_multimodal_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BaseMultiModalModel(BaseStructure):
retries (Optional[int], optional): Retries. Defaults to 3.
Examples:
>>> from swarms_models.base_multimodal_model import BaseMultiModalModel
>>> from swarm_models.base_multimodal_model import BaseMultiModalModel
>>> model = BaseMultiModalModel()
>>> model.run("Generate a summary of this text")
>>> model.run("Generate a summary of this text", "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png")
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/base_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from abc import abstractmethod
from typing import Optional

from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM


class BaseTTSModel(BaseLLM):
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/base_ttv.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from diffusers.utils import export_to_video

from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM


class BaseTextToVideo(BaseLLM):
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/cog_vlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
TextIteratorStreamer,
)

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel
from swarms.utils.loguru_logger import logger

MODEL_PATH = "THUDM/cogvlm-chat-hf"
Expand Down
4 changes: 2 additions & 2 deletions swarm_models/fuyu.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
FuyuProcessor,
)

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


class Fuyu(BaseMultiModalModel):
Expand All @@ -26,7 +26,7 @@ class Fuyu(BaseMultiModalModel):
Examples:
>>> from swarms_models import Fuyu
>>> from swarm_models import Fuyu
>>> model = Fuyu()
>>> model.run("Hello, world!", "https://upload.wikimedia.org/wikipedia/commons/8/86/Id%C3%A9fix.JPG")
"""
Expand Down
4 changes: 2 additions & 2 deletions swarm_models/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dotenv import load_dotenv
from PIL import Image

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel

try:
import google.generativeai as genai
Expand Down Expand Up @@ -62,7 +62,7 @@ class Gemini(BaseMultiModalModel):
Examples:
>>> from swarms_models import Gemini
>>> from swarm_models import Gemini
>>> gemini = Gemini()
>>> gemini.run(
task="A dog",
Expand Down
6 changes: 3 additions & 3 deletions swarm_models/gpt4_vision_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from dotenv import load_dotenv
from termcolor import colored
from swarms.utils.loguru_logger import logger
from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel

# Load environment variables
load_dotenv()
Expand Down Expand Up @@ -47,7 +47,7 @@ class GPT4VisionAPI(BaseMultiModalModel):
Examples:
---------
>>> from swarms_models import GPT4VisionAPI
>>> from swarm_models import GPT4VisionAPI
>>> llm = GPT4VisionAPI()
>>> task = "What is the color of the object?"
>>> img = "https://i.imgur.com/2M2ZGwC.jpeg"
Expand Down Expand Up @@ -188,7 +188,7 @@ def video_prompt(self, frames):
Examples
--------
>>> from swarms_models import GPT4VisionAPI
>>> from swarm_models import GPT4VisionAPI
>>> llm = GPT4VisionAPI()
>>> video = "video.mp4"
>>> base64_frames = llm.process_video(video)
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
BitsAndBytesConfig,
)

from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM


class HuggingfaceLLM(BaseLLM):
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/huggingface_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch
from termcolor import colored

from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM
from transformers.pipelines import pipeline


Expand Down
4 changes: 2 additions & 2 deletions swarm_models/idefics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from termcolor import colored
from transformers import AutoProcessor, IdeficsForVisionText2Text

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


def autodetect_device():
Expand Down Expand Up @@ -55,7 +55,7 @@ class Idefics(BaseMultiModalModel):
# Usage
```
from swarms_models import idefics
from swarm_models import idefics
model = idefics()
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/kosmos_two.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from PIL import Image
from transformers import AutoModelForVision2Seq, AutoProcessor

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


# utils
Expand Down
4 changes: 2 additions & 2 deletions swarm_models/layoutlm_document_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from transformers import pipeline

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


class LayoutLMDocumentQA(BaseMultiModalModel):
Expand All @@ -17,7 +17,7 @@ class LayoutLMDocumentQA(BaseMultiModalModel):
task (str, optional): [description]. Defaults to "document-question-answering".
Usage:
>>> from swarms_models import LayoutLMDocumentQA
>>> from swarm_models import LayoutLMDocumentQA
>>> model = LayoutLMDocumentQA()
>>> out = model("What is the total amount?", "path/to/img.png")
>>> print(out)
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/llama3_hosted.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import requests
import json
from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM


class llama3Hosted(BaseLLM):
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/llama_function_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
BitsAndBytesConfig,
TextStreamer,
)
from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM


class LlamaFunctionCaller(BaseLLM):
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/llava.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from PIL import Image
from transformers import AutoProcessor, LlavaForConditionalGeneration

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


class LavaMultiModal(BaseMultiModalModel):
Expand Down
54 changes: 27 additions & 27 deletions swarm_models/model_router.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
from typing import List, Union

from swarms_models.base_embedding_model import BaseEmbeddingModel
from swarms_models.base_llm import BaseLLM
from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarms_models.fuyu import Fuyu # noqa: E402
from swarms_models.gpt4_vision_api import GPT4VisionAPI # noqa: E402
from swarms_models.huggingface import HuggingfaceLLM # noqa: E402
from swarms_models.idefics import Idefics # noqa: E402
from swarms_models.kosmos_two import Kosmos # noqa: E402
from swarms_models.layoutlm_document_qa import LayoutLMDocumentQA
from swarms_models.llama3_hosted import llama3Hosted
from swarms_models.llava import LavaMultiModal # noqa: E402
from swarms_models.nougat import Nougat # noqa: E402
from swarms_models.openai_embeddings import OpenAIEmbeddings
from swarms_models.openai_function_caller import OpenAIFunctionCaller
from swarms_models.openai_tts import OpenAITTS # noqa: E402
from swarms_models.palm import GooglePalm as Palm # noqa: E402
from swarms_models.popular_llms import Anthropic as Anthropic
from swarms_models.popular_llms import (
from swarm_models.base_embedding_model import BaseEmbeddingModel
from swarm_models.base_llm import BaseLLM
from swarm_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.fuyu import Fuyu # noqa: E402
from swarm_models.gpt4_vision_api import GPT4VisionAPI # noqa: E402
from swarm_models.huggingface import HuggingfaceLLM # noqa: E402
from swarm_models.idefics import Idefics # noqa: E402
from swarm_models.kosmos_two import Kosmos # noqa: E402
from swarm_models.layoutlm_document_qa import LayoutLMDocumentQA
from swarm_models.llama3_hosted import llama3Hosted
from swarm_models.llava import LavaMultiModal # noqa: E402
from swarm_models.nougat import Nougat # noqa: E402
from swarm_models.openai_embeddings import OpenAIEmbeddings
from swarm_models.openai_function_caller import OpenAIFunctionCaller
from swarm_models.openai_tts import OpenAITTS # noqa: E402
from swarm_models.palm import GooglePalm as Palm # noqa: E402
from swarm_models.popular_llms import Anthropic as Anthropic
from swarm_models.popular_llms import (
AzureOpenAILLM as AzureOpenAI,
)
from swarms_models.popular_llms import (
from swarm_models.popular_llms import (
CohereChat as Cohere,
)
from swarms_models.popular_llms import FireWorksAI, OctoAIChat
from swarms_models.popular_llms import (
from swarm_models.popular_llms import FireWorksAI, OctoAIChat
from swarm_models.popular_llms import (
OpenAIChatLLM as OpenAIChat,
)
from swarms_models.popular_llms import (
from swarm_models.popular_llms import (
OpenAILLM as OpenAI,
)
from swarms_models.popular_llms import ReplicateChat as Replicate
from swarms_models.qwen import QwenVLMultiModal # noqa: E402
from swarms_models.sampling_params import SamplingParams
from swarms_models.together import TogetherLLM # noqa: E402
from swarms_models.vilt import Vilt # noqa: E402
from swarm_models.popular_llms import ReplicateChat as Replicate
from swarm_models.qwen import QwenVLMultiModal # noqa: E402
from swarm_models.sampling_params import SamplingParams
from swarm_models.together import TogetherLLM # noqa: E402
from swarm_models.vilt import Vilt # noqa: E402
from swarms.structs.base_structure import BaseStructure
from swarms.utils.loguru_logger import logger

Expand Down
2 changes: 1 addition & 1 deletion swarm_models/moondream_mm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from PIL import Image
from transformers import AutoModelForCausalLM, AutoTokenizer

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


class MoonDream(BaseMultiModalModel):
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/nougat.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Nougat:
max_new_tokens: int, default=30
Usage:
>>> from swarms_models.nougat import Nougat
>>> from swarm_models.nougat import Nougat
>>> nougat = Nougat()
>>> nougat("path/to/image.png")
Expand Down
4 changes: 2 additions & 2 deletions swarm_models/open_dalle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch
from diffusers import AutoPipelineForText2Image

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


class OpenDalle(BaseMultiModalModel):
Expand All @@ -15,7 +15,7 @@ class OpenDalle(BaseMultiModalModel):
device (str): The device to be used for computation. Defaults to "cuda".
Examples:
>>> from swarms_models.open_dalle import OpenDalle
>>> from swarm_models.open_dalle import OpenDalle
>>> od = OpenDalle()
>>> od.run("A picture of a cat")
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/open_router.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM
from pydantic import BaseModel
from typing import List, Dict
import openai
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/openai_function_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pydantic import BaseModel
import os
from swarms.utils.loguru_logger import logger
from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM
from typing import List


Expand Down
4 changes: 2 additions & 2 deletions swarm_models/openai_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import requests
from dotenv import load_dotenv

from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM

try:
import wave
Expand Down Expand Up @@ -41,7 +41,7 @@ class OpenAITTS(BaseLLM):
Examples:
>>> from swarms_models.openai_tts import OpenAITTS
>>> from swarm_models.openai_tts import OpenAITTS
>>> tts = OpenAITTS(
... model_name = "tts-1-1106",
... proxy_url = "https://api.openai.com/v1/audio/speech",
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/qwen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from PIL import Image
from transformers import AutoModelForCausalLM, AutoTokenizer

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions swarm_models/together.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import requests
from dotenv import load_dotenv

from swarms_models.base_llm import BaseLLM
from swarm_models.base_llm import BaseLLM

# Load environment variables
load_dotenv()
Expand Down Expand Up @@ -41,7 +41,7 @@ class TogetherLLM(BaseLLM):
Examples:
---------
>>> from swarms_models import GPT4VisionAPI
>>> from swarm_models import GPT4VisionAPI
>>> llm = GPT4VisionAPI()
>>> task = "What is the color of the object?"
>>> img = "https://i.imgur.com/2M2ZGwC.jpeg"
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/vilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from PIL import Image
from transformers import ViltForQuestionAnswering, ViltProcessor

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


class Vilt(BaseMultiModalModel):
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/vip_llava.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
VipLlavaForConditionalGeneration,
)

from swarms_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.base_multimodal_model import BaseMultiModalModel


class VipLlavaMultiModal(BaseMultiModalModel):
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/zeroscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ZeroscopeTTV:
Performs forward pass on the input task and returns the path of the generated video.
Examples:
>>> from swarms_models
>>> from swarm_models
>>> zeroscope = ZeroscopeTTV()
>>> task = "A person is walking on the street."
>>> video_path = zeroscope(task)
Expand Down

0 comments on commit e9d8f1a

Please sign in to comment.