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

Randomization fix #30

Merged
merged 4 commits into from
Jun 13, 2024
Merged

Randomization fix #30

merged 4 commits into from
Jun 13, 2024

Conversation

gumityolcu
Copy link
Collaborator

@gumityolcu gumityolcu commented Jun 12, 2024

Hi Dilya,

I made small fixes in the model randomization metric :

1- The state_dict for the metric now includes state_dict of the randomized model
2- I opted not to use make_func because I don't exactly understand why but functools.partial doesn't work for me. I think you have to fix parameters starting from the final parameter, which means it's not very useful imo. Specifically the code below does not work:

from functools import partial


def orig(one, two, three, four):
    print(one)
    print(two)
    print(three)
    print(four)


part = partial(orig, one=1, three=3)

part(23, 23)

@gumityolcu gumityolcu requested a review from dilyabareeva June 12, 2024 17:32
@dilyabareeva
Copy link
Owner

Hi @gumityolcu, it doesn't work because you are supposed to use keyword arguments like this:

part(two=23, four=23)

@dilyabareeva
Copy link
Owner

on that topic, it would be a good practice to use keyword arguments everywhere, because it makes the code more readable and easier to debug. I'm not super consistent on this either, but I think we should get into the habit!

@gumityolcu
Copy link
Collaborator Author

Hi @gumityolcu, it doesn't work because you are supposed to use keyword arguments like this:

part(two=23, four=23)

I actually prefer that and that's the first thing I wrote initially. Now I figured out that we had a miniscule bug in make_func 👍🏼

So now i fixed that (i added 2 characters but you should still check to quickly make sure)
I integrated make_func into the metric. I added a bunch of stuff to the state_dict to be able to save and load the exact same object.

Finally, I noticed that I never gave the seed to the generator object so i fixed that (and the relevant functionality in saving and loading state_dicts)

@dilyabareeva
Copy link
Owner

I'd say ready to merge!

@gumityolcu gumityolcu merged commit 251501d into main Jun 13, 2024
2 checks passed
@dilyabareeva dilyabareeva deleted the randomization_fix branch June 20, 2024 09:35
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.

2 participants