uonlp/CulturaX
Viewer • Updated • 7.18B • 14.3k • 664
How to use tartuNLP/Llama-2-7b-Ukrainian with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="tartuNLP/Llama-2-7b-Ukrainian") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("tartuNLP/Llama-2-7b-Ukrainian")
model = AutoModelForCausalLM.from_pretrained("tartuNLP/Llama-2-7b-Ukrainian", device_map="auto")How to use tartuNLP/Llama-2-7b-Ukrainian with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tartuNLP/Llama-2-7b-Ukrainian"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tartuNLP/Llama-2-7b-Ukrainian",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/tartuNLP/Llama-2-7b-Ukrainian
How to use tartuNLP/Llama-2-7b-Ukrainian with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tartuNLP/Llama-2-7b-Ukrainian" \
--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": "tartuNLP/Llama-2-7b-Ukrainian",
"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 "tartuNLP/Llama-2-7b-Ukrainian" \
--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": "tartuNLP/Llama-2-7b-Ukrainian",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use tartuNLP/Llama-2-7b-Ukrainian with Docker Model Runner:
docker model run hf.co/tartuNLP/Llama-2-7b-Ukrainian
Llama-2-7b-Ukrainian is a bilingual pre-trained model supporting Ukrainian and English. Continued pre-training from Llama-2-7b on 5B tokens consisting of 75% Ukrainian documents and 25% English documents from CulturaX.
Paper: To Err Is Human, but Llamas Can Learn It Too
| Hyperparameter | Value |
|---|---|
| Training steps | 19080 |
| Batch size | 256 |
| Weight decay | 0.1 |
| Context length | 1024 |
| Learning rate | 2e-5 linear decay to 2e-6 |
| Precision | bf16 |
| Optimizer | AdamW |
BibTeX:
@article{luhtaru2024err,
title={To Err Is Human, but Llamas Can Learn It Too},
author={Luhtaru, Agnes and Purason, Taido and Vainikko, Martin and Del, Maksym and Fishel, Mark},
journal={arXiv preprint arXiv:2403.05493},
year={2024}
}
Base model
meta-llama/Llama-2-7b-hf