Downloads · 30 days
0
sayedshaungt/bangla-word2vec-300d
bangla-word2vec-300d is a machine learning model from sayedshaungt. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for gensim.
These are 300‑dimensional Word2Vec embeddings for the Bangla language, trained on a massive 36 GB Bangla corpus. They capture rich semantic and syntactic relationships between Bangla words, making them ideal for NLP t…
Downloads · 30 days
0
Access
Public
Updated May 18, 2025
Repo size
4.6 GB
Likes
0
Public
Click a slice to open those files.
.npy2.2 GB · 96%
From the Hugging Face model README
These are 300‑dimensional Word2Vec embeddings for the Bangla language, trained on a massive 36 GB Bangla corpus. They capture rich semantic and syntactic relationships between Bangla words, making them ideal for NLP tasks like similarity, clustering, or as input features for downstream models.
| Metric | Value |
|---|---|
| Train loss | 0.7397 |
| Perplexity | 2.0953 |
import os
import glob
import gensim
import huggingface_hub
class HFKeyedVectors(gensim.models.KeyedVectors):
"""
A subclass of Gensim's KeyedVectors that loads embeddings from a Hugging Face model hub.
"""
@classmethod
def from_pretrained(cls: 'HFKeyedVectors', repo_id: str) -> gensim.models.KeyedVectors:
"""
Load pretrained Word2Vec embeddings from a Hugging Face model repository.
This method downloads the model snapshot from the Hugging Face Hub and loads
a `.embeddings` file using Gensim's KeyedVectors. The repository must contain
both the `.embeddings` and corresponding `embeddings.vectors.npy` files.
"""
local_dir = huggingface_hub.snapshot_download(repo_id=repo_id, repo_type="model")
emb_files = glob.glob(os.path.join(local_dir, "*.embeddings"))
if not emb_files:
raise FileNotFoundError(f"No .embeddings file found in {local_dir}")
key_vectors = super().load(emb_files[0])
key_vectors.__class__ = cls
return key_vectors
model = HFKeyedVectors.from_pretrained("sayedshaungt/bangla-word2vec-300d")
print(model.most_similar("বাংলা"))
print(model.similarity("মানুষ", "মহান"))