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

Fixed bugs in JetMoE models. #31824

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Phoenix-Shen
Copy link

What does this PR do?

Fixes issue #31791.

  1. Fixed bugs in JetMoE casual language model and sequence classification model.
  2. The original code will report errors when we want to output the aux_loss, like described in the issue.
  3. I have modified JetMoeForCausalLM and JetMoeForSequenceClassification, now they work properly and output aux_loss,
  4. Meanwhile I have followed MoeCausalLMOutputWithPast class to write a new class named MoESequenceClassifierOutputWithPast to store the results of JetMoeForSequenceClassification model.
  5. The code have passed the test of tests/models/jetmoe/test_modeling_jetmoe.py.

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?

@ArthurZucker

@Phoenix-Shen
Copy link
Author

ci/circleci: tests_torch_and_tf error doesn't seem to be a problem with the code I submitted.

@yikangshen
Copy link
Contributor

The check_code_quality error can be fixed with this command:
ruff format src/transformers/models/jetmoe/modeling_jetmoe.py.
The tests_torch_and_tf will usually be automatically fixed after a resubmission.

@Phoenix-Shen
Copy link
Author

The check_code_quality error can be fixed with this command: ruff format src/transformers/models/jetmoe/modeling_jetmoe.py. The tests_torch_and_tf will usually be automatically fixed after a resubmission.

Thanks a lot, I have already formatted the files under your guidance.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Thanks for updating! This LGTM, let's add a test the tests the loss computation with output router logits to make sure this is properly tested!

@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.

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.

None yet

4 participants