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

Error while using cache branch in profiling models #3

Open
MatteoFasulo opened this issue Aug 25, 2024 · 0 comments
Open

Error while using cache branch in profiling models #3

MatteoFasulo opened this issue Aug 25, 2024 · 0 comments

Comments

@MatteoFasulo
Copy link

Hi,
I was trying to profile the Whisper decoder model (tiny) using the ORT Web Perf tool. However, when I run the profiler it gives me an error: Error: input 'cache_position' is missing in 'feeds'.

The following code is the reference in ort-perf.html:

if (gen == "whisper-decoder") {
    feed["input_ids"] = fillTensor([1, seqlen], "int64", 1n);
    feed["encoder_hidden_states"] = fillTensor([1, 1500, 384], "float32");
    // past_key_values.0.encoder.value[FLOAT, batch_sizex6xencoder_sequence_length_outx64]
    // past_key_values.1.decoder.key[FLOAT, batch_sizex6xpast_decoder_sequence_lengthx64]
    const decoder_shape = [1, 6, seqlen, 64];
    const encoder_shape = [1, 6, 1500, 64];
    for (var k in inputNames) {
        const v = inputNames[k];
        if (v.startsWith("past_key_values.")) {
            if (v.includes("decoder")) {
                feed[v] = fillTensor(decoder_shape, "float32", 1);
            } else if (v.includes("encoder")) {
                feed[v] = fillTensor(encoder_shape, "float32", 1);
            }
        }
    }
    feed['use_cache_branch'] = new ort.Tensor("bool", [0], [1]);
    return feed;
}

Removing the following line seems to work:

// feed['use_cache_branch'] = new ort.Tensor("bool", [0], [1]);
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

1 participant