Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[example] allow selecting medium model #109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions example_llama_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import asyncio
import json
import random
import sys
from typing import List

from chatlab import FunctionRegistry, tool_result
Expand All @@ -18,12 +17,16 @@


class FunctionaryAPI:
def __init__(self):
def __init__(self, model="functionary-small-v2.2"):
# Model repository on the Hugging Face model hub
model_repo = "meetkai/functionary-small-v2.2-GGUF"
model_repo = f"meetkai/{model}-GGUF"

# File to download
file_name = "functionary-small-v2.2.f16.gguf"
if model == "functionary-medium-v2.2":
# TODO: Ask about f16 for medium model
file_name = "functionary-medium-v2.2.q8_0.gguf"
else:
# File to download
file_name = "functionary-small-v2.2.f16.gguf"

# Download the file
local_file_path = hf_hub_download(repo_id=model_repo, filename=file_name)
Expand Down Expand Up @@ -79,7 +82,16 @@ async def create(


async def main():
functionary = FunctionaryAPI()
import sys

# Check for command line arguments for model size
model_size = "functionary-small-v2.2"
if "--small" in sys.argv:
model_size = "functionary-small-v2.2"
elif "--medium" in sys.argv:
model_size = "functionary-medium-v2.2"

functionary = FunctionaryAPI(model=model_size)

# Provide some space after the llama_cpp logs
print("\n\n")
Expand Down