Improve model card: Add pipeline tag, license, and sample usage
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
|
@@ -1,17 +1,57 @@
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
| 3 |
-
library_name:
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Model Summary
|
| 7 |
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
| 11 |
|
| 12 |
-
-
|
| 13 |
-
-
|
|
|
|
| 14 |
|
| 15 |
### Framework versions
|
| 16 |
|
| 17 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
| 3 |
+
library_name: transformers
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
---
|
| 7 |
|
| 8 |
# Model Summary
|
| 9 |
|
| 10 |
+
This model, `agent-distillation/agent_distilled_Qwen2.5-1.5B-Instruct`, is a distilled version of `Qwen2.5-1.5B-Instruct`. It has been trained on agent trajectories derived from the [agent-distillation/Qwen2.5-32B-Instruct_agent_trajectories_2k dataset](https://huggingface.co/datasets/agent-distillation/Qwen2.5-32B-Instruct_agent_trajectories_2k).
|
| 11 |
|
| 12 |
+
The model was presented in the paper [Distilling LLM Agent into Small Models with Retrieval and Code Tools](https://arxiv.org/abs/2505.17612). It focuses on transferring complex reasoning and full task-solving behavior from LLM-based agents into smaller language models (sLMs) by integrating retrieval and code execution capabilities. The method employs techniques like "first-thought prefix" for enhanced teacher-generated trajectories and "self-consistent action generation" for improved robustness in small agents.
|
| 13 |
|
| 14 |
+
- **Repository**: https://github.com/Nardien/agent-distillation
|
| 15 |
+
- **Paper**: [Distilling LLM Agent into Small Models with Retrieval and Code Tools](https://arxiv.org/abs/2505.17612)
|
| 16 |
+
- **Project Page/Related Models**: Explore other models and datasets from this project on the [agent-distillation Hugging Face organization page](https://huggingface.co/agent-distillation).
|
| 17 |
|
| 18 |
### Framework versions
|
| 19 |
|
| 20 |
+
- PEFT 0.15.1
|
| 21 |
+
- Transformers
|
| 22 |
+
|
| 23 |
+
## Sample Usage
|
| 24 |
+
|
| 25 |
+
You can quickly try out the distilled 1.5B agent from the Hugging Face Hub using the `smolagents` library, which is introduced in the project's GitHub repository. The `smolagents` library itself builds upon the Hugging Face `transformers` library.
|
| 26 |
+
|
| 27 |
+
First, ensure `smolagents` and its dependencies are installed as per the [GitHub repository's instructions](https://github.com/Nardien/agent-distillation#installation).
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
from smolagents import LlmAgent
|
| 31 |
+
import os
|
| 32 |
+
|
| 33 |
+
# Initialize the agent
|
| 34 |
+
# The smolagents library builds upon the Hugging Face Transformers library.
|
| 35 |
+
# This model is a PEFT adapter for Qwen2.5-1.5B-Instruct.
|
| 36 |
+
# If you encounter issues with authentication or rate limits, ensure you are logged in
|
| 37 |
+
# or replace "YOUR_HF_TOKEN" with your actual Hugging Face token.
|
| 38 |
+
# You can set it as an environment variable or pass it directly.
|
| 39 |
+
# For example: HUGGING_FACE_HUB_TOKEN="hf_..." python your_script.py
|
| 40 |
+
# Or: agent = LlmAgent.from_pretrained("agent-distillation/agent_distilled_Qwen2.5-1.5B-Instruct", token=os.environ.get("HUGGING_FACE_HUB_TOKEN"))
|
| 41 |
+
agent = LlmAgent.from_pretrained(
|
| 42 |
+
"agent-distillation/agent_distilled_Qwen2.5-1.5B-Instruct",
|
| 43 |
+
# Additional arguments like `device_map="auto"` or `trust_remote_code=True`
|
| 44 |
+
# can be passed here if required by the underlying transformers model loading.
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
# Chat loop
|
| 48 |
+
print("Agent initialized. Type 'exit' to quit.")
|
| 49 |
+
while True:
|
| 50 |
+
user_input = input("You: ")
|
| 51 |
+
if user_input.lower() == 'exit':
|
| 52 |
+
break
|
| 53 |
+
# The agent will use its configured tools (e.g., retrieval, code execution)
|
| 54 |
+
# as needed to respond to the query.
|
| 55 |
+
response = agent.chat(user_input)
|
| 56 |
+
print(f"Agent: {response.text}")
|
| 57 |
+
```
|