Skip to content

Update utils.py: fix nan#40148

Open
MengAiDev wants to merge 1 commit intohuggingface:mainfrom
MengAiDev:patch-1
Open

Update utils.py: fix nan#40148
MengAiDev wants to merge 1 commit intohuggingface:mainfrom
MengAiDev:patch-1

Conversation

@MengAiDev
Copy link
Copy Markdown
Contributor

What does this PR do?

  • Update utils.py: fix nan
  • Suggested in 7e230e5

@ArthurZucker @zucchini-nlp

Copy link
Copy Markdown
Member

@zucchini-nlp zucchini-nlp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want to fix it here. Unless there is an overflow in model code. there should be non NaNs. @gante WDYT

@gante
Copy link
Copy Markdown
Contributor

gante commented Aug 14, 2025

Hi @MengAiDev 👋 Thank you for opening this issue 🤗

Agreed with @zucchini-nlp. Before considering code changes, we need to understand the problem -- even if we end up merging your suggestion as-is :)

Questions:

  1. Can you share a short stand-alone reproducer for the issue? If not (e.g. private model), can you share which operation introduces the nan?
  2. Have you tried running generate with remove_invalid_values=True? (this removes nan in the logits)

@MengAiDev
Copy link
Copy Markdown
Contributor Author

I see, but this is just I try to fix the circle ci's failed, and I actually don't have the way to propose it., Sorry.

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

Successfully merging this pull request may close these issues.

3 participants