-
Notifications
You must be signed in to change notification settings - Fork 68
torch.utils.data failing probably due to atexit issues #1056
Comments
I have a similar issue. VS Code version: Code 1.29. and 1.30
and i add the register code ,it's not solved |
I found this workaround to resolve this issue: https://stackoverflow.com/questions/53660465/vscode-bug-with-pytorch-dataloader |
I am experiencing a similar problem with the MxNet DL framework: When I invoke a gluon.data.DataLoader with
|
isn't there any progress for this issue? I have the same problem. |
As a note, right now it's not possible to use the debugger for subprocesses on Linux on Python 2.7 because fork is not supported (I'm just guessing here, but if num_workers==0 makes it work, that's probably what's happening). Related issue: #943 |
I am using python 3.6 on Ubuntu 18.04 and has the SAME problem. |
On Python 3.6 you have to put the code below at the start of your code:
to set it not to use fork... can you try that to see if it fixes it for you? |
WOW! It works! |
It works because instead of having multiprocess use This issue (supporting fork in the debugger) is being tracked in #943, so, closing this one as a duplicate. |
i also put this code at the start of my code import multiprocessing
multiprocessing.set_start_method('spawn', True) but
|
It works for me, thank you so much for sharing this simple and effective solution |
I had the same issue, that it would just raise the exception with the |
@MaxxRe3 This occurs if the spwan happens before the main is fully loaded. you may have to reorganize your code a bit like below. def main():
# your code here
if __name__ == '__main__':
main() for example: import multiprocessing
import concurrent.futures
FIBS = [28, 10]
def fib(n):
print(n)
if n < 2:
return 1
return fib(n - 1) + fib(n - 2)
def main():
multiprocessing.set_start_method('spawn', True)
with concurrent.futures.ProcessPoolExecutor() as executor:
executor.map(fib, FIBS)
if __name__ == '__main__':
main() Update: changed example based on comment by @int19h below. |
Note that |
microsoft/vscode-python#3439
torch.utils.data
registers anatexit
callback. The output in the original issue suggests there's something not being handled quite right in this instance.The text was updated successfully, but these errors were encountered: