Skip to content

Whisper Model Has Inaccessible Logits/Log Probs #1855

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

Open
cheggisnear opened this issue Feb 15, 2025 · 1 comment
Open

Whisper Model Has Inaccessible Logits/Log Probs #1855

cheggisnear opened this issue Feb 15, 2025 · 1 comment

Comments

@cheggisnear
Copy link

Description:
Hello, I've been tinkering with CTranslate2 with whisper converted to ct2. Using model.generate with return_logits_vocab=True and return_scores=True I'm unable to access or print out the logits entirely. For example:

result = model.generate(..., return_logits_vocab=True, return_scores=True)
print(result[0].logits[0][0])
# Output: [cpu:0 float32 storage viewed as ]
print(result[0].logits[0][0].__array_interface__)
# Output: {'shape': (), 'typestr': '<f4', 'data': (0, False), 'version': 3}

This issue is reproducible with any input, even though the sequences are transcribed correctly.

Expected Behavior:
I would expect result[0].logits to contain accessible tensors with the logit values or log probs for each token generated.

Actual Behavior:
The logits appear to be empty or not fully accessible, as indicated by the output above.

This is super strange to me because result[0].scores[0] is completely accessible and prints out exactly as expected and I'd have to imagine that the scores attribute is just some mean or derivative of all of the log probs/logits for each token generated by CTranslate2. Which leads me to believe that this is some sort of bug rather than intentional behavior to hide the log probs.

Additional Details:

  • CTranslate2 Version: 4.5.0

  • I also tried the latest commit (6a3dc63) which seemed related to the logits issues. While the commit added the logits property on print WhisperGenerationResult with print(result[0]), even there the issue persists with the same empty logits and everything else working:

    logits=[[
    [cpu:0 float32 storage viewed as ]], [
    [cpu:0 float32 storage viewed as ]], [
    [cpu:0 float32 storage viewed as ]], [
    [cpu:0 float32 storage viewed as ]], [
    [cpu:0 float32 storage viewed as ]]
    

Environment:
Python 3.11.11
MacOS Sequoia 15.2

Running cpu float32 inference on an M1 Pro Macbook.

Please let me know if you need any more information. If this is indeed a bug (and not intended behavior for the Whisper model), I'm happy to investigate further or contribute a fix.

Thanks!

@yoadsn
Copy link

yoadsn commented Apr 9, 2025

Confirming repro on CUDA gpu as well.
Tried with 4.5.0 and 4.6.0 including PR #1846 that added the logits to the __repr__.
It seems like the logits are being generated internally, but the StorageView does not contain them.

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