lightly-ai / lightly-ai/lightly

Mypy is failing while checking finetune_eval.py

Open
#1,733 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.8k
Forks
367
Avg merge
3d 22h
Merged PRs (30d)
5

Description

As long as there is duplicated naming of finetune_eval in `benchmarks/imagenet/resnet50/finetune_eval.py` and `benchmarks/imagenet/vitb16/finetune_eval.py` mypy throws an exception when running `pre-commit run --all-files`:

```plaintext
benchmarks/imagenet/vitb16/finetune_eval.py: error: Duplicate module named "finetune_eval" (also at "benchmarks/imagenet/resnet50/finetune_eval.py")
benchmarks/imagenet/vitb16/finetune_eval.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
benchmarks/imagenet/vitb16/finetune_eval.py: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH
Found 1 error in 1 file (errors prevented further checking)
```

There are 3 solutions:
- Change the namings;
- Add __init__.py to form packages;
- Add the workaround to contributing manual.

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 with benchmarks/imagenet/resnet50/finetune_eval.py and benchmarks/imagenet/vitb16/finetune_eval.py, then run `pre-commit run --all-files` to reproduce the duplicate-module error. Review the three resolutions listed in the issue and the contributing manual before choosing one. Done means the duplicate mypy error is resolved and the pre-commit check completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.