-
Notifications
You must be signed in to change notification settings - Fork 7
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
Refactor stopping #1792
Refactor stopping #1792
Conversation
Hi @APJansen, some comments about the stopping refactoring. First of all, as you say, the stopping module is unnecessarily complicated. There were some plans for it and it was used for some side projects but as thing stands might as well be completely changed. The only important thing is that the final results are exactly identical, and by that I mean the files written at the end by the fit are the same (so the In this context there are a few situations that should be tested:
If you don't have runcards for these let me know and I can prepare them for you Just run these tests with (RE the writter module, same, as long as the output is the same you can do what you want with it. Btw, the reason the module feels a bit out of place is this line here which incidentally should be removed because we dropped compatibility some time ago and all that logic is now removed!) |
Hi @scarlehoff, great, thanks for the extra info! The chi2's are saved as well though in About the runcards to test, can I just take the basic runcard as the normal fit, and modify it in those 3 ways separately for the others? The first modification being |
That's a good question. Would this also work with the boolean positivity requirement?
Indeed
If I'm not mistaken the Since I'm somewhat out of the loop, what is the status of the different PRs?
|
@RoyStegeman An empty list being just a I'm just writing an issue describing recent developments and plans. I think indeed #1661 can be closed, #1788 is WIP and #1782 is even more WIP. This one I'll have another look today since it's been a while but yes it's done or nearly done, apart from some further testing. |
No a Regarding the rest - thanks, it would indeed be helpful to have an issue as a single place to keep track of the planning and various PRs related to this project. |
Ok thanks, I've got the 4 versions running on master, but this PR needs some work that I won't get to this week, I'll hopefully finish this next week and mark it as ready for review. |
Thanks for creating the issue, it's very clear. Sure, you can do everything at your own pace, it's your project :). I'll just wait till it's ready to review. |
Greetings from your nice fit 🤖 !
Check the report carefully, and please buy me a ☕ , or better, a GPU 😉! |
There's also the secondary problem of using frameworks other than tensorflow for the PDFs (for instance, the quantum PDFs using qibo). I'd avoid adding the tf dependency where is not explicitly needed. Unless there's a clear advantage in terms of performance (at the end of the day, 99% of the fits and papers are done with tensorflow), in that case it's probably fine to add some inconveniences on the side projects. |
Sorry I forgot to add reviewers, is this ok to merge? |
I have started having a look at this but still needs a couple of hours/a day. |
I had a quick look and seems ok. I'll have to look in detail next week. Did you test some edge cases like no patience / no positivity / infinite patience ? Also, since you reshuffled a lot the stopping module, please remove any "dangling methods" or properties (maybe you did already ofc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did check the corner cases and in all instances the fits ran fine. I have requested very minor modifications which I think are worth addressing.
@Radonirinaunimi I've addressed all your comments, and reran the comparison. @scarlehoff the tests I did are as we discussed, I've documented them here. They all pass also after the last changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. I've left a few comments but they don't change anything fundamental.
Co-authored-by: Juan M. Cruz-Martinez <juacrumar@lairen.eu>
Co-authored-by: Juan M. Cruz-Martinez <juacrumar@lairen.eu>
Co-authored-by: Juan M. Cruz-Martinez <juacrumar@lairen.eu>
Thanks @scarlehoff, I implemented your comments, and checked that results are still identical. Is it ok to merge now? |
This simplifies the
stopping.py
module, reducing the number of classes and the coupling to the outside. It also rewrites theWriterWrapper
.I started looking at this because #1782 requires changes here, but the changes in this PR are purely a refactor that should do exactly the same.
Tests
I test this by running on this branch, renaming the output folder, running on master, and comparing the two. We only expect changes in the timing and versions.
I've tested with:
n3fit Basic_runcard_modified.yml 1 -r 5
n3fit Basic_runcard_modified.yml 4 -r 5
n3fit Basic_runcard_modified.yml 3
In all cases the only differences are the versions and the timings, the rest is identical.
Note I've modified the basic runcard to speed it up, increasing the learning rate so it stops quickly. I think it is still general enough for these tests, in the case with 5 replicas, the best epochs are 77, 72, 77, 72, 75, so not a degenerate case where coincidentally they're all equal or something.
Comments
WriterWrapper
is a class with one method, that gets initialized and immediately after the method gets called, and that's all that happens with it. So it could just as well have been a function. I left it as a class though because it was easier and I'm not sure if everyone will agree.ReplicaState
, and moved a lot of the functionality fromFitHistory
to the mainStopping
class. NowFitHistory
is essentially nothing more than a list of the 4th classFitState
, so perhaps I should remove that entirely, keeping onlyStopping
andFitState
.WriterWrapper
I needed both thepdf_model
itself and thepdf_instance
which is the model wrapped byN3PDF
. I got the former from the latter by accessing its attribute, but that is supposed to be private so need to clean that up.