Instructions to use BangorAI/ALMA-Cymraeg-13B-0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BangorAI/ALMA-Cymraeg-13B-0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BangorAI/ALMA-Cymraeg-13B-0.1")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BangorAI/ALMA-Cymraeg-13B-0.1") model = AutoModelForCausalLM.from_pretrained("BangorAI/ALMA-Cymraeg-13B-0.1") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use BangorAI/ALMA-Cymraeg-13B-0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BangorAI/ALMA-Cymraeg-13B-0.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/ALMA-Cymraeg-13B-0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/BangorAI/ALMA-Cymraeg-13B-0.1
- SGLang
How to use BangorAI/ALMA-Cymraeg-13B-0.1 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 "BangorAI/ALMA-Cymraeg-13B-0.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/ALMA-Cymraeg-13B-0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "BangorAI/ALMA-Cymraeg-13B-0.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/ALMA-Cymraeg-13B-0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use BangorAI/ALMA-Cymraeg-13B-0.1 with Docker Model Runner:
docker model run hf.co/BangorAI/ALMA-Cymraeg-13B-0.1
ALMA-Cymraeg-13B
Fersiwn Gymraeg o fodel cyfieithu ALMA a ddisgrifir yn https://arxiv.org/abs/2309.11674.
This is a Welsh version of the ALMA LLM-based translation model.
Mae'r model LLM yn seiliedig ar Lama-2-13B, gyda hyfforddiant parhaus ar ddata Gymreig OSCAR-2301 am 3 Epoch ac yna hyfforddiant cywrain pellach ar ddata Cofnod y Cynulliad a ddarparir gan TechIaith.
Mae fersiwn cyflymach sydd wedi ei gywasgu i 4.0bpw er mwyn llwytho mewn cof GPU o 10GB ar gael yma.
Fformat Sgwrs
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:
Esiampl
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"
model = AutoModelForCausalLM.from_pretrained("BangorAI/ALMA-Cymraeg-13B-0.1", torch_dtype=torch.float16, load_in_8bit=True)
tokenizer = AutoTokenizer.from_pretrained("BangorAI/ALMA-Cymraeg-13B-0.1")
prompt = """Cyfieithwch y testun Saesneg canlynol i'r Gymraeg.
### Saesneg:
For the first time, GPs no longer have to physically print, sign and hand a green paper prescription form to the patient or wait for it to be taken to the pharmacy. Instead, the prescription is sent electronically from the surgery via the IT system to the patient’s chosen pharmacy - even without the patient needing to visit the surgery to pick up a repeat prescription form.
### Cymraeg:
"""
model_inputs = tokenizer([prompt], return_tensors="pt").to(device)
generated_ids = model.generate(**model_inputs,
eos_token_id=tokenizer.eos_token_id,
top_k=90,
top_p=1.0,
temperature=0.3,
repetition_penalty=1.2,
max_new_tokens=500,
do_sample=True)
print(tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0])
Hawlfraint
Mae'r model yn seiliedig ar Llama2 ac felly dan drwydded gan Meta.
Mae'r data Cofnod y Cynulliad dan drywdded Llywodraeth Agored.
- Downloads last month
- 3