Downloads · 30 days
0
Jyotiprakash4357/language-detection-lstm
language-detection-lstm is a machine learning model from Jyotiprakash4357. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Character-level Bidirectional LSTM trained on papluca/language-identification.
Downloads · 30 days
0
Access
Public
Updated Mar 9, 2026
Repo size
9.6 MB
Likes
0
Public
Click a slice to open those files.
.pt9.6 MB · 100%
From the Hugging Face model README
Character-level Bidirectional LSTM trained on papluca/language-identification.
Arabic, Bulgarian, German, Greek, English, Spanish, French, Hindi, Italian, Japanese, Dutch, Polish, Portuguese, Russian, Swahili, Thai, Turkish, Urdu, Vietnamese, Chinese
import torch, pickle
from huggingface_hub import hf_hub_download
char2idx = pickle.load(open(hf_hub_download("Jyotiprakash4357/language-detection-lstm", "char2idx.pkl"), "rb"))
le = pickle.load(open(hf_hub_download("Jyotiprakash4357/language-detection-lstm", "label_encoder.pkl"), "rb"))
model = LangLSTM(len(char2idx), 64, 256, 2, len(le.classes_))
model.load_state_dict(torch.load(hf_hub_download("Jyotiprakash4357/language-detection-lstm", "lang_lstm.pt"), map_location="cpu"))
predict("Bonjour le monde") # → [('fr', 0.99), ...]