Instructions to use katanemo/Arch-Agent-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use katanemo/Arch-Agent-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="katanemo/Arch-Agent-3B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("katanemo/Arch-Agent-3B") model = AutoModelForCausalLM.from_pretrained("katanemo/Arch-Agent-3B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use katanemo/Arch-Agent-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "katanemo/Arch-Agent-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "katanemo/Arch-Agent-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/katanemo/Arch-Agent-3B
- SGLang
How to use katanemo/Arch-Agent-3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "katanemo/Arch-Agent-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "katanemo/Arch-Agent-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "katanemo/Arch-Agent-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "katanemo/Arch-Agent-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use katanemo/Arch-Agent-3B with Docker Model Runner:
docker model run hf.co/katanemo/Arch-Agent-3B
Update README.md
Browse files
README.md
CHANGED
|
@@ -50,7 +50,6 @@ import json
|
|
| 50 |
from typing import Any, Dict, List
|
| 51 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 52 |
|
| 53 |
-
# Specify the desired model name here
|
| 54 |
model_name = "katanemo/Arch-Agent-3B"
|
| 55 |
|
| 56 |
model = AutoModelForCausalLM.from_pretrained(
|
|
@@ -58,8 +57,6 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 58 |
)
|
| 59 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 60 |
|
| 61 |
-
|
| 62 |
-
# Please use the recommended prompt for each model.
|
| 63 |
TASK_PROMPT = (
|
| 64 |
"You are a helpful assistant designed to assist with the user query by making one or more function calls if needed."
|
| 65 |
"\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\n"
|
|
@@ -95,7 +92,6 @@ tools = [
|
|
| 95 |
}
|
| 96 |
]
|
| 97 |
|
| 98 |
-
|
| 99 |
# Helper function to create the system prompt for our model
|
| 100 |
def format_prompt(tools: List[Dict[str, Any]]):
|
| 101 |
tool_text = "\n".join(
|
|
@@ -103,7 +99,6 @@ def format_prompt(tools: List[Dict[str, Any]]):
|
|
| 103 |
)
|
| 104 |
return TASK_PROMPT.format(tool_text=tool_text)
|
| 105 |
|
| 106 |
-
|
| 107 |
system_prompt = format_prompt(tools)
|
| 108 |
|
| 109 |
messages = [
|
|
@@ -111,7 +106,6 @@ messages = [
|
|
| 111 |
{"role": "user", "content": "What is the weather in Seattle?"},
|
| 112 |
]
|
| 113 |
|
| 114 |
-
#### 2.2.3 Run inference
|
| 115 |
model_inputs = tokenizer.apply_chat_template(
|
| 116 |
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
|
| 117 |
).to(model.device)
|
|
|
|
| 50 |
from typing import Any, Dict, List
|
| 51 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 52 |
|
|
|
|
| 53 |
model_name = "katanemo/Arch-Agent-3B"
|
| 54 |
|
| 55 |
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
| 57 |
)
|
| 58 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 59 |
|
|
|
|
|
|
|
| 60 |
TASK_PROMPT = (
|
| 61 |
"You are a helpful assistant designed to assist with the user query by making one or more function calls if needed."
|
| 62 |
"\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\n"
|
|
|
|
| 92 |
}
|
| 93 |
]
|
| 94 |
|
|
|
|
| 95 |
# Helper function to create the system prompt for our model
|
| 96 |
def format_prompt(tools: List[Dict[str, Any]]):
|
| 97 |
tool_text = "\n".join(
|
|
|
|
| 99 |
)
|
| 100 |
return TASK_PROMPT.format(tool_text=tool_text)
|
| 101 |
|
|
|
|
| 102 |
system_prompt = format_prompt(tools)
|
| 103 |
|
| 104 |
messages = [
|
|
|
|
| 106 |
{"role": "user", "content": "What is the weather in Seattle?"},
|
| 107 |
]
|
| 108 |
|
|
|
|
| 109 |
model_inputs = tokenizer.apply_chat_template(
|
| 110 |
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
|
| 111 |
).to(model.device)
|