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

Chat with onnxruntime-web fails when i deployed on my machine #438

Open
salimngit opened this issue Jun 1, 2024 · 1 comment
Open

Chat with onnxruntime-web fails when i deployed on my machine #438

salimngit opened this issue Jun 1, 2024 · 1 comment

Comments

@salimngit
Copy link

Chat with onnxruntime-web example deployed with

"onnxruntime-web": "1.19.0-dev.20240509-69cfcba38a"
and associated wasm files from https://cdn.jsdelivr.net/npm/[email protected]/dist/

live demo https://guschmue.github.io/ort-webgpu/chat/index.html works just fine.

When i run locally, i receive the below error

Error: found infinitive in logits at LLM.argmax (llm.js:152:1) at LLM.generate (llm.js:210:1) at async Query (main.js:233:1)
  | (anonymous) | @ | main.js:141 -- | -- | -- | --   | Promise.catch (async) |   |     | submitRequest | @ | main.js:140   | (anonymous) | @ | main.js:167

@fosteman
Copy link

fosteman commented Jun 27, 2024

@salimngit, it looks like you're encountering an error related to the presence of infinite values in the logits during the inference process with onnxruntime-web. This can happen due to various reasons, including model issues, input data anomalies, or bugs in the runtime.

Here are a few steps you can take to troubleshoot and resolve this issue:

  1. Check Input Data:

    • Ensure that the input data fed to the model is properly preprocessed and normalized. Incorrect input data can lead to invalid computations resulting in infinite values.
  2. Model Integrity:

    • Verify that the model file is not corrupted. Re-download the model if necessary and ensure that it is correctly loaded in your code.
  3. Runtime Version:

    • Make sure you are using the correct version of onnxruntime-web and associated WASM files. Since you mentioned using a specific development version, confirm that the paths to the WASM files are correct and they are accessible.
  4. Check for Known Issues:

    • Look for any known issues or bugs reported with the version you are using. Sometimes, development versions might have unresolved bugs that could be causing the problem.
  5. Error Handling:

    • Add additional error handling in your code to catch and log the specific values causing the issue. This can help pinpoint the exact cause of the infinite values.

Here is an example of how you might add error handling to check for infinite values in logits:

async function generateResponse(input) {
    try {
        const logits = await LLM.generate(input);
        
        // Check for infinite values in logits
        if (logits.some(value => !isFinite(value))) {
            throw new Error("Found infinite value in logits");
        }
        
        const response = LLM.argmax(logits);
        return response;
    } catch (error) {
        console.error("Error in generateResponse:", error);
        // Handle the error appropriately
    }
}

async function submitRequest(input) {
    try {
        const response = await generateResponse(input);
        // Process the response
    } catch (error) {
        console.error("Error in submitRequest:", error);
        // Handle the error appropriately
    }
}

Verify Local Setup:

  • Ensure all dependencies are correctly installed.
  • Check the console logs for any additional warnings or errors that might give more insight into the problem.

Compare with Working Demo:

  • Compare your local setup with the live demo setup to identify any configuration differences. Ensure all settings, versions, and paths match the working demo.

Debugging Tips:

  • Log intermediate values to understand where the infinite values are introduced.
  • Simplify your input and model to isolate the issue, starting with basic inputs and gradually increasing complexity.

By following these steps, you should be able to identify and resolve the issue with infinite values in the logits during model inference.

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

No branches or pull requests

2 participants