pytorch / pytorch/vision

Split _validate_trainable_layers into validator and num_of_layers selector

Open
#4,625 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

code quality module: models
Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

We use _validate_trainable_layers as a validator but also as a way to determine the actual number of trainable layers based on default values, pertained flag etc.

  • It would be clearer to have separate checks for validation and another method to set the actual value instead of having a checker with side effects.
  • Check if it makes sense to add the default value as a parameter default value instead of None?
  • Should we use ValueError exception instead of assert?

cc @jdsgomes

cc @datumbox

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in torchvision/models/detection/backbone_utils.py at _validate_trainable_layers and trace how its validation and trainable-layer selection behavior are used. Separate validation from selecting the actual layer count, and resolve the listed questions about the default parameter and ValueError versus assert.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.