Edit model card

cyfieithydd-7b-fersiwn-3

Cyfieithydd 7b Fersiwn 3

Model cyfieithu arbrofol sy'n defnyddio LLM Trawsnewidiol.

Mae'r model LLM yn seiliedig ar BangorAI/mistral-7b-cy-epoch-2, sef y model Mistral-7B wedi hyfforddiant parhaus ar gyfer y Gymraeg.

Cafodd y model hyfforddiant cywrain pellach ar y cyfeithiadau canlynol:

Demo

Gallwch roi gynnig ar esiampl o'r model yma: https://demo.bangor.ai/
(cofiwch ddewis yr opsiwn "Trosi En -> Cy")

Fformat Sgwrs

Mae'r hyfforddiant cywrain wedi defnyddio'r fformat canlynol ar gyfer trosi o'r Saesneg i'r Gymraeg:

Cyfieithwch y testun Saesneg canlynol i'r Gymraeg.
### Saesneg:
{prompt}

### Cymraeg:

a'r naill ffordd i'r llall:

Translate the following Welsh text to English.
### Welsh:
{prompt}

### English:

Sut i'w ddefnyddio

Mae'r model Mistral-7B-v-0.1 sy'n tanseilio'r model yma yn defnyddio ffenestr cyd-destun maint 4k, felly mae'n ofyniad i becynnu'r testyn fesul paragraff a'u bwydo i mewn i'r LLM yn eu tro.

Dyma enghraifft mewn Python:

import transformers

device="cuda"
model_name = 'BangorAI/cyfieithydd-7b-fersiwn-3'
model = transformers.AutoModelForCausalLM.from_pretrained(model_name, load_in_8bit=True)
tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)

def generate_response(text):
    # Format the input using the provided template
    prompt = f"Cyfieithwch y testun Saesneg canlynol i'r Gymraeg.\n\n### Saesneg:\n{text}\n\n### Cymraeg:\n"
    # Tokenize and encode the prompt
    inputs = tokenizer.encode(prompt, return_tensors="pt", add_special_tokens=False).to(device)
    # Generate a response
    outputs = model.generate(inputs, max_length=1000, num_return_sequences=1, do_sample=True, temperature=0.01)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return response

text="""The extension of the Flying Start programme is part of a phased expansion of early years provision to all two-year-olds in Wales, with a particular emphasis on strengthening Welsh-medium provision. This is a commitment in the Co-operation Agreement between the Welsh Government and Plaid Cymru."""
response = generate_response(text)
print(response)

Hawlfraint

Mae'r data Cofnod y Cynulliad ac Hysbysiadau Llywodreath Cymru dan Drwydded Llywodraeth Agored.

Downloads last month
8
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Datasets used to train BangorAI/cyfieithydd-7b-fersiwn-3