This is a base BART model fine-tuned for English to German translation.
Usage
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)
- Downloads last month
- 35
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.