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

model.config.maxepoch #9

Open
shgal637 opened this issue Oct 14, 2021 · 3 comments
Open

model.config.maxepoch #9

shgal637 opened this issue Oct 14, 2021 · 3 comments
Labels
documentation Improvements or additions to documentation wontfix This will not be worked on

Comments

@shgal637
Copy link

After running "python3 bin/train.py -C mnist:rc2f2:ptripletN", I find model.config.maxepoch is 8. It's different from the experiment in the paper. It was written that the C2F2 model is trained with the Adam optimizer for 16 epochs. Then I notice the code "self.maxepoch //= 2" of rc2f2 function in configs_rank.py. I try to change the code as follows. It doesn't work, and model.config.maxepoch = 8 . How can I change the epoch into 16?
屏幕截图 2021-10-14 125610

Hope you can help me.
Thanks and Regards.

@cdluminate
Copy link
Owner

thank you for this question. In fact 8 epochs in the code is equivalent to 16 epochs in the paper. That's because the SPC-2 batch sampler will traverse the whole dataset twice every epoch, see https://github.com/cdluminate/robrank/blob/main/robrank/datasets/mnist.py#L124 .

Firstly you can see that dataloader will traverse the whole dataset through __getitem__, and the sample at index will be used as the anchor. Besides, a positive sample is obtained independently, which means we have sampled twice of the data we are expected to sample in every epoch. In that sense, an epoch of SPC-2 data is equivalent to 2 epochs for classification. This is a fixable minor problem, but not necessary to fix.

@cdluminate
Copy link
Owner

cdluminate commented Oct 14, 2021

Just as what I have written in the comment: max epoch means epochs with classification batch, which equals 2 times the epochs with spc-2 batchs. If you really want to change maxepoch, the code snippet on the screenshot is indeed the variable to change. Maybe you have tried to python3 setup.py install before changing the configuration, and your following experiments just imported the old config instead of the new one under your current working directory. python3 setup.py install is not recommended if you want to change the code and do some further development work, or you will have to install again and again after every code change due to python import order.

@cdluminate cdluminate added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 14, 2021
@shgal637
Copy link
Author

Thank you for your answer!

@cdluminate cdluminate added wontfix This will not be worked on and removed enhancement New feature or request labels May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants