question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RecursionError: maximum recursion depth exceeded while calling a Python object

See original GitHub issue

when train on 18epoch, it would report error:

Traceback (most recent call last):
  File "train.py", line 396, in <module>
    train_model(args)
  File "train.py", line 213, in train_model
    lossTr, lr = train(args, trainLoader, model, criteria, optimizer, epoch)
  File "train.py", line 328, in train
    optimizer.step()
  File "/home/lgq/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/optim/lr_scheduler.py", line 36, in wrapper
    return func(*args, **kwargs)
  File "/home/lgq/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/optim/lr_scheduler.py", line 36, in wrapper
    return func(*args, **kwargs)
  File "/home/lgq/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/optim/lr_scheduler.py", line 36, in wrapper
    return func(*args, **kwargs)
  [Previous line repeated 991 more times]
  File "/home/lgq/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/optim/adam.py", line 69, in step
    state = self.state[p]
  File "/home/lgq/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/tensor.py", line 393, in __hash__
    return id(self)
RecursionError: maximum recursion depth exceeded while calling a Python object

I found that you put WarmupPolyLR in every iters, it would make every iter call WarmupPolyLR, maybe it cause the error.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
dronefreakcommented, Apr 18, 2020

Hi @lgqfhwy Were you able to resolve this issue because I am facing it as of now. Please let me know your workaround. I did try increasing the max recursion depth by using the sys library in python, but it still gets stuck at th 9th epoch for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

maximum recursion depth exceeded while calling a Python ...
This means that each call to your recursive function will create a function call stack and because there is a limit of stack...
Read more >
Python RecursionError: Maximum Recursion Depth Exceeded ...
A Python RecursionError exception is raised when the execution of your program exceeds the recursion limit of the Python interpreter.
Read more >
Python maximum recursion depth exceeded in comparison
The “maximum recursion depth exceeded in comparison” error is raised when you try to execute a function that exceeds Python's built in recursion ......
Read more >
maximum recursion depth exceeded while calling a Python ...
When the interpreter detects that the maximum depth for recursion has reached, it throws the recursionerror ...
Read more >
Python: Maximum Recursion Depth Exceeded [How to Fix It]
The maximum recursion depth in Python is 1000. To check it, call sys.getrecursionlimit() function. To change it, call sys.setrecursionlimit().
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found