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

[WIP] added cycleGAN notebook! #175

Merged
merged 6 commits into from
Jun 28, 2024
Merged

Conversation

charchit7
Copy link
Contributor

Hey everyone!

This PR adds CycleGAN Notebook!
Currently training the model is left.

Part of #28
Also, discussed in #158

Please take a look!
@johko @MKhalusova @merveenoyan

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@@ -0,0 +1,956 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove step prefixes here so it's easier to read :)


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, doing it now. Sorry for delay.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unaddressed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@@ -0,0 +1,956 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to upload this dataset from Hub and load it from there? so when the link is broken this notebook doesn't break as well.


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if you could use load_datasethttps://huggingface.co/docs/datasets/en/loading

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to using load_dataset

@@ -0,0 +1,956 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure you'd need this once this is loaded as HF dataset :)


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to figure out how to make this work with loading as Huggingface dataset, so this section is still needed. The best I could do was to download the dataset from Huggingface as a .zip

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you don't put the dataset to zip format (any other format works), it will automatically, converting it to parquet and you'd be able to load it

Copy link
Contributor

@klyap klyap Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried this with load_dataset as suggested but ran into issues - it fails in the train function.

Can you help take a look at my implementation / suggest changes I can try? https://colab.research.google.com/drive/1f328yVbuZmBjQRQhfOnC2QtrDFtCrXe_?usp=sharing

@@ -0,0 +1,956 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great visual!!!


Reply via ReviewNB

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Merve!

Copy link
Contributor

@MKhalusova MKhalusova Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some context for the image? Explain what it illustrates? Also, it comes right after you define the function to plot images, which doesn't make sense to me. It would be better to place in the introduction to the tutorial.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the image and added context to it!

@@ -0,0 +1,956 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super sure but I felt like you could decouple many of the layers in forward into another function so in forward you just call that and return last activation (completely up to you)


Reply via ReviewNB

@@ -0,0 +1,956 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Losses*

no need to capitalize W


Reply via ReviewNB

@@ -0,0 +1,956 @@
{
Copy link
Collaborator

@merveenoyan merveenoyan Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of having a long docstring you could use the markdown


Reply via ReviewNB

@charchit7
Copy link
Contributor Author

charchit7 commented Jan 10, 2024

@hwaseem04 I left mostly formatting nits, otherwise it looks good!

Thanks @merveenoyan :)
I'll make the required changes.

I think you accidently tagged hwaseem04 😅

@merveenoyan
Copy link
Collaborator

ah sorry, removed.

@charchit7
Copy link
Contributor Author

@merveenoyan no problem at all. 🤗

@sitamgithub-MSIT
Copy link
Contributor

@merveenoyan It's been a week for this PR. Also, suggested changes are committed as well. Should I assign myself as the reviewer and do a community review for this?

@sitamgithub-MSIT sitamgithub-MSIT self-requested a review January 18, 2024 21:58
@merveenoyan
Copy link
Collaborator

@sitamgithub-MSIT hello, I don't see the changes incorporated unfortunately :/

@charchit7
Copy link
Contributor Author

@sitamgithub-MSIT I have yet to make changes.
@merveenoyan I had an accident last week and my right hand was cut a little. Will complete this by this weekend. Hope it's fine.

@johko
Copy link
Collaborator

johko commented Jan 19, 2024

no worries @charchit7, health definitely goes first

@@ -0,0 +1,956 @@
{
Copy link
Contributor

@MKhalusova MKhalusova Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this cell even needed?


Reply via ReviewNB

Copy link
Contributor

@klyap klyap Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for calling out that there were 2 versions of the Generator class. Deleted the unused one!

@@ -0,0 +1,956 @@
{
Copy link
Contributor

@MKhalusova MKhalusova Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #2.        ''' 

Looks like there was supposed to be a doctoring here.


Reply via ReviewNB

@@ -0,0 +1,956 @@
{
Copy link
Contributor

@MKhalusova MKhalusova Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line #60.    train()

After the training is finished, it would be nice to upload the model to Hub, and then show a quick inference example.


Reply via ReviewNB

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a section below that uploads to Hub, but I wasn't able to figure out how to use the model for inference!

- Using Huggingface hosted dataset and push model to Hub
- Use markdown instead of docstring
@klyap
Copy link
Contributor

klyap commented Jan 31, 2024

Hi! I'm helping @charchit7 out with wrapping up this PR and addressing review comments!

@charchit7
Copy link
Contributor Author

Thank you so much @klyap :)
Merve Et al. Please check :)

Copy link

review-notebook-app bot commented Feb 1, 2024

View / edit / reply to this conversation on ReviewNB

merveenoyan commented on 2024-02-01T07:43:33Z
----------------------------------------------------------------

just a small nit, can you also take the param names into single backtick to format them as code?


Copy link

review-notebook-app bot commented Feb 1, 2024

View / edit / reply to this conversation on ReviewNB

merveenoyan commented on 2024-02-01T07:43:34Z
----------------------------------------------------------------

If you put a gap between the # and the word it will be rendered properly


Copy link

review-notebook-app bot commented Feb 1, 2024

View / edit / reply to this conversation on ReviewNB

merveenoyan commented on 2024-02-01T07:43:35Z
----------------------------------------------------------------

Same here (for header rendering)


Copy link

review-notebook-app bot commented Feb 1, 2024

View / edit / reply to this conversation on ReviewNB

merveenoyan commented on 2024-02-01T07:43:35Z
----------------------------------------------------------------

you could do single upload_folder https://huggingface.co/docs/huggingface_hub/guides/upload#upload-a-folder


Copy link
Collaborator

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot @klyap for taking over this! 🦸‍♀️

@klyap
Copy link
Contributor

klyap commented Feb 4, 2024

Made formatting changes and also changed the upload step to just upload folder and not individual files!

@klyap
Copy link
Contributor

klyap commented Feb 13, 2024

lmk if you have other suggestions, @merveenoyan !

Copy link

review-notebook-app bot commented Feb 14, 2024

View / edit / reply to this conversation on ReviewNB

MKhalusova commented on 2024-02-14T13:51:55Z
----------------------------------------------------------------

"The below code downloads the zebra2horses dataset and places it in the same folder."


Copy link

review-notebook-app bot commented Feb 14, 2024

View / edit / reply to this conversation on ReviewNB

MKhalusova commented on 2024-02-14T13:51:56Z
----------------------------------------------------------------

Line #4.    # basic transforms

Is this comment really needed?


Copy link

review-notebook-app bot commented Feb 14, 2024

View / edit / reply to this conversation on ReviewNB

MKhalusova commented on 2024-02-14T13:51:57Z
----------------------------------------------------------------

Since you explain briefly what a residual block does, maybe also add a sentence or two about these other blocks.


Copy link

review-notebook-app bot commented Feb 14, 2024

View / edit / reply to this conversation on ReviewNB

MKhalusova commented on 2024-02-14T13:51:59Z
----------------------------------------------------------------

Line #73.    class FeatureMapBlock(nn.Module):

What does this type of block do?


@johko
Copy link
Collaborator

johko commented Mar 8, 2024

Hey @klyap, thanks for all the work you put in. It seems like the only thing that actually needs to be adressed now, is loading the dataset from the huggingface hub.
I'll have a look how to make that work

@johko
Copy link
Collaborator

johko commented Mar 25, 2024

@klyap and @charchit7 I created a PR to the branch in the repo you have been working on it -> hwaseem04#7
Not sure who has to review that, but it should contain all needed fixes, so we can finally merge this ;)

@charchit7
Copy link
Contributor Author

Hey @johko looks good to me :)

Copy link
Collaborator

@johko johko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @charchit7 , so from my side this one is finally ready to merge 🚀
Just need one last approval from @merveenoyan I guess

@johko johko merged commit 371b18d into huggingface:main Jun 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants