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

How do I know the loading progress when loading .onnx file? #993

Open
aidscooler opened this issue Oct 25, 2024 · 3 comments
Open

How do I know the loading progress when loading .onnx file? #993

aidscooler opened this issue Oct 25, 2024 · 3 comments
Labels
question Further information is requested

Comments

@aidscooler
Copy link

aidscooler commented Oct 25, 2024

Question

Because the .onnx file is large(about 170M),I decided to provide a loading progress. Code as below:

 const modelSettings = {
        // Do not require config.json to be present in the repository
        config: { model_type: "custom" },
        subfolder: "",
        process_callback: (progress) => {
          modelLoadingProgress.value = Math.round(progress * 100); 
          console.log("model : " + progress)         
        }
 };
 modelSettings.device = "webgpu";
 modelSettings.dtype = "fp32";
 model = await AutoModel.from_pretrained('briaai/RMBG-1.4', modelSettings);

I found the process_callback never been called. Can anyone help?

@aidscooler aidscooler added the question Further information is requested label Oct 25, 2024
@xenova
Copy link
Collaborator

xenova commented Oct 25, 2024

Hi there 👋 you have a typo: it should be progress_callback (not proCess)

@aidscooler
Copy link
Author

Hi there 👋 you have a typo: it should be progress_callback (not proCess)

You are right,Thanks!!! What's there in the argument progress? It shows [object object] in the console.How do I know the details of progress?

@xenova
Copy link
Collaborator

xenova commented Oct 25, 2024

We also provide information like total number of bytes, so progress is not a single number. Feel free to console.log it to see the available fields. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants