LLaMA: Open and Efficient Foundation Language Models
Paper • 2302.13971 • Published • 24
How to use xzyao/openllama-3b-chat with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="xzyao/openllama-3b-chat") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("xzyao/openllama-3b-chat")
model = AutoModelForCausalLM.from_pretrained("xzyao/openllama-3b-chat")How to use xzyao/openllama-3b-chat with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "xzyao/openllama-3b-chat"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "xzyao/openllama-3b-chat",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/xzyao/openllama-3b-chat
How to use xzyao/openllama-3b-chat with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "xzyao/openllama-3b-chat" \
--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": "xzyao/openllama-3b-chat",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "xzyao/openllama-3b-chat" \
--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": "xzyao/openllama-3b-chat",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use xzyao/openllama-3b-chat with Docker Model Runner:
docker model run hf.co/xzyao/openllama-3b-chat
<human>: Who is Alan Turing?<|endoftext|><assistant>:
If you found OpenLLaMA useful in your research or applications, please cite using the following BibTeX:
@software{Yao_FMEngine_Library_for_2023,
author = {Yao, Xiaozhe},
doi = {10.5281/zenodo.8314779},
month = sep,
title = {{FMEngine: Library for Training Foundation Models}},
url = {https://github.com/eth-easl/fmengine},
version = {0.0.1},
year = {2023}
}
@software{openlm2023openllama,
author = {Geng, Xinyang and Liu, Hao},
title = {OpenLLaMA: An Open Reproduction of LLaMA},
month = May,
year = 2023,
url = {https://github.com/openlm-research/open_llama}
}
@software{together2023redpajama,
author = {Together Computer},
title = {RedPajama-Data: An Open Source Recipe to Reproduce LLaMA training dataset},
month = April,
year = 2023,
url = {https://github.com/togethercomputer/RedPajama-Data}
}
@article{touvron2023llama,
title={Llama: Open and efficient foundation language models},
author={Touvron, Hugo and Lavril, Thibaut and Izacard, Gautier and Martinet, Xavier and Lachaux, Marie-Anne and Lacroix, Timoth{\'e}e and Rozi{\`e}re, Baptiste and Goyal, Naman and Hambro, Eric and Azhar, Faisal and others},
journal={arXiv preprint arXiv:2302.13971},
year={2023}
}
As with all language models, openllama-3b-chat may generate incorrect or biased content. It's important to keep this in mind when using the model.