Model reference · open weights
llama2-embedding-8k is an open-weight embedding model from mesolitica. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | mesolitica |
|---|---|
| Type | Embedding models |
| Task | Embeddings |
| Parameters (lead) | 947M |
| Context | 32k tokens |
| Runs with | transformers |
| Released | 2023-10-05 |
| Popularity | 220k downloads / month |
| Licence | Unknown |
About
Trained on truncated 8k context length, but infer able to scale up to 32k context length.
README at https://github.com/mesolitica/llama2-embedding#finetune
WandB, https://wandb.ai/mesolitica/llama2-embedding-1b?workspace=user-husein-mesolitica
from transformers import AutoModel, AutoTokenizer
from sklearn.metrics.pairwise import cosine_similarity
model = AutoModel.from_pretrained('mesolitica/llama2-embedding-1b-8k', trust_remote_code = True)
tokenizer = AutoTokenizer.from_pretrained('mesolitica/llama2-embedding-1b-8k')
input_ids = tokenizer(
[
'tak suka ayam',
'Isu perkauman: Kerajaan didakwa terdesak kaitkan pemimpin PN',
'nasi ayam tu sedap',
'suka ikan goreng?',
'Kerajaan tidak akan berkompromi dengan isu perkauman dan agama yang dimanipulasi pihak tertentu untuk mengganggu-gugat kestabilan negara serta ketenteraman rakyat.',
'rasis bodo mamat tu',
'kerajaan sekarang xde otak',
'aku nak sukan olimpik ni',
'malaysia dapat x pingat kt sukan asia?',
'pingat gangsa menerusi terjun dan olahraga pada hari ke-10',
'Kerajaan negeri kini dibenarkan melaksanakan penerokaan awal unsur nadir bumi (REE) berdasarkan prosedur operasi standard (SOP) sedia ada untuk perlombongan nadir bumi dan mineral.',
'KONTINJEN Malaysia mendekati sasaran 27 pingat di Sukan Asia kali ini esok, selepas menuai dua lagi pingat gangsa menerusi terjun dan olahraga pada hari ke-10 pertandingan, pada Selasa.'
],
return_tensors = 'pt',
padding = True
)
v = model.encode(input_ids).detach().numpy()
v.shape
(12, 1536)
From the published model card. Full card on the HuggingFace links in the sidebar.
Using it via the API
Once AxForge deploys llama2-embedding-8k for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (llama2-embedding-8k below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/embeddings \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"llama2-embedding-8k","input":"text to embed"}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.