Instructions to use tartuNLP/Llama-SMUGRI-7B-Instruct-MTI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tartuNLP/Llama-SMUGRI-7B-Instruct-MTI with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tartuNLP/Llama-SMUGRI-7B-Instruct-MTI", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tartuNLP/Llama-SMUGRI-7B-Instruct-MTI") model = AutoModelForCausalLM.from_pretrained("tartuNLP/Llama-SMUGRI-7B-Instruct-MTI", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tartuNLP/Llama-SMUGRI-7B-Instruct-MTI with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tartuNLP/Llama-SMUGRI-7B-Instruct-MTI" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tartuNLP/Llama-SMUGRI-7B-Instruct-MTI", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tartuNLP/Llama-SMUGRI-7B-Instruct-MTI
- SGLang
How to use tartuNLP/Llama-SMUGRI-7B-Instruct-MTI 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 "tartuNLP/Llama-SMUGRI-7B-Instruct-MTI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tartuNLP/Llama-SMUGRI-7B-Instruct-MTI", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "tartuNLP/Llama-SMUGRI-7B-Instruct-MTI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tartuNLP/Llama-SMUGRI-7B-Instruct-MTI", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tartuNLP/Llama-SMUGRI-7B-Instruct-MTI with Docker Model Runner:
docker model run hf.co/tartuNLP/Llama-SMUGRI-7B-Instruct-MTI
Llama-SMUGRI-7B-Instruct-MTI
An instruction-tuned version of tartuNLP/Llama-SMUGRI-7B base model continually pre-trained from meta-llama/Llama-2-7b-hf to support Võro, Komi, and Livonian. The model additionally supports English, Estonian, Finnish, and Russian, however those languages were not the focus.
The instruction-tuning dataset consists of supporting instructions in Estonian, Finnish, English, and Russian, and Alpaca-style instructions translated into Võro, Livonian, and Komi with Neurotõlge. See our paper for more details (model referenced as Llama-SMUGRI-Instruct SupInst+TrAlpaca).
Usage
We trained and evaluated our model with transformers==4.36.2.
Example usage:
from transformers import pipeline
import torch
pipe = pipeline("text-generation", model="tartuNLP/Llama-SMUGRI-7B-Instruct-MTI", torch_dtype=torch.bfloat16, device_map="auto")
messages = [
{"role": "user", "content": "Kolm nõvvo, et terveq püssüq."},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.6, top_k=50, top_p=0.9)
print(outputs[0]["generated_text"][len(prompt):])
Citation
@misc{purason2024llmsextremelylowresourcefinnougric,
title={LLMs for Extremely Low-Resource Finno-Ugric Languages},
author={Taido Purason and Hele-Andra Kuulmets and Mark Fishel},
year={2024},
eprint={2410.18902},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2410.18902},
}
- Downloads last month
- 2