techiaith/cofnodycynulliad_en-cy
Viewer • Updated • 105k • 74 • 2
How to use BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1")
model = AutoModelForCausalLM.from_pretrained("BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1")How to use BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1
How to use BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1" \
--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": "BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1",
"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 "BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1" \
--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": "BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1 with Docker Model Runner:
docker model run hf.co/BangorAI/Cyfieithu-Mistral-7b-tocynnydd-1
Mae'r model LLM yn seiliedig ar BangorAI/mistral-7b-cy-tokenizer-train-6, sef y model Mistral-7B, gyda estyniad yn y tocynnydd ac hyfforddiant parhaus ar gyfer y Gymraeg.
Cafodd y model hyfforddiant cywrain pellach ar ddata Cofnod y Cynulliad a ddarparir gan TechIaith.
Mae'r hyfforddiant cywrain wedi defnyddio'r fformat canlynol ar gyfer trosi o'r Saesneg i'r Gymraeg (a'r naill ffordd i'r llall).
Cyfieithwch y testun Saesneg canlynol i'r Gymraeg.
### Saesneg:
{prompt}
### Cymraeg:
Mae'r data Cofnod y Cynulliad dan drywdded Llywodraeth Agored.