Skip to content

Conversation

hovnatan
Copy link
Contributor

What does this PR do?

Fixes #29807, sinusoidal positional encodings overwritten by post_init(), for Flauber, Informer and XLM models

Before submitting

Who can review?

@ArthurZucker, @younesbelkada, @amyeroberts

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.

I think we could put everythin in the _init_weight? (trick is to use parent class)

@hovnatan
Copy link
Contributor Author

I moved XLM and Flaubert to init_weight()

@hovnatan hovnatan changed the title Fix 29807 sinusoidal positional encodings in Flauber, Informer and XLM Fix 29807 sinusoidal positional encodings in Flaubert, Informer and XLM Mar 31, 2024
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.

LGTM just one nit to re-use the test and good to go!

config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_flaubert_model(*config_and_inputs)

def test_flaubert_model_with_sinusoidal_encodings(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's use copied from for the test as well!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does this solve it?

config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_xlm_model(*config_and_inputs)

def test_xlm_model_with_sinusoidal_encodings(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing copied from

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ArthurZucker does this solve it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, but we need "with Distlbert->XLM"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed them

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.

let's use the copied from "with" statements if you see what I mean

config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_xlm_model(*config_and_inputs)

def test_xlm_model_with_sinusoidal_encodings(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, but we need "with Distlbert->XLM"

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.

LGTM thanks you!

@ArthurZucker ArthurZucker merged commit 416711c into huggingface:main Apr 2, 2024
@hovnatan hovnatan deleted the fix_29807_pos_sine_encod_flauber_informer_xlm branch April 2, 2024 12:51
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.

Sinusoidal positional encodings overwritten by post_init()
2 participants