Download encode_example.py from GermannM/kenga-embed-z: direct link, hf CLI and curl.
- Browser
- Download file 229 Bytes
-
https://huggingface.co/GermannM/kenga-embed-z/resolve/main/encode_example.py
- Command line
-
hf download hf://GermannM/kenga-embed-z/encode_example.py
-
curl -L -o encode_example.py https://huggingface.co/GermannM/kenga-embed-z/resolve/main/encode_example.py
229 Bytes
| from modeling_kenga_embed import KengaEmbed | |
| m = KengaEmbed.from_pretrained(".") | |
| q = m.encode_queries(["Where is the capital of Russia?"]) | |
| d = m.encode_documents(["Moscow is the capital of Russia."]) | |
| print(float((q * d).sum(-1))) | |