LTH14 / mar

PyTorch implementation of MAR+DiffLoss https://arxiv.org/abs/2406.11838
MIT License
967 stars 53 forks source link

Add HF integration to MAR #32

Closed jadechoghari closed 1 month ago

jadechoghari commented 1 month ago

Hello @LTH14 and team, Congratulations on this amazing work—MAR looks incredible! 🎉

You should consider adding MAR to the Hugging Face Hub 🤗. Doing so could increase the model's visibility and make it easier for everyone to use. It can easily be made compatible with the Hugging Face Transformers library.

I've already started the process (almost done 🚀), and other folks from HF will be available to help. You can check the progress here: https://huggingface.co/jadechoghari/mar

Soon, it will be easily usable with just one line of code. And will adda gradio demo as well!

Best regards, Jade

LTH14 commented 1 month ago

Hi Jade,

Thank you for your interest and support! We’re happy to see MAR being integrated into the Hugging Face library. Please feel free to let us know if there’s anything we can do to help.

jadechoghari commented 1 month ago

superb, I'll let you know if any issue is encountered.

Btw thanks so much for providing a notebook, it will help a lot!

jadechoghari commented 1 month ago

@LTH14 , everything is done 🎊: https://huggingface.co/jadechoghari/mar

Please confirm if anything needs to be changed before it is officially added to Hugging Face (ReadMe, Demo, etc...). A Gradio demo will be added soon!

LTH14 commented 1 month ago

Thank you very much! Everything looks perfect. Just two comments:

  1. you could add cfg_schedule as an option in the usage example. Two possible options are "constant" and "linear", and the default one to generate good images can be "constant".
  2. You could consider using "mar_huge" as default and use the images in the colab to replace the current one, so that the user can exactly reproduce the images image
jadechoghari commented 1 month ago

done! for any other updates if easier for you, you can just open a PR in my repo

LTH14 commented 1 month ago

Great! Also let me know when the Gradio demo is added, and I can add it to this repo also

jadechoghari commented 1 month ago

Of course!

jadechoghari commented 1 month ago

@LTH14 Gradio demo is done! 🤗 Check it out here: https://huggingface.co/spaces/jadechoghari/mar (running on A100s). Let u-s know if any changes are needed... Otherwise still waiting for MIT's HF org access approval. Also, will open a PR to add the HF model cards + Gradio demo to this repo if you want

Best!!

LTH14 commented 1 month ago

Thanks a lot! It looks awesome! One comment is that, if I change the number of images generated, the 50.8s progress bar seems unchanged -- is it possible to use the number of iterations instead of the progress bar?

I have already added the huggingface and Gradio demo to the Readme. Again, thanks a lot for supporting it!

LTH14 commented 1 month ago

Also -- what is "MIT's HF org access approval"?

jadechoghari commented 1 month ago

@LTH14 I believe Gradio averages the timestep after each use, which is why it's displayed on the progress bar. We could update the demo's README and mention the timesteps time, like: "64 steps = ~50 seconds." What do you think?

"Also -- what is "MIT's HF org access approval"?" -> we have an unofficial MIT org on HF (i thought it was official) : https://huggingface.co/MIT. It'd be great if your lab has any official org linked to MIT on HF, we could add it their & announce it!

LTH14 commented 1 month ago

Then I think we can just leave it there and don't need to add it to readme. After all, small batch generation is much slower per sample than large batch because the small diffusion MLP cannot fully use the GPU utility.

That one seems unofficial -- please don't link to that one. We don't have an official org yet -- once we have it we can link mar to it

jadechoghari commented 1 month ago

alright - it's actually super easy to setup an org! finally It would be great to have this demo app.py locally available on the repository and linked in the readme. For example, like for Stable-fast-3D here: https://github.com/Stability-AI/stable-fast-3d?tab=readme-ov-file#local-gradio-app

I'll open a PR for it so you see what I mean!

edit: forgot to cc @LTH14 :)

jadechoghari commented 1 month ago

i think all done here just this PR left before closing the issue @LTH14 🚀 :)