Merge pull request #1 from kyegomez/master

Catching up 20240201 739
pull/378/head
evelynmitchell 1 year ago committed by GitHub
commit 87626ece14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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")
@ -26,11 +28,15 @@ 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
generated_data = agent.run(task)
# Print the generated data
print(generated_data)
print(f"Generated data: {generated_data}")

@ -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)

@ -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)

@ -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>"]

@ -61,11 +61,11 @@ class ToolAgent(AbstractLLM):
def __init__(
self,
name: str,
description: str,
model: Any,
tokenizer: Any,
json_schema: Any,
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,
max_number_tokens: int = 500,
*args,
**kwargs,

Loading…
Cancel
Save