Skip to content

Rename variables from single letter to better naming #198

Closed

Description

@patrickvonplaten

Pretty much all code in https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/resnet.py still corresponds to the copy-pasted version from the beginning.

While weight names shouldn't be renamed, we should rename all single letter variables to more explicit variable naming. E.g. h -> hidden_states.

Single letter variables are hard to deal with as search and replace doesn't work on them and are hard to read

Activity

  1. patrickvonplaten commented on Aug 17, 2022

    @patrickvonplaten
    ContributorAuthor

    Also maybe @anton-l if you'd like

  2. patrickvonplaten commented on Aug 19, 2022

    @patrickvonplaten
    ContributorAuthor

    That would be great @antival3nt 😍

  3. rashmimarganiatgithub commented on Sep 1, 2022

    @rashmimarganiatgithub
    Contributor

    @patrickvonplaten , please assign to me.

  4. patrickvonplaten commented on Sep 2, 2022

    @patrickvonplaten
    ContributorAuthor

    Feel free to take it @rashmimarganiatgithub - all yours! Generally as soon as someone opens a PR for an issue, we try to work together on this PR

  5. daspartho commented on Sep 8, 2022

    @daspartho
    Contributor

    Hi @patrickvonplaten
    I'd be happy to work on any other variable names that need to be renamed.

  6. patil-suraj commented on Sep 9, 2022

    @patil-suraj
    Contributor

    Hey @daspartho ! Awesome, there are some single letter variables in attention.py file, feel free to work on those if you want. I'm listing the places that needs change below.

    def forward(self, x, context=None):

    def forward(self, x, context=None):

    def forward(self, x):

    def forward(self, x):

  7. daspartho commented on Sep 9, 2022

    @daspartho
    Contributor

    Hi @patil-suraj
    Thank you for pointing out the necessary changes; I'll work on it.
    I'm just not sure what the exact variable name for the single-letter variables should be. Can you please help me?
    Thanks :)

  8. rashmimarganiatgithub commented on Sep 9, 2022

    @rashmimarganiatgithub
    Contributor

    @daspartho ,q, k, v can be replaced with query,key,value. b, c, h, w can be replaced with batch,channel,height,weight .

  9. daspartho commented on Sep 9, 2022

    @daspartho
    Contributor

    Thank you for clarifying, @rashmimarganiatgithub. I'll start a PR soon.

  10. daspartho commented on Sep 9, 2022

    @daspartho
    Contributor

    I've opened a PR for the issue :) #449

  11. daspartho commented on Sep 11, 2022

    @daspartho
    Contributor

    Hi @patil-suraj
    I'd be happy to work on any additional files that require changes.

  12. i-am-epic commented on Sep 27, 2022

    @i-am-epic
    Contributor

    Hi @patil-suraj , @patrickvonplaten
    I would like to help with other files for better variable name changes.

  13. i-am-epic commented on Sep 29, 2022

    @i-am-epic
    Contributor

    Hi @patil-suraj,
    Thank you for pointing out the changes; I'll work on it.
    I'm not sure my naming analogy is perfect.
    correct me with better naming convention,
    x as parameter in forward function will be input_tensor and it returns output_tensor (and based on upsample, downsample or padding x can be upsample_input,downsample_input, padded_input).

  14. daspartho commented on Sep 29, 2022

    @daspartho
    Contributor

    Opened a PR for the issue :) #676
    I hope @i-am-epic doesn't mind me jumping in.

  15. i-am-epic commented on Sep 29, 2022

    @i-am-epic
    Contributor

    @daspartho no issues it would had been my first contribution.

  16. daspartho commented on Sep 29, 2022

    @daspartho
    Contributor

    Hi! @i-am-epic,
    You could work on this one. Happy first contribution :)

    def forward(self, x, temb):

  17. i-am-epic commented on Sep 29, 2022

    @i-am-epic
    Contributor

    Hi! @i-am-epic, You could work on this one. Happy first contribution :)

    def forward(self, x, temb):

    @daspartho can u help me what's wrong in my pull request #677
    thanks :)

  18. i-am-epic commented on Sep 30, 2022

    @i-am-epic
    Contributor

    Opened new PR #677
    Please do verify, thanks.

  19. dgarnitz commented on May 6, 2023

    @dgarnitz

    Is this still open? I see there is a merged PR above. I can jump on it if it is still open

  20. SauravMaheshkar commented on Jun 25, 2023

    @SauravMaheshkar
    Contributor

    I raised #3868, fixing some of the last few remaining bits. Any ideas for appropriate names for the Temporal blocks viz. the variable name t ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions