You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

import torch, logging
from transformers import AutoModelForCausalLM, AutoTokenizer

tig_model_path = "BeitTigreAI/tigre-llm-Llama3.2-1B"

# Set the device for computation
device = "cuda" if torch.cuda.is_available() else "cpu"

# Load the tokenizer and model from the specified path
tokenizer = AutoTokenizer.from_pretrained(tig_model_path)
model = AutoModelForCausalLM.from_pretrained(tig_model_path, device_map="auto")
model = model.to(device)

# Suppress some of the logging for a cleaner output
logging.getLogger("transformers").setLevel(logging.ERROR)

# Example 1: Generate text in Tigre (written in Ethiopic script)
prompt = "[tig_Ethi]แˆ˜แˆญแˆแ‰  แ‰ฅแŠฉแˆ"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=50)
print("Tigre Output:")
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))

# Example 2: Generate text in Arabic
prompt = "ู…ุง ุงู„ุฐูŠ ูŠู…ูŠุฒ ู„ุบุฉ ุงู„ุชุบุฑูŠุŸ"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print("\nArabic Output:")
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))

# Example 3: Generate text in English
prompt = "[eng_Latn] What is interesting about the Tigre language?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print("\nEnglish Output:")
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for BeitTigreAI/tigre-llm-Llama3.2-1B

Finetuned
(930)
this model

Space using BeitTigreAI/tigre-llm-Llama3.2-1B 1