wandb / client-ng

Experimental wandb CLI and Python API - See Experimental section below.
http://wandb.com
16 stars 7 forks source link

0.0.23 - compatibility - windows/sweep-python-api does not work #8

Open raubitsj opened 4 years ago

raubitsj commented 4 years ago

Reproduce:

(base) jeff@WBONE-WIN C:\Users\jeff\work>python                                                                                                                                                 
Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32                                                                                            
Type "help", "copyright", "credits" or "license" for more information.                                                                                                                          
>>> import wandb                                                                                                                                                                                
>>> sweep_config = {                                                                                                                                                                            
...   "name": "My Sweep",                                                                                                                                                                       
...   "method": "grid",                                                                                                                                                                         
...   "parameters": {                                                                                                                                                                           
...         "parameter1": {                                                                                                                                                                     
...             "values": [1, 2, 3]                                                                                                                                                             
...         }                                                                                                                                                                                   
...     }                                                                                                                                                                                       
... }                                                                                                                                                                                           
>>>                                                                                                                                                                                             
>>> sweep_id = wandb.sweep(sweep_config)                                                                                                                                                        
Create sweep with ID: kqt0lt4t                                                                                                                                                                  
Sweep URL: https://app.wandb.ai/jhr/uncategorized/sweeps/kqt0lt4t                                                                                                                               
>>> import time                                                                                                                                                                                 
>>>                                                                                                                                                                                             
>>> def train():                                                                                                                                                                                
...     run = wandb.init()                                                                                                                                                                      
...     print("config:", dict(run.config))                                                                                                                                                      
...     for epoch in range(35):                                                                                                                                                                 
...         print("running", epoch)                                                                                                                                                             
...         wandb.log({"metric": run.config.param1, "epoch": epoch})                                                                                                                            
...         time.sleep(1)                                                                                                                                                                       
...                                                                                                                                                                                             
>>> wandb.agent(sweep_id, function=train)                                                                                                                                                       
2020-05-21 15:42:49,714 - wandb.wandb_agent - INFO - Running runs: []                                                                                                                           
2020-05-21 15:42:49,902 - wandb.wandb_agent - INFO - Agent received command: run                                                                                                                
2020-05-21 15:42:49,902 - wandb.wandb_agent - INFO - Agent starting run with config:                                                                                                            
        parameter1: 1                                                                                                                                                                           
Traceback (most recent call last):                                                                                                                                                              
  File "<string>", line 1, in <module>                                                                                                                                                          
  File "C:\Users\jeff\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main                                                                                                          
    exitcode = _main(fd)                                                                                                                                                                        
  File "C:\Users\jeff\Anaconda3\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)>                                                                                                                   
2020-05-21 15:42:54,995 - wandb.wandb_agent - INFO - Running runs: ['0jq4hb5p']                                                                                                                 
wandb: Ctrl-c pressed. Waiting for runs to end. Press ctrl-c again to terminate them.                                                                                                           
wandb: Terminating and syncing runs. Press ctrl-c to kill.