Downloads · 30 days
15
2% of all-time downloads
MattBoraske/BART-En-2-De-Translation
BART-En-2-De-Translation is a translation model from MattBoraske. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as apache-2.0.
This is a base BART model fine-tuned for English to German translation.
Downloads · 30 days
15
2% of all-time downloads
All-time downloads
829
Public
Parameters
139M
5.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin558 MB · 50%
From the Hugging Face model README
This is a base BART model fine-tuned for English to German translation.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("MattBoraske/BART_De-En_Translation")
model = AutoModelForSeq2SeqLM.from_pretrained("MattBoraske/BART_De-En_Translation")
# Sample English sentence
sentence = "Good morning! How are you?"
# Translate English to Deutsch (German)
inputs = tokenizer.encode(sentence, return_tensors="pt")
outputs = model.generate(inputs, max_length=40, num_beams=4, early_stopping=True)
translated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(translated_sentence)