Views
No views yet
1# Load model directly
2from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3tokenizer = AutoTokenizer.from_pretrained("teamapocalypseml/ben2ipa-umt5base")
4model = AutoModelForSeq2SeqLM.from_pretrained("teamapocalypseml/ben2ipa-umt5base")
5"""
6 The format of the input text MUST BE: <district> <bengali_text>
7"""
8text = "<district> bengali_text_here"
9text_ids = tokenizer(text, return_tensors='pt').input_ids
10model(text_ids)1# Use a pipeline as a high-level helper
2from transformers import pipeline
3device = "cuda" if torch.cuda.is_available() else "cpu"
4pipe = pipeline("text2text-generation", model="teamapocalypseml/ben2ipa-umt5base", device=device)
5"""
6 `texts` must be in the format of: <district> <contents>
7"""
8outputs = pipe(texts, max_length=512, batch_size=batch_size)