legacy-datasets/wikipedia
Updated • 40.8k • 622
Run rmihaylov/roberta2roberta-shared-nmt-bg on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Use HF Jobs to fine-tune https://huggingface.co/rmihaylov/roberta2roberta-shared-nmt-bg. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Use HF Jobs to run batch inference with https://huggingface.co/rmihaylov/roberta2roberta-shared-nmt-bg on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
How to use rmihaylov/roberta2roberta-shared-nmt-bg with Transformers:
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("rmihaylov/roberta2roberta-shared-nmt-bg")
model = AutoModelForSeq2SeqLM.from_pretrained("rmihaylov/roberta2roberta-shared-nmt-bg", device_map="auto")This model was introduced in this paper.
The training data is private English-Bulgarian parallel data.
You can use the raw model for translation from English to Bulgarian.
Here is how to use this model in PyTorch:
>>> from transformers import EncoderDecoderModel, XLMRobertaTokenizer
>>>
>>> model_id = "rmihaylov/roberta2roberta-shared-nmt-bg"
>>> model = EncoderDecoderModel.from_pretrained(model_id)
>>> model.encoder.pooler = None
>>> tokenizer = XLMRobertaTokenizer.from_pretrained(model_id)
>>>
>>> text = """
Others were photographed ransacking the building, smiling while posing with congressional items such as House Speaker Nancy Pelosi's lectern or at her staffer's desk, or publicly bragged about the crowd's violent and destructive joyride.
"""
>>>
>>> inputs = tokenizer.encode_plus(text, max_length=100, return_tensors='pt', truncation=True)
>>>
>>> translation = model.generate(**inputs,
>>> max_length=100,
>>> num_beams=4,
>>> do_sample=True,
>>> num_return_sequences=1,
>>> top_p=0.95,
>>> decoder_start_token_id=tokenizer.bos_token_id)
>>>
>>> print([tokenizer.decode(g.tolist(), skip_special_tokens=True) for g in translation])
['Други бяха заснети да бягат из сградата, усмихвайки се, докато се представят с конгресни предмети, като например лекцията на председателя на парламента Нанси Пелози или на бюрото на нейния служител, или публично се хвалят за насилието и разрушителната радост на тълпата.']