Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

I only changed one line! An unknown error occurred #358

Closed
junha1125 opened this issue Apr 8, 2021 · 1 comment
Closed

I only changed one line! An unknown error occurred #358

junha1125 opened this issue Apr 8, 2021 · 1 comment

Comments

@junha1125
Copy link

junha1125 commented Apr 8, 2021

1. what changes I made (git diff) or what code I wrote

diff --git a/models/detr.py b/models/detr.py
--- a/models/detr.py
+++ b/models/detr.py

-    num_classes = 20 if args.dataset_file != 'coco' else 91 
+    num_classes = 91 if args.dataset_file = 'coco' else 20 

2. what exact command I run:

python main.py \
	--batch_size 1\
        --no_aux_loss\
        --eval\
        --resume https://dl.fbaipublicfiles.com/detr/detr-r50-e632da11.pth
        --coco_path /workspace/coco 

3. what I observed (including full logs):

image

Exception has occurred: SyntaxError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
invalid syntax (detr.py, line 314)
  File "/workspace/models/__init__.py", line 2, in <module>
    from .detr import build
  File "/workspace/main.py", line 20, in <module>
    from models import build_model
  File "/opt/conda/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/conda/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/opt/conda/lib/python3.7/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/opt/conda/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/conda/lib/python3.7/runpy.py", line 193, in _run_module_as_main (Current frame)
    "__main__", mod_spec)

4. Explanation

I just changed a single line of code that had no problem at all in terms of meaning.
But I got an error I wouldn't know.

5. Expected behavior:

No bug, No error.

6. Environment:

I used dockerfile in this repo.
But before building dockerfile, I deleted the torch installation part from requirements.txt
in order to let my envronment have torch-cuda-version

Collecting environment information...
PyTorch version: 1.5.0+cu101
Is debug build: No
CUDA used to build PyTorch: 10.1

OS: Ubuntu 18.04.4 LTS
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
CMake version: Could not collect

Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: GeForce GTX TITAN Black
Nvidia driver version: 460.32.03
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.18.1
[pip3] torch==1.5.0+cu101
[pip3] torchvision==0.6.0+cu101
[conda] blas                      1.0                         mkl  
[conda] mkl                       2020.2                      256  
[conda] mkl-service               2.3.0            py37he8ac12f_0  
[conda] mkl_fft                   1.3.0            py37h54f3939_0  
[conda] mkl_random                1.1.1            py37h0573a6f_0  
[conda] torch                     1.5.0+cu101              pypi_0    pypi
[conda] torchvision               0.6.0+cu101              pypi_0    pypi
@junha1125 junha1125 changed the title Please read & provide the following I only changed one line! An unknown error occurred Apr 8, 2021
@alcinos
Copy link
Contributor

alcinos commented Apr 9, 2021

you wrote num_classes = 91 if args.dataset_file = 'coco' else 20 --> the comparison operator in wrong, in python equality is tested with ==

@alcinos alcinos closed this as completed Apr 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants