---
title: llama3-8b-agent-instruct-v2
canonical_url: "https://www.modelscope.cn/models/swift/llama3-8b-agent-instruct-v2"
md_url: "https://www.modelscope.cn/models/swift/llama3-8b-agent-instruct-v2.md"
repository: swift/llama3-8b-agent-instruct-v2
chinese_name: "llama3-8b-智能体Agent模型V2版本"
last_updated: 2024-06-13
license: "Apache License 2.0"
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - llama
architectures:
  - LlamaForCausalLM
parameters: 8.0B
tensor_type:
  - BF16
library_name:
  - safetensors
  - pytorch
frameworks:
  - Pytorch
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy 0.9.1"
  - "lmdeploy_turbomind 0.9.1"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 287
stars: 1
---

# llama3-8b-agent-instruct-v2

> llama3-8b-agent-instruct-v2 - swift 在 ModelScope 开源的模型。Fine-tuning the llama3-8b-instruct model using the msagent-pro dataset and the lossscale technique with swift, the script is as follows:

swift/llama3-8b-agent-instruct-v2 是 ModelScope 魔搭社区上的 8.0B 参数text-generation模型，采用 Apache License 2.0 许可，可用 deploy_task text/emb、lmdeploy 0.9.1、lmdeploy_turbomind 0.9.1 部署。

- **Repository**: swift/llama3-8b-agent-instruct-v2
- **License**: Apache License 2.0
- **Tasks**: text-generation
- **Parameters**: 8.0B
- **Inference backends**: deploy_task text/emb, lmdeploy 0.9.1, lmdeploy_turbomind 0.9.1, sglang 0.5.2, vllm 0.9.2
- **Downloads**: 287
- **Stars**: 1
- **Last updated**: 2024-06-13

Source: https://www.modelscope.cn/models/swift/llama3-8b-agent-instruct-v2

---

Fine-tuning the llama3-8b-instruct model using the [msagent-pro](https://modelscope.cn/datasets/iic/MSAgent-Pro/summary) dataset and the loss_scale technique with [swift](https://github.com/modelscope/swift), the script is as follows:
```bash
NPROC_PER_NODE=8 \
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 \
MASTER_PORT=29500 \
swift sft \
    --model_type llama3-8b-instruct \
    --learning_rate 2e-5 \
    --sft_type lora \
    --dataset msagent-pro \
    --gradient_checkpointing true \
    --gradient_accumulation_steps 8 \
    --deepspeed default-zero3 \
    --lora_target_modules ALL \
    --use_loss_scale true \
    --save_strategy epoch \
    --batch_size 1 \
    --num_train_epochs 2 \
    --max_length 4096 \
    --preprocess_num_proc 4 \
    --use_loss_scale true \
    --loss_scale_config_path agent-flan \
    --ddp_backend nccl \
```

Comparison with the Original Model on the ToolBench Evaluation Set

| Model                   | ToolBench (in-domain)                        |       |       |       |       | ToolBench (out-of-domain)                  |       |       |       |
|-------------------------|----------------------------------------------|-------|-------|-------|-------|--------------------------------------------|-------|-------|-------|
|                         | Plan.EM                                      | Act.EM| HalluRate (lower is better) | Avg.F1 | R-L   | Plan.EM                                   | Act.EM| HalluRate (lower is better) | Avg.F1 | R-L   |
| llama3-8b-instruct      | 74.22                                        | 36.17 | 15.68                     | 20.0  | 12.14 | 69.47                                     | 34.21 | 14.72                  | 20.25  | 14.07 |
| llama3-8b-agent-instruct-v2   | **85.15**                                        | **58.1** | **1.57**                     | **52.10** | **26.02** | **85.79**                                     | **59.43** | **2.56**                  | **52.19**  | **31.43** |

For detailed explanations of the evaluation metrics, please refer to [document](https://github.com/modelscope/eval-scope/tree/main/llmuses/third_party/toolbench_static)

#### 您可以通过如下git clone命令，或者ModelScope SDK来下载模型

SDK下载
```bash
#安装ModelScope
pip install modelscope
```
```python
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('swift/llama3-8b-agent-instruct-v2')
```
Git下载
```
#Git模型下载
git clone https://www.modelscope.cn/swift/llama3-8b-agent-instruct-v2.git
```

<p style="color: lightgrey;">如果您是本模型的贡献者，我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>，及时完善模型卡片内容。</p>
