code_execution_files / google_embeddinggemma-300m_4.txt
ariG23498's picture
ariG23498 HF Staff
Upload google_embeddinggemma-300m_4.txt with huggingface_hub
8c3c4a0 verified
raw
history blame
907 Bytes
```CODE:
# The sentences to encode
sentence_high = [
"The chef prepared a delicious meal for the guests.",
"A tasty dinner was cooked by the chef for the visitors."
]
sentence_medium = [
"She is an expert in machine learning.",
"He has a deep interest in artificial intelligence."
]
sentence_low = [
"The weather in Tokyo is sunny today.",
"I need to buy groceries for the week."
]
for sentence in [sentence_high, sentence_medium, sentence_low]:
print("๐Ÿ™‹โ€โ™‚๏ธ")
print(sentence)
embeddings = model.encode(sentence)
similarities = model.similarity(embeddings[0], embeddings[1])
print("`-> ๐Ÿค– score: ", similarities.numpy()[0][0])
```
ERROR:
Traceback (most recent call last):
File "/tmp/google_embeddinggemma-300m_4PP3WIF.py", line 31, in <module>
embeddings = model.encode(sentence)
^^^^^
NameError: name 'model' is not defined