Skip to content

Commit

Permalink
[CLEANUP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Sep 17, 2024
1 parent 4acb11d commit 948fe44
Show file tree
Hide file tree
Showing 15 changed files with 317 additions and 85 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ OPENAI_API_KEY="your_openai_api_key"
GROQ_API_KEY="your_groq_api_key"
ANTHROPIC_API_KEY="your_anthropic_api_key"
AZURE_OPENAI_API_KEY="your_azure_openai_api_key"
# Additional keys
# Additional keys
WORKSPACE_DIR="agent_workspace"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ __pycache__/
.Python
build/
develop-eggs/
agent_worpace
agent_worpace
dist/
downloads/
eggs/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Ready to streamline your API integrations and boost your application's performan
| `LayoutLMDocumentQA` | Model for document question answering. |
| `GPT4VisionAPI` | Model for analyzing images with GPT-4 capabilities. |
| `LlamaForCausalLM` | Causal language model from the Llama family. |
| `GroundedSAMTwo` | Analyzes and track objects in images. GPU Only |



Expand Down
Empty file removed example.py
Empty file.
16 changes: 16 additions & 0 deletions examples/models/sam2_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from swarm_models.sam_two import GroundedSAMTwo
from loguru import logger

# Example usage:
ontology = {"shipping container": "container"}
runner = GroundedSAMTwo(ontology)

# Run on a single image
image_path = "path/to/your/image.jpg"
json_output = runner.run(image_path, output_dir="annotated_images")
logger.info("Annotation result: \n{}", json_output)

# Run on a dataset (directory)
image_dir = "path/to/your/dataset"
json_output = runner.run(image_dir)
logger.info("Dataset labeling result: \n{}", json_output)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "swarm-models"
version = "0.0.4"
version = "0.0.7"
description = "Swarm Models - Pytorch"
license = "MIT"
authors = ["Kye Gomez <[email protected]>"]
Expand Down
8 changes: 3 additions & 5 deletions swarm_models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from swarm_models.base_embedding_model import BaseEmbeddingModel
from swarm_models.base_llm import BaseLLM # noqa: E402
from swarm_models.base_multimodal_model import BaseMultiModalModel
from swarm_models.fuyu import Fuyu # noqa: E402
Expand Down Expand Up @@ -29,7 +28,6 @@
)
from swarm_models.popular_llms import ReplicateChat as Replicate
from swarm_models.qwen import QwenVLMultiModal # noqa: E402
from swarm_models.sampling_params import SamplingParams, SamplingType
from swarm_models.together import TogetherLLM # noqa: E402
from swarm_models.model_types import ( # noqa: E402
AudioModality,
Expand All @@ -42,9 +40,10 @@
from swarm_models.popular_llms import FireWorksAI
from swarm_models.openai_function_caller import OpenAIFunctionCaller
from swarm_models.ollama_model import OllamaModel
from swarm_models.sam_two import GroundedSAMTwo
from swarm_models.utils import * # NOQA

__all__ = [
"BaseEmbeddingModel",
"BaseLLM",
"BaseMultiModalModel",
"Fuyu",
Expand All @@ -65,8 +64,6 @@
"OctoAIChat",
"QwenVLMultiModal",
"Replicate",
"SamplingParams",
"SamplingType",
"TogetherLLM",
"AudioModality",
"ImageModality",
Expand All @@ -79,4 +76,5 @@
"FireWorksAI",
"OpenAIFunctionCaller",
"OllamaModel",
"GroundedSAMTwo",
]
73 changes: 0 additions & 73 deletions swarm_models/base_embedding_model.py

This file was deleted.

3 changes: 1 addition & 2 deletions swarm_models/base_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import time
from abc import abstractmethod
from typing import List, Optional
from swarm_models.structs.base_structure import BaseStructure


class BaseLLM(BaseStructure):
class BaseLLM:
"""Abstract Language Model that defines the interface for all language models
Args:
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/gpt4_vision_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import requests
from dotenv import load_dotenv
from termcolor import colored
from swarm_models.utils.loguru_logger import logger
from loguru import logger
from swarm_models.base_multimodal_model import BaseMultiModalModel

# Load environment variables
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/ollama_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class Message(BaseModel):
role: str = Field(
...,
regex="^(user|system|assistant)$",
pattern="^(user|system|assistant)$",
description="The role of the message sender.",
)
content: str = Field(
Expand Down
2 changes: 1 addition & 1 deletion swarm_models/openai_function_caller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import openai
from pydantic import BaseModel
import os
from swarm_models.utils.loguru_logger import logger
from loguru import logger
from swarm_models.base_llm import BaseLLM
from typing import List

Expand Down
Loading

0 comments on commit 948fe44

Please sign in to comment.