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

Add valid columns check in _remove_unused_columns method #31466

Merged
merged 4 commits into from
Jun 19, 2024

Conversation

arthasking123
Copy link
Contributor

@arthasking123 arthasking123 commented Jun 18, 2024

What does this PR do?

Add valid columns check in _remove_unused_columns method to fix
huggingface/datasets#6973
huggingface/datasets#6535
This improvement helps users to quickly identify and resolve issues related to column matching between the dataset and the model's forward method.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@arthasking123
Copy link
Contributor Author

@muellerzr @SunMarc

Copy link
Contributor

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

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

Thanks, overall this feels like a good guard. General comment as I'm unsure if we have unrelated changes in this PR

Comment on lines 150 to 151
overall_loss = torch.sum(tokens_per_expert * router_prob_per_expert.unsqueeze(0))
return overall_loss * num_experts
# Ensure the loss calculation balances each expert's load correctly
overall_loss = torch.sum(tokens_per_expert * router_prob_per_expert)
Copy link
Contributor

Choose a reason for hiding this comment

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

These seem like unrelated changes, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh ,sorry for that

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@arthasking123
Copy link
Contributor Author

arthasking123 commented Jun 18, 2024

@muellerzr many thanks!

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

LGTM !

@arthasking123
Copy link
Contributor Author

@amyeroberts would you please merge this PR? Thanks

@SunMarc SunMarc requested a review from amyeroberts June 19, 2024 12:23
Copy link
Collaborator

@amyeroberts amyeroberts left a comment

Choose a reason for hiding this comment

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

Thanks!

@amyeroberts amyeroberts merged commit 0ed3ffc into huggingface:main Jun 19, 2024
20 checks passed
itazap pushed a commit that referenced this pull request Jun 20, 2024
* Add valid columns checking in _remove_unused_columns method

huggingface/datasets#6973 (comment)
huggingface/datasets#6535
https://discuss.huggingface.co/t/indexerror-invalid-key-16-is-out-of-bounds-for-size-0/14298/25

* Update modeling_mixtral.py

* Update modeling_mixtral.py

* Update modeling_mixtral.py
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.

5 participants