AttributeError: Can't get attribute 'train' on <module '__main__' (built-in)>
See original GitHub issuewandb --version && python --version && uname
- Weights and Biases version: wandb, version 0.8.31
- Python version: Python 3.6.7
- Operating System: Windows 10
Description
Running tutorial example fails. Link to the tutorial: https://colab.research.google.com/drive/181GCGp36_75C2zm7WLxr9U2QjMXXoibt
What I Did
Running tutorial example fails. Link to the tutorial: https://colab.research.google.com/drive/181GCGp36_75C2zm7WLxr9U2QjMXXoibt
The line with
wandb.agent(sweep_id, train)
Gives an error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\Admin\appdata\local\programs\python\python36\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd)
File "c:\users\Admin\appdata\local\programs\python\python36\lib\multiprocessing\spawn.py", line 115, in _main self = reduction.pickle.load(from_parent)
AttributeError: Can't get attribute 'train' on <module '__main__' (built-in)>
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Multiprocessing example giving AttributeError - Stack Overflow
When I run the above code I get an AttributeError: can't get attribute 'f' on <module '__main__' (built-in)> .
Read more >Can't get attribute 'train' on <module '__main__' (built ... - GitHub
I found out that the issue was with Jupyter Notebook (what I was using) not fully supporting multiprocessing. Haven't dug out the details,...
Read more >Can't get attribute 'label_func' on <module '__main__'>
AttributeError : Can't get attribute 'label_func' on <module '__main__'>. i am importing the function into my_project_api.py.
Read more >pickle.load can't get attribute python - You.com | The AI Search ...
This happens because the pickled data was saved when the script is run as __name__ == '__main__' and so it saves the location...
Read more >AttributeError: Can't get attribute 'video_dataset' on <module ...
I have a dataset that has been preprocessed, and this error continues to occur. I've tried the if__name___=='main _': method from several ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve encountered the same error using:
I found out that the issue was with Jupyter Notebook (what I was using) not fully supporting multiprocessing. Haven’t dug out the details, but a fix that made sweeps work was putting the
train
function definition in an outside .py file, and after that importing it into the notebook.Hey @Pavlov228 this is due to the
train
function not being defined. Did you run the cell that definedtrain
before callingwandb.agent
?