Text Generation
Transformers
TensorBoard
Safetensors
PEFT
llama
text-generation-inference
conversational
Instructions to use mnsm92/English_To_Bengali_Translation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mnsm92/English_To_Bengali_Translation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mnsm92/English_To_Bengali_Translation") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mnsm92/English_To_Bengali_Translation") model = AutoModelForCausalLM.from_pretrained("mnsm92/English_To_Bengali_Translation") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use mnsm92/English_To_Bengali_Translation with PEFT:
Task type is invalid.
- Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mnsm92/English_To_Bengali_Translation with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mnsm92/English_To_Bengali_Translation" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mnsm92/English_To_Bengali_Translation", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mnsm92/English_To_Bengali_Translation
- SGLang
How to use mnsm92/English_To_Bengali_Translation with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mnsm92/English_To_Bengali_Translation" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mnsm92/English_To_Bengali_Translation", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mnsm92/English_To_Bengali_Translation" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mnsm92/English_To_Bengali_Translation", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mnsm92/English_To_Bengali_Translation with Docker Model Runner:
docker model run hf.co/mnsm92/English_To_Bengali_Translation
Model Trained Using AutoTrain
This model is created from llama3.2 1B Instruct. email me at: nazmus.sakib.muzahid@gmail.com
Usage
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.
- Downloads last month
- 170
Model tree for mnsm92/English_To_Bengali_Translation
Base model
meta-llama/Llama-3.2-1B-Instruct