Upload google_embeddinggemma-300m_2.py with huggingface_hub
Browse files
google_embeddinggemma-300m_2.py
CHANGED
|
@@ -11,9 +11,17 @@
|
|
| 11 |
# ///
|
| 12 |
|
| 13 |
try:
|
| 14 |
-
|
| 15 |
-
from
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
with open('google_embeddinggemma-300m_2.txt', 'w', encoding='utf-8') as f:
|
| 18 |
f.write('Everything was good in google_embeddinggemma-300m_2.txt')
|
| 19 |
except Exception as e:
|
|
@@ -28,9 +36,17 @@ except Exception as e:
|
|
| 28 |
with open('google_embeddinggemma-300m_2.txt', 'a', encoding='utf-8') as f:
|
| 29 |
import traceback
|
| 30 |
f.write('''```CODE:
|
| 31 |
-
|
| 32 |
-
from
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
```
|
| 35 |
|
| 36 |
ERROR:
|
|
|
|
| 11 |
# ///
|
| 12 |
|
| 13 |
try:
|
| 14 |
+
import torch
|
| 15 |
+
from sentence_transformers import SentenceTransformer
|
| 16 |
+
|
| 17 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 18 |
+
|
| 19 |
+
model_id = "google/embeddinggemma-300M"
|
| 20 |
+
model = SentenceTransformer(model_id).to(device=device)
|
| 21 |
+
|
| 22 |
+
print(f"Device: {model.device}")
|
| 23 |
+
print(model)
|
| 24 |
+
print("Total number of parameters in the model:", sum([p.numel() for _, p in model.named_parameters()]))
|
| 25 |
with open('google_embeddinggemma-300m_2.txt', 'w', encoding='utf-8') as f:
|
| 26 |
f.write('Everything was good in google_embeddinggemma-300m_2.txt')
|
| 27 |
except Exception as e:
|
|
|
|
| 36 |
with open('google_embeddinggemma-300m_2.txt', 'a', encoding='utf-8') as f:
|
| 37 |
import traceback
|
| 38 |
f.write('''```CODE:
|
| 39 |
+
import torch
|
| 40 |
+
from sentence_transformers import SentenceTransformer
|
| 41 |
+
|
| 42 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 43 |
+
|
| 44 |
+
model_id = "google/embeddinggemma-300M"
|
| 45 |
+
model = SentenceTransformer(model_id).to(device=device)
|
| 46 |
+
|
| 47 |
+
print(f"Device: {model.device}")
|
| 48 |
+
print(model)
|
| 49 |
+
print("Total number of parameters in the model:", sum([p.numel() for _, p in model.named_parameters()]))
|
| 50 |
```
|
| 51 |
|
| 52 |
ERROR:
|