Instructions to use qhduan/aquila-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use qhduan/aquila-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="qhduan/aquila-7b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("qhduan/aquila-7b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("qhduan/aquila-7b", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use qhduan/aquila-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "qhduan/aquila-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qhduan/aquila-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/qhduan/aquila-7b
- SGLang
How to use qhduan/aquila-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 "qhduan/aquila-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qhduan/aquila-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "qhduan/aquila-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qhduan/aquila-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use qhduan/aquila-7b with Docker Model Runner:
docker model run hf.co/qhduan/aquila-7b
https://github.com/FlagAI-Open/FlagAI/tree/master/examples/Aquila
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained('qhduan/aquila-7b')
model = AutoModelForCausalLM.from_pretrained('qhduan/aquila-7b', trust_remote_code=True)
model = model.eval().half().cuda()
prompt = '北京在哪儿?'
with torch.no_grad():
ret = model.generate(
**tokenizer(prompt, return_tensors='pt').to('cuda'),
do_sample=False,
max_new_tokens=200,
use_cache=True
)
# 北京在哪儿? 北京是中国的首都,是中华人民共和国的首都,是全国政治、经济、文化、交通中心,是世界著名古都和现代化国际城市
print(tokenizer.decode(ret[0]))
Aquila-7B和Aquila-33B开源模型使用 智源Aquila系列模型许可协议, 原始代码基于Apache Licence 2.0。
- Downloads last month
- 304