Instructions to use katanemo/Arch-Agent-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use katanemo/Arch-Agent-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="katanemo/Arch-Agent-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("katanemo/Arch-Agent-7B") model = AutoModelForMultimodalLM.from_pretrained("katanemo/Arch-Agent-7B") 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-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "katanemo/Arch-Agent-7B" # 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-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/katanemo/Arch-Agent-7B
- SGLang
How to use katanemo/Arch-Agent-7B 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-7B" \ --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-7B", "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-7B" \ --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-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use katanemo/Arch-Agent-7B with Docker Model Runner:
docker model run hf.co/katanemo/Arch-Agent-7B
Update README.md
Browse files
README.md
CHANGED
|
@@ -49,7 +49,6 @@ import json
|
|
| 49 |
from typing import Any, Dict, List
|
| 50 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 51 |
|
| 52 |
-
# Specify the desired model name here
|
| 53 |
model_name = "katanemo/Arch-Agent-7B"
|
| 54 |
|
| 55 |
model = AutoModelForCausalLM.from_pretrained(
|
|
@@ -57,8 +56,6 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 57 |
)
|
| 58 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 59 |
|
| 60 |
-
|
| 61 |
-
# Please use the recommended prompt for each model.
|
| 62 |
TASK_PROMPT = (
|
| 63 |
"You are a helpful assistant designed to assist with the user query by making one or more function calls if needed."
|
| 64 |
"\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\n"
|
|
@@ -94,7 +91,6 @@ tools = [
|
|
| 94 |
}
|
| 95 |
]
|
| 96 |
|
| 97 |
-
|
| 98 |
# Helper function to create the system prompt for our model
|
| 99 |
def format_prompt(tools: List[Dict[str, Any]]):
|
| 100 |
tool_text = "\n".join(
|
|
@@ -102,7 +98,6 @@ def format_prompt(tools: List[Dict[str, Any]]):
|
|
| 102 |
)
|
| 103 |
return TASK_PROMPT.format(tool_text=tool_text)
|
| 104 |
|
| 105 |
-
|
| 106 |
system_prompt = format_prompt(tools)
|
| 107 |
|
| 108 |
messages = [
|
|
@@ -110,7 +105,6 @@ messages = [
|
|
| 110 |
{"role": "user", "content": "What is the weather in Seattle?"},
|
| 111 |
]
|
| 112 |
|
| 113 |
-
#### 2.2.3 Run inference
|
| 114 |
model_inputs = tokenizer.apply_chat_template(
|
| 115 |
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
|
| 116 |
).to(model.device)
|
|
|
|
| 49 |
from typing import Any, Dict, List
|
| 50 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 51 |
|
|
|
|
| 52 |
model_name = "katanemo/Arch-Agent-7B"
|
| 53 |
|
| 54 |
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
| 56 |
)
|
| 57 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 58 |
|
|
|
|
|
|
|
| 59 |
TASK_PROMPT = (
|
| 60 |
"You are a helpful assistant designed to assist with the user query by making one or more function calls if needed."
|
| 61 |
"\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\n"
|
|
|
|
| 91 |
}
|
| 92 |
]
|
| 93 |
|
|
|
|
| 94 |
# Helper function to create the system prompt for our model
|
| 95 |
def format_prompt(tools: List[Dict[str, Any]]):
|
| 96 |
tool_text = "\n".join(
|
|
|
|
| 98 |
)
|
| 99 |
return TASK_PROMPT.format(tool_text=tool_text)
|
| 100 |
|
|
|
|
| 101 |
system_prompt = format_prompt(tools)
|
| 102 |
|
| 103 |
messages = [
|
|
|
|
| 105 |
{"role": "user", "content": "What is the weather in Seattle?"},
|
| 106 |
]
|
| 107 |
|
|
|
|
| 108 |
model_inputs = tokenizer.apply_chat_template(
|
| 109 |
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
|
| 110 |
).to(model.device)
|