Downloads · 30 days
25
16% of all-time downloads
viswamaicoe/nanochat-telugu-560M
nanochat-telugu-560M is a text generation model from viswamaicoe. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as agpl-3.0.
NanoChat Telugu 560M is a Telugu language model designed for conversational AI, text generation. The model is optimized specifically for Telugu text processing with a custom tokenizer that achieves significantly bette…
Downloads · 30 days
25
16% of all-time downloads
All-time downloads
158
Public
Parameters
561M
1.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.1 GB · 99%
From the Hugging Face model README
NanoChat Telugu 560M is a Telugu language model designed for conversational AI, text generation. The model is optimized specifically for Telugu text processing with a custom tokenizer that achieves significantly better efficiency compared to general-purpose tokenizers.
The model uses a custom Telugu-specific BPE (Byte Pair Encoding) tokenizer trained on Telugu text. This tokenizer achieves 70-82% reduction in token count compared to general-purpose tokenizers like GPT-2 and GPT-4, making it highly efficient for Telugu text processing.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "viswamaicoe/nanochat-telugu-560M"
device = "cpu" # or torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype=torch.float32,
).to(device)
# Example: Generate text
text = "హలో, మీరు ఎలా ఉన్నారు?"
inputs = tokenizer(text, return_tensors="pt").to(device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=50)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
You can extract sentence-level embeddings from the model for various downstream tasks like semantic search, text classification, or similarity computation:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "viswamaicoe/nanochat-telugu-560M"
device = "cpu" # torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype=torch.float32,
).to(device)
def get_sentence_embeddings(text, pooling_strategy="mean"):
"""Extract sentence-level embeddings using pooling"""
inputs = tokenizer(text, return_tensors="pt")
input_ids = inputs["input_ids"].to(device)
attention_mask = inputs["attention_mask"].to(device)
with torch.no_grad():
outputs = model(
input_ids=input_ids,
attention_mask=attention_mask,
output_hidden_states=True
)
# Get last hidden state
last_hidden_state = outputs.hidden_states[-1]
if pooling_strategy == "mean":
# Mean pooling (excluding padding tokens)
masked_embeddings = last_hidden_state * attention_mask.unsqueeze(-1)
sentence_embedding = masked_embeddings.sum(dim=1) / attention_mask.sum(dim=1, keepdim=True)
elif pooling_strategy == "max":
# Max pooling
masked_embeddings = last_hidden_state.masked_fill(~attention_mask.unsqueeze(-1).bool(), float('-inf'))
sentence_embedding = masked_embeddings.max(dim=1)[0]
return sentence_embedding
# Example usage
text = "హలో, మీరు ఎలా ఉన్నారు?"
sentence_embedding = get_sentence_embeddings(text, pooling_strategy="mean")
print(f"Sentence embedding shape: {sentence_embedding.shape}")
# Sentence embedding shape: torch.Size([1, 1280])
Pooling Strategies:
Important: This model is intended for research and legitimate use cases only. Users are responsible for ensuring their use of this model complies with applicable laws and ethical guidelines.
This model should NOT be used for:
This model is provided "as-is" without any warranties. The model developers and maintainers are not responsible for any misuse, damages, or consequences arising from the use of this model. Users assume full responsibility for their use of this model.
If you use this model, please cite:
@misc{nanochat-telugu-560m,
title={NanoChat Telugu 560M: A Telugu Language Model},
author={Viswam AI COE},
year={2025},
howpublished={\url{https://huggingface.co/viswamaicoe/nanochat-telugu-560M}}
}
For questions or issues, please contact the model maintainers.