Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: invalid syntax #176

Closed
wmkai opened this issue Jun 7, 2022 · 1 comment
Closed

SyntaxError: invalid syntax #176

wmkai opened this issue Jun 7, 2022 · 1 comment

Comments

@wmkai
Copy link

wmkai commented Jun 7, 2022

when I run SPOS on my own model, it shows the log. I don't know how to fix it. Can you help me check it out?

2022-06-07 16:38:16,092 - mmcls - INFO - initialize LinearClsHead with init_cfg {'type': 'Normal', 'layer': 'Linear', 'std': 0.01}     
Traceback (most recent call last):                                             
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/site-packages/yapf/yapflib/pytree_utils.py", line 119, in ParseCodeToTree
    tree = parser_driver.parse_string(code, debug=False)                      
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/lib2to3/pgen2/driver.py", line 103, in parse_string
    return self.parse_tokens(tokens, debug)     
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/lib2to3/pgen2/driver.py", line 71, in parse_tokens
    if p.addtoken(type, value, (prefix, start)):                               
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/lib2to3/pgen2/parse.py", line 162, in addtoken
    raise ParseError("bad input", type, value, context)                       
lib2to3.pgen2.parse.ParseError: bad input: type=20, value='<', context=('', (315, 36))                                                                                                

During handling of the above exception, another exception occurred:           
                                                                                                                                                               
Traceback (most recent call last):                                             
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/site-packages/yapf/yapflib/pytree_utils.py", line 125, in ParseCodeToTree
    tree = parser_driver.parse_string(code, debug=False)
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/lib2to3/pgen2/driver.py", line 103, in parse_string
    return self.parse_tokens(tokens, debug)                                   
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/lib2to3/pgen2/driver.py", line 71, in parse_tokens
    if p.addtoken(type, value, (prefix, start)):                                           
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/lib2to3/pgen2/parse.py", line 162, in addtoken                                                                          
    raise ParseError("bad input", type, value, context)                                    
lib2to3.pgen2.parse.ParseError: bad input: type=20, value='<', context=('', (315, 36))                                                                                                

During handling of the above exception, another exception occurred:                        

Traceback (most recent call last):           
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/site-packages/yapf/yapflib/yapf_api.py", line 183, in FormatCode                                                        
    tree = pytree_utils.ParseCodeToTree(unformatted_source)                                
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/site-packages/yapf/yapflib/pytree_utils.py", line 131, in ParseCodeToTree                                               
    raise e                                  
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/site-packages/yapf/yapflib/pytree_utils.py", line 129, in ParseCodeToTree                                               
    ast.parse(code)                          
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/ast.py", line 50, in parse                                                                                              
    return compile(source, filename, mode, flags,                                          
  File "<unknown>", line 315                 
    activations=<class 'torch.nn.modules.activation.ReLU'>),                               
                ^                            
SyntaxError: invalid syntax                  

During handling of the above exception, another exception occurred:

Traceback (most recent call last):           
  File "/home/tiger/code/mmrazor/tools/mmcls/train_mmcls.py", line 203, in <module>                                                                                                   
    main()                                   
  File "/home/tiger/code/mmrazor/tools/mmcls/train_mmcls.py", line 186, in main                                                                                                       
    config=cfg.pretty_text,                  
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/site-packages/mmcv/utils/config.py", line 508, in pretty_text                                                           
    text, _ = FormatCode(text, style_config=yapf_style, verify=True)                       
  File "/home/tiger/miniconda3/envs/open-mmlab/lib/python3.10/site-packages/yapf/yapflib/yapf_api.py", line 186, in FormatCode                                                        
    raise errors.YapfError(errors.FormatErrorMsg(e))                                       
yapf.yapflib.errors.YapfError: <unknown>:315:37: invalid syntax                            
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 718949) of binary: /home/tiger/miniconda3/envs/open-mmlab/bin/python
tools/mmcls/dist_train.sh: line 19: 718941 Segmentation fault      (core dumped) PYTHONPATH="$(dirname $0)/../..":$PYTHONPATH python -m torch.distributed.launch --nnodes=$NNODES --no
de_rank=$NODE_RANK --master_addr=$MASTER_ADDR --nproc_per_node=$GPUS --master_port=29501 $(dirname "$0")/train_mmcls.py $CONFIG --launcher pytorch ${@:3}
@wmkai wmkai closed this as completed Jun 7, 2022
@Cemm23333
Copy link

Can you tell how to solve it?

humu789 pushed a commit to humu789/mmrazor that referenced this issue Feb 13, 2023
Signed-off-by: del-zhenwu <zhenxiang0708@163.com>

Co-authored-by: del-zhenwu <zhenxiang0708@163.com>
humu789 pushed a commit to humu789/mmrazor that referenced this issue Feb 13, 2023
* Add files via upload

* Update how_to_support_new_backends.md

* Update how_to_support_new_backends.md

* Delete how_to_support_new_backends.md

* Add files via upload

* Update how_to_support_new_backends.md

* Update how_to_support_new_backends.md

* Update how_to_support_new_backends.md

* Update how_to_support_new_backends.md

* 麻了

* fix

* fix

* fix

* fix

* fix

* fix

* fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants