Views
No views yet
onnx/model.onnx + onnx/model.onnx_data) from onnx-community/embeddinggemma-300m-ONNXweights/dense1_weight.npy, weights/dense2_weight.npy)1. Transformer (Gemma3TextModel) - 300M parameters
2. Pooling (mean pooling with attention mask)
3. Dense Layer 1: 768 → 3072 (no bias)
4. Dense Layer 2: 3072 → 768 (no bias)
5. L2 Normalizationpip install transformers torch numpy1from inference_onnx import RgvedaEmbeddingONNXHybrid
2
3# Initialize
4model = RgvedaEmbeddingONNXHybrid(".")
5
6# Encode texts
7prefixes = {
8 "query": "task: search result | query: ",
9 "document": "title: none | text: ",
10}
11
12query = prefixes["query"] + "वृष्टि-विद्युत्-सदृशं दैविकं आगमनम्"
13documents = [
14 prefixes["document"] + "असामि हि प्रयज्यवः",
15 prefixes["document"] + "उत द्वार उशतीर् वि श्रयन्ताम्",
16]
17
18# Get embeddings
19query_emb = model.encode(query)
20doc_embs = model.encode(documents)
21
22# Compute similarity
23similarities = query_emb @ doc_embs.T
24print(similarities)| Use Case | Prefix |
|---|---|
| Search Query | task: search result | query: {text} |
| Document/Passage | title: none | text: {text} |
| Question Answering | task: question answering | query: {text} |
| Classification | task: classification | query: {text} |
| Semantic Similarity | task: sentence similarity | query: {text} |
.
├── onnx/
│ ├── model.onnx # ONNX model graph (469 KB)
│ └── model.onnx_data # ONNX model weights (1.1 GB)
├── weights/
│ ├── dense1_weight.npy # Fine-tuned dense layer 1 (3072×768)
│ └── dense2_weight.npy # Fine-tuned dense layer 2 (768×3072)
├── inference_onnx.py # ONNX inference script (recommended)
├── inference.py # PyTorch inference script (alternative)
├── tokenizer.json # Tokenizer vocabulary
├── tokenizer_config.json # Tokenizer settings
├── special_tokens_map.json # Special tokens
└── README.md # This file1@misc{ganaraj2024rgveda,
2 author = {Ganaraj},
3 title = {rgveda-embedding-gemma},
4 year = {2024},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/Ganaraj/rgveda-embedding-gemma}
7}1@misc{embeddinggemma,
2 title = {EmbeddingGemma},
3 author = {Google DeepMind},
4 year = {2024},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/google/embeddinggemma-300m}
7}