Manhwa-NLLB-1.3B-EnAr-v2

41
2
license:cc-by-nc-4.0
by
Youme21
Other
OTHER
1.3B params
New
41 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
3GB+ RAM
Mobile
Laptop
Server
Quick Summary

AI model with specialized capabilities.

Device Compatibility

Mobile
4-6GB RAM
Laptop
16GB RAM
Server
GPU
Minimum Recommended
2GB+ RAM

Code Examples

🚀 Quick Startpython
pip install torch transformers peft bitsandbytes accelerate
🚀 Quick Startpythontransformers
import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, BitsAndBytesConfig
from peft import PeftModel

# Configure 4-bit quantization for efficiency
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_compute_dtype=torch.bfloat16,
    bnb_4bit_quant_type="nf4",
)

# Load base model
base_model_id = "facebook/nllb-200-distilled-1.3B"
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForSeq2SeqLM.from_pretrained(
    base_model_id,
    quantization_config=bnb_config,
    device_map="auto"
)

# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Youme21/Manhwa-NLLB-EnAr-v2")
model.eval()

# Translate
def translate(text):
    tokenizer.src_lang = "eng_Latn"
    inputs = tokenizer(text, return_tensors="pt").to(model.device)
    
    generated_tokens = model.generate(
        **inputs,
        forced_bos_token_id=tokenizer.convert_tokens_to_ids("arb_Arab"),
        max_length=128,
        num_beams=5,
        early_stopping=True
    )
    
    return tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]

# Example
result = translate("You are courting death!")
print(result)  # أنت تتودد للموت!
Hardwarepython
examples = [
    "You have eyes but failed to recognize Mount Tai.",
    "This seat will personally teach you a lesson.",
    "I feel the Qi gathering in my Dantian.",
    "System Alert: Proficiency of 'Alchemy' has reached Master level."
]

Deploy This Model

Production-ready deployment in minutes

Together.ai

Instant API access to this model

Fastest API

Production-ready inference API. Start free, scale to millions.

Try Free API

Replicate

One-click model deployment

Easiest Setup

Run models in the cloud with simple API. No DevOps required.

Deploy Now

Disclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.