69 lines
2.0 KiB
Markdown
69 lines
2.0 KiB
Markdown
|
|
---
|
|||
|
|
tags:
|
|||
|
|
- text-generation-inference
|
|||
|
|
- text-generation
|
|||
|
|
- peft
|
|||
|
|
library_name: transformers
|
|||
|
|
base_model:
|
|||
|
|
- meta-llama/Llama-3.2-1B-Instruct
|
|||
|
|
widget:
|
|||
|
|
- messages:
|
|||
|
|
- role: user
|
|||
|
|
content: What is your favorite condiment?
|
|||
|
|
license: cc-by-2.0
|
|||
|
|
pipeline_tag: text-generation
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# Model Trained Using AutoTrain
|
|||
|
|
|
|||
|
|
This model is created from llama3.2 1B Instruct.
|
|||
|
|
email me at: nazmus.sakib.muzahid@gmail.com
|
|||
|
|
|
|||
|
|
# Usage
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
|
|||
|
|
from transformers import pipeline
|
|||
|
|
import nltk
|
|||
|
|
from nltk.tokenize import sent_tokenize
|
|||
|
|
|
|||
|
|
nltk.download("punkt_tab")
|
|||
|
|
|
|||
|
|
pipe = pipeline("text-generation", max_new_tokens=512, do_sample=False, model="mnsm92/English_To_Bengali_Translation")
|
|||
|
|
|
|||
|
|
def create_messages(ot: str):
|
|||
|
|
messages = [
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
"role": "system",
|
|||
|
|
"content": "Translate English to Bengali. Keep the meaning same"
|
|||
|
|
},
|
|||
|
|
{"role": "user", "content": ot}
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
return messages
|
|||
|
|
|
|||
|
|
text = """
|
|||
|
|
National Citizen Party (NCP) convenor Nahid Islam has said that his party will contest the upcoming 13th Jatiya Sangsad (national parliament) election in alliance with Jamaat-e-Islami and like-minded parties.
|
|||
|
|
|
|||
|
|
However, he emphasised that there is no ideological unity between the NCP and Jamaat or its allies, describing the arrangement instead as an electoral understanding.
|
|||
|
|
|
|||
|
|
Nahid Islam made the remarks at a press conference held at the NCP’s temporary central office in the capital’s Banglamotor area on Sunday night.
|
|||
|
|
|
|||
|
|
Earlier in the afternoon, Jamaat-e-Islami and its like-minded parties had announced at their own press conference that the NCP would be part of their 10-party electoral understanding.
|
|||
|
|
|
|||
|
|
Speaking at the NCP press conference, Nahid Islam outlined the background to the understanding with Jamaat and eight other parties.
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
|
|||
|
|
sentences = sent_tokenize(text)
|
|||
|
|
sentences = [ create_messages(sent) for sent in sentences]
|
|||
|
|
outputs = pipe(sentences, batch_size=32, truncation=True)
|
|||
|
|
output_texts = ""
|
|||
|
|
for i in outputs:
|
|||
|
|
output_texts += i[0]['generated_text'][-1]['content']
|
|||
|
|
output_texts.replace("assistant\n\n", " ")
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
# Drop a feedback.
|