legacy-datasets/mc4
Updated • 2.38k • 153
How to use rasyosef/Llama-3.2-400M-Amharic with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="rasyosef/Llama-3.2-400M-Amharic") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("rasyosef/Llama-3.2-400M-Amharic")
model = AutoModelForCausalLM.from_pretrained("rasyosef/Llama-3.2-400M-Amharic", device_map="auto")How to use rasyosef/Llama-3.2-400M-Amharic with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "rasyosef/Llama-3.2-400M-Amharic"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "rasyosef/Llama-3.2-400M-Amharic",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/rasyosef/Llama-3.2-400M-Amharic
How to use rasyosef/Llama-3.2-400M-Amharic with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "rasyosef/Llama-3.2-400M-Amharic" \
--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": "rasyosef/Llama-3.2-400M-Amharic",
"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 "rasyosef/Llama-3.2-400M-Amharic" \
--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": "rasyosef/Llama-3.2-400M-Amharic",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use rasyosef/Llama-3.2-400M-Amharic with Docker Model Runner:
docker model run hf.co/rasyosef/Llama-3.2-400M-Amharic
This is a smaller version of the Meta's Llama-3.2-1B decoder transformer model pretrained from scratch for 23 hours using a single A100 40GB GPU and 274 million tokens of Amharic text.
First, you need to install the latest version of transformers
pip install -Uq transformers
You can use this model directly with a pipeline for text generation:
from transformers import pipeline
llama_am = pipeline(
"text-generation",
model="rasyosef/Llama-3.2-400M-Amharic",
device_map="auto"
)
prompt = "አዲስ አበባ"
llama_am(
prompt,
max_new_tokens=128,
temperature=0.5,
do_sample=True,
top_k=8,
top_p=0.8,
repetition_penalty=1.2
)
Output:
[{'generated_text': 'አዲስ አበባ፣ ታህሳስ 8 ፣2012 (ኤፍ ቢ ሲ) የኢፌዴሪ የውጭ ጉዳይ ሚኒስትር አቶ ገዱ አንዳርጋቸው ከአፍሪካ ህብረት የስራ አስፈጻሚዎች ምክር ቤት መደበኛ ስብሰባ ጎን ለጎን ከዴሞክራቲክ ሪፐብሊክ ኮንጎ አቻቸው ማሪ ቱምባ ንዜዛ እና ከሌሎች የአፍሪካ አምባሳደሮች ጋር ተወያይተዋል።በውይይታቸውም በአፍሪካ የኮሮና ቫይረስን ለመከላከል እየተከናወኑ ባሉ ስራዎች ዙሪያ መምከራቸውን በትዊተር ገጻቸው አስፍረዋል።የሁለቱን ሀገራት ግንኙነት በተመለከተም፥ ኢትዮጵያ በህብረቱ ቋሚ አምባሳደርነት ባላት ሀላፊነት ለሹመት ማቅረብዋ የሚደነቅ መሆኑንም አንስተዋል።ኢትዮጵያ የኮቪድ19 ወረርሽኝን ለመግታት እያደረገች ባለው ጥረት ለደቡብ አፍሪካ ምስጋና አቅርባም ነበር፤ ቫይረሱን ለመቆጣጠር ከኢትዮጵያ ምን እንደምትማር በዝርዝር ላቀረብንላቸው ጥያቄም ወደፊት በሚሰሩ የትብብር መስኮች ላይ ተነጋግረን መስራት እንፈልጋለን ብለዋል።በቀጣይም ሁለቱ'}]