---
title: HuatuoGPT2-7B
canonical_url: "https://www.modelscope.cn/models/FreedomIntelligence/HuatuoGPT2-7B"
md_url: "https://www.modelscope.cn/models/FreedomIntelligence/HuatuoGPT2-7B.md"
repository: FreedomIntelligence/HuatuoGPT2-7B
last_updated: 2024-12-31
license: apache-2.0
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - baichuan
architectures:
  - BaichuanForCausalLM
library_name:
  - pytorch
  - transformer
frameworks:
  - pytorch
language:
  - zh
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy 0.9.1"
  - "lmdeploy_turbomind 0.9.1"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 1495
stars: 1
---

# HuatuoGPT2-7B

> HuatuoGPT2-7B - FreedomIntelligence 在 ModelScope 开源的模型。

FreedomIntelligence/HuatuoGPT2-7B 是 ModelScope 魔搭社区上的text-generation模型，采用 apache-2.0 许可，可用 deploy_task text/emb、lmdeploy 0.9.1、lmdeploy_turbomind 0.9.1 部署。

- **Repository**: FreedomIntelligence/HuatuoGPT2-7B
- **License**: apache-2.0
- **Tasks**: text-generation
- **Inference backends**: deploy_task text/emb, lmdeploy 0.9.1, lmdeploy_turbomind 0.9.1, sglang 0.5.2, vllm 0.9.2
- **Downloads**: 1495
- **Stars**: 1
- **Last updated**: 2024-12-31

Source: https://www.modelscope.cn/models/FreedomIntelligence/HuatuoGPT2-7B

---

<!-- markdownlint-disable first-line-h1 -->
<!-- markdownlint-disable html -->
<div align="center">
<h1>
  HuatuoGPT2-7B
</h1>
</div>

<div align="center">
<a href="https://github.com/FreedomIntelligence/HuatuoGPT-II" target="_blank">GitHub</a> | <a href="https://arxiv.org/pdf/2311.09774.pdf" target="_blank">Our Paper</a>
</div>

# <span id="Start">Quick Start</span>

```Python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation.utils import GenerationConfig
tokenizer = AutoTokenizer.from_pretrained("FreedomIntelligence/HuatuoGPT2-7B", use_fast=True, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("FreedomIntelligence/HuatuoGPT2-7B", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
model.generation_config = GenerationConfig.from_pretrained("FreedomIntelligence/HuatuoGPT2-7B")
messages = []
messages.append({"role": "user", "content": "肚子疼怎么办？"})
response = model.HuatuoChat(tokenizer, messages)
print(response)
```
