Edit model card
YAML Metadata Warning: The pipeline tag "conversational" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, text2text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, other

mistral-en-nl-v2

Description

mistral-en-nl-v2 is a Mistral finetune specialized in translating English to Dutch.

Usage

Import the required libraries and initialize the pipeline:

from transformers import pipeline
import torch

pipe = pipeline(
    "conversational",
    model="yhavinga/mistral-en-nl-v1",
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

Define the translation function:

def do_translate(text):
    messages = [
       {"role": "user", "content": f"Translate the following English text into Dutch: {text}"}
    ]
    outputs = pipe(
        messages, 
        max_new_tokens=2048, 
        do_sample=False, 
        num_beams=4, 
        early_stopping=True
    )
    return outputs[-1]['content']

Example:

print(do_translate("Redistricting and West Virginia’s shrinking population forced the state’s Republican Legislature to pit Mr. McKinley, a six-term Republican with a pragmatic bent, against Mr. Mooney, who has served four terms marked more by conservative rhetoric than legislative achievements."))

This should yield

Het herindelen van de kiesdistricten en de teruglopende bevolking van West-Virginia dwongen de republikeinse wetgevende macht van de staat om McKinley, een zesvoudig gekozen republikein met een pragmatische inslag, tegenover Mooney te zetten, die vier termijnen heeft gediend en meer bekendstaat om zijn conservatieve retoriek dan om zijn wetgevende prestaties.

Limitations and Bias

The training data, sourced primarily from the internet, may contain biases. Users should be aware of potential biases in translations.

Acknowledgements

This project would not have been possible without compute generously provided by Google through the TPU Research Cloud.

Created by Yeb Havinga

Downloads last month
3
Safetensors
Model size
7.24B params
Tensor type
BF16
·