Skip to content
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

[Web] Can't create a session #22484

Open
djannot opened this issue Oct 17, 2024 · 2 comments
Open

[Web] Can't create a session #22484

djannot opened this issue Oct 17, 2024 · 2 comments
Labels
model:transformer issues related to a transformer model: BERT, GPT2, Hugging Face, Longformer, T5, etc. platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@djannot
Copy link

djannot commented Oct 17, 2024

Describe the issue

I'm trying to load a model I've converted from gguf to onnx using optimum-cli and I get this error (Can't create a session).

To reproduce

I'm following the example https://github.com/microsoft/onnxruntime-inference-examples/blob/main/js/quick-start_onnxruntime-web-bundler/main.js with my own local model.

Note that I can run the model successfully in python with:

from transformers import AutoTokenizer
from optimum.onnxruntime import ORTModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("./public/models/onnx/onnx")
model = ORTModelForCausalLM.from_pretrained("./public/models/onnx/onnx")

inputs = tokenizer("My name is Philipp and I live in Germany.", return_tensors="pt")

gen_tokens = model.generate(**inputs,do_sample=True,temperature=0.9, min_length=20,max_length=20)
response = tokenizer.batch_decode(gen_tokens)
print("Generated text:", response)

Urgency

No response

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.19.2

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

@djannot djannot added the platform:web issues related to ONNX Runtime web; typically submitted using template label Oct 17, 2024
@github-actions github-actions bot added the model:transformer issues related to a transformer model: BERT, GPT2, Hugging Face, Longformer, T5, etc. label Oct 17, 2024
@fs-eire
Copy link
Contributor

fs-eire commented Oct 22, 2024

It will be helpful if you share the model or the steps to generate the onnx model for further analysis.

@djannot
Copy link
Author

djannot commented Oct 22, 2024

@fs-eire I now get something like Failed to load the model: 20419424 and I get the same issue when using the onnxruntime directly or the latest transformers.js library.

I provided more info about how I build the model here: huggingface/transformers.js#979 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
model:transformer issues related to a transformer model: BERT, GPT2, Hugging Face, Longformer, T5, etc. platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

2 participants