- 
                Notifications
    You must be signed in to change notification settings 
- Fork 59
Implement DPM Solver Multistep Scheduler #22
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
Conversation
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 the PR, looks neat!
Could you give a bit more details about how this was tested, if it's expected to be fully in line with the python version etc?
| } | ||
|  | ||
| pub fn step(&mut self, model_output: &Tensor, timestep: usize, sample: &Tensor) -> Tensor { | ||
| #[rustfmt::skip] | 
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.
Very cosmetic but could you avoid overriding the rustfmt setting? It's never the case in this or the tch crate and even if it might look weird at some point (and I would personally dislike some formatting), it makes things much easier if someone else edits the code.
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.
Sure, I did it to leave the chain of calls on multiple lines, otherwise rustfmt would force me to put everything on one line. If you don't like it, I will fix this in the next commit :)
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.
Well I really don't mind the format one way or another, I'm just opiniated towards avoiding manual formatting and so going to whatever rustfmt decides (and again I might certainly dislike some of the outputs but it's great not to have to think about manual formatting anymore :) ).
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.
Is there any way to keep this format without the action failing ?
Otherwise I will just accept the format enforced by rustfmt, it ain't a big deal after all :)
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.
Yeah I would just go with what rusfmt suggests.
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.
Sure :)
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.
Sorry, maybe I missed something but the rustfmt skip seems to still be there? (once it has been removed/reformatted, happy to merge)
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 just committed. Hope it contains everything we discussed. Let me know if I missed anything :)
| I just noticed I missed your first question. I "tested" the implementation using the snippet I shared with you in my last PR (changing the scheduler, clearly :)). | 
| Good, could you maybe add a few permalink to the python version in the scheduler code? This is nice for people that would want to see how the code was converted. | 
| Sure, is there a specific part you suggest to "annotate" with a permalink ? | 
* remove rustfmt:skip * add permalinks to the python implementation * re-run rustfmt
| Not sure why one of the checks failed. Seems the classic error one gets when  | 
| Rerunning fixed indeed this test, I've merged the changes, thanks for the PR! | 
Hi,
this PR aims at integrating the DPM Solver Multistep Scheduler in this Rust version, as requested in #17 .
A couple of disclaimers:
the implementation contains all the features of the Python version, but the optional
thresholding, described in this paper. I plan to add it in a future PR, if you agree.I don't like the initialization of
model_outputs. Unfortunatelytch::Tensordoesn't implement theCopytrait, so I couldn't find a leaner way. Feel free to leave a suggestion if you have a better idea!differently from the other two schedulers, the
stepmethod requiresselfto be mutable as I need to update the attributemodel_outputs.Therefore, to run the examples, make sure to create a
mutscheduler:and to call
to_ownedwhen iterating over the timesteps (e.g. here):Cheers 😄 .