Skip to content

[Community Event] Docstring Sprint #26638

Description

@ydshieh

Docstring is important to understand what inputs a function/method expect and the output format it returns !

This issue is part of the HACKTOBERFEST event 🔥 . It is a call for contributions with the goal being to help transformers having the required and correct docstring, so users can use it more smoothly.

Adding/Fixing a docstring is a simple (possibly first) contribution to Transformers and most importantly a very important contribution to the Transformers community ❤️ .

If you're interested in making a (maybe first!) contribution, please read through the Guide to contributing below. Before starting work on it, please reply in this thread which file you'd like to take :)

An example of such PR.

Guide to contributing:

  1. Ensure you've read our contributing guidelines 📜
  2. Be sure you installed the development dependencies with pip install -e ".[dev]", as described in the contributor guidelines above, to ensure that the code quality tools in make fixup can run.
  3. Look at the file utils/check_docstrings.py:
    • find the line OBJECTS_TO_IGNORE =
    • choose a name in the list OBJECTS_TO_IGNORE (make sure it is not taken yet by someone in the comments of this issue)
    • Claim the entry in this thread (confirm no one is working on it) 🎯
    • Let's select one single entry for a PR, or at most the entries from the same model architecture (its config/tokenizer/model/processor objects)
  4. Remove the selected item (in step 3.) from OBJECTS_TO_IGNORE
    • commit the changes
  5. run python3 utils/check_docstrings.py --fix_and_overwrite
    • You might see something like:
      • Screenshot 2023-10-06 174057
    • commit the changes
  6. fill information where <fill_type> or <fill_docstring> appear:
    • you can usually find the content to fill from other files (by searching the codebase)

    • compared to step 5.), the output now looks like:

      • Screenshot 2023-10-06 182359
    • commit the changes

  7. run utils/check_docstrings.py
    • make sure nothing change. Otherwise further work is required.
  8. run make fixup
  9. Open the PR
    • with the title having format [docstring] ... (entry name you work on) ...
    • wait CI to be green
    • otherwise, try to fix the failing tests if possible 🙏 . If necessary, ping me for helping on this.

Looking forward to your contributions 🔥 ❤️ 🚀 !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions