Revealing the Barriers of Language Agents in Planning
Paper • 2410.12409 • Published • 27
How to use hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT")
model = AutoModelForCausalLM.from_pretrained("hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT", 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]:]))How to use hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT
How to use hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT" \
--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": "hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT" \
--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": "hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT with Docker Model Runner:
docker model run hf.co/hsaest/Llama-3.1-8B-Instruct-travelplanner-SFT
| Commonsense (Micro) | Commonsense (Macro) | Hard (Micro) | Hard (Macro) | Final Pass Rate | |
|---|---|---|---|---|---|
| Direct Prompting | |||||
| Llama3.1-8B | 60.1 | 0.0 | 7.9 | 2.8 | 0.0 |
| Qwen2-7B | 49.9 | 1.1 | 2.1 | 0.0 | 0.0 |
| Fine-tuning | |||||
| Llama3.1-8B | 78.3 | 17.8 | 19.3 | 6.1 | 3.8 |
| Qwen2-7B | 59.0 | 0.6 | 0.2 | 0.0 | 0.0 |
If our related resources prove valuable to your research, we kindly ask for a citation.
@article{xie2024revealing,
title={Revealing the Barriers of Language Agents in Planning},
author={Xie, Jian and Zhang, Kexun and Chen, Jiangjie and Yuan, Siyu and Zhang, Kai and Zhang, Yikai and Li, Lei and Xiao, Yanghua},
journal={arXiv preprint arXiv:2410.12409},
year={2024}
}