-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error[E0597]: XXX
does not live long enough
#97
Comments
Thank you for your fast response! Looking forward to the patch... |
I believe 9a631f1 should be stable enough to use as a Git dependency until the full release of v2.0. [dependencies]
ort = { git = "https://github.com/pykeio/ort.git", rev = "9a631f1", features = [ "cuda" ] } A few changes are required:
let input_ids = ndarray::CowArray::from(&input_ids)
.into_shape((batch_size, sequence_length))
.unwrap()
.into_dyn();
let input_ids = ort::Value::from_array(None, &input_ids).unwrap();
print!("input_ids: {:?}", input_ids);
let attention_mask = ndarray::CowArray::from(&attention_mask)
.into_shape((batch_size, sequence_length))
.unwrap()
.into_dyn();
let attention_mask = ort::Value::from_array(None, &attention_mask).unwrap();
print!("attention_mask: {:?}", attention_mask);
let token_type_ids = ndarray::CowArray::from(&token_type_ids)
.into_shape((batch_size, sequence_length))
.unwrap()
.into_dyn();
let token_type_ids = ort::Value::from_array(None, &token_type_ids).unwrap();
print!("token_type_ids: {:?}", token_type_ids);
let outputs = session.run(ort::inputs![input_ids, attention_mask, token_type_ids].unwrap()).unwrap();
print!("output: {:?}", outputs[0]) |
Cool... THANKS! I have the following lines in the end: // same as above
let embeddings = session
.run(ort::inputs![input_ids, attention_mask, token_type_ids].unwrap())
.unwrap();
let embeddings = embeddings[0].extract_tensor::<f32>().unwrap();
let embeddings = embeddings.view();
for embedding in embeddings.axis_iter(ndarray::Axis(0)) {
println!("embedding: {:?}", embedding);
} This works, and I get some numbers, which are most likely correct. How can I get matrix multiplication, for instance? That would be great to get the matrix multiplication |
See |
Hi,
Together with my colleague, @aykut-bozkurt, we have been trying out
ort
with Hugging Face'stokenizers
library. We wanted to runintfloat/e5-small-v2
with the following dependencies:and the following source file:
When we try to compile the code, we get the following error:
First, are we using the libraries as they are supposed to be used? We could not find an example that uses multiple inputs (from the
tokenizers
library). Is this a limitation onort
's orndarray
's side? Otherwise, what would you recommend?The text was updated successfully, but these errors were encountered: