Downloads · 30 days
5
15% of all-time downloads
convaiinnovations/hindi_llm_moe
hindi_llm_moe is a machine learning model from convaiinnovations. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This is a multilingual causal language model with a focus on Hindi text generation. The model uses a custom architecture with several advanced features:
Downloads · 30 days
5
15% of all-time downloads
All-time downloads
34
Public
Parameters
497M
2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2 GB · 100%
From the Hugging Face model README
This is a multilingual causal language model with a focus on Hindi text generation. The model uses a custom architecture with several advanced features:
This model requires custom architecture files for inference. You need to include the following Python modules in your project:
convaicausallm_model_with_moe_rope.py: Contains the model architecturehindi_embeddings.py: Contains the SentencePiece tokenizer wrapperimport torch
from convaicausallm_model_with_moe_rope import ConvaiCausalLMConfig, ConvaiCausalLM
from hindi_embeddings import SentencePieceTokenizerWrapper
from safetensors.torch import load_file
import json
# Load model and tokenizer
tokenizer = SentencePieceTokenizerWrapper("tokenizer.model")
config_path = "config.json"
with open(config_path, "r") as f:
config_dict = json.load(f)
config = ConvaiCausalLMConfig(**config_dict)
model = ConvaiCausalLM(config)
state_dict = load_file("model.safetensors")
model.load_state_dict(state_dict)
# Generate text
input_text = "भारत की राजधानी क्या है?"
input_ids = tokenizer.sp_model.EncodeAsIds(input_text)
input_ids_tensor = torch.tensor([input_ids], dtype=torch.long)
lang_id = torch.tensor([0], dtype=torch.long) # Language ID for Hindi
# Forward pass
outputs = model(input_ids=input_ids_tensor, lang_ids=lang_id, char_ids=None)
next_token_logits = outputs["logits"][:, -1, :]
next_token = torch.argmax(next_token_logits, dim=-1).unsqueeze(-1)
# Continue generation as needed...
See generate_multilingual.py for a complete text generation implementation.
This is an early version of the model with the following limitations:
This work builds upon advancements in language model architecture and training techniques from the research community.