[DO NOT MERGE YET] Add ONNX weights

#22
by Xenova HF staff - opened
No description provided.
Xenova changed pull request title from Add ONNX weights to [DO NOT MERGE YET] Add ONNX weights

How can I infer with different embedding dimension?

model_path = "./Nomic_Embed_V1.5/onnx/model_quantized.onnx"
tokenizer_path = "./Nomic_Embed_V1.5"
tokenizer = AutoTokenizer.from_pretrained(tokenizer_path)
session = ort.InferenceSession(model_path)
inputs = tokenizer(query_sentence, return_tensors="np")

onnx_inputs = {session.get_inputs()[i].name: inputs[input_name].astype(
np.int64) for i, input_name in enumerate(inputs.keys())}
outputs = session.run(None, onnx_inputs)
embeddings = outputs[0]

Nomic AI org
edited Oct 10

I don't believe the model was converted to Onnx with that ability. You will have to do that yourself unfortunately

zpn changed pull request status to closed

Thanks. Already working on one

Nomic AI org

Let me know if you get something working!

Sign up or log in to comment