{"action":"closed","issue":{"url":"https://api.github.com/repos/xinntao/BasicSR/issues/37","repository_url":"https://api.github.com/repos/xinntao/BasicSR","labels_url":"https://api.github.com/repos/xinntao/BasicSR/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/xinntao/BasicSR/issues/37/comments","events_url":"https://api.github.com/repos/xinntao/BasicSR/issues/37/events","html_url":"https://github.com/xinntao/BasicSR/issues/37","id":384738021,"node_id":"MDU6SXNzdWUzODQ3MzgwMjE=","number":37,"title":"Local variable 'val_loader' referenced before assignment when training with train_sr.json","user":{"login":"Nimmerwoner","id":1112446,"node_id":"MDQ6VXNlcjExMTI0NDY=","avatar_url":"https://avatars2.githubusercontent.com/u/1112446?v=4","gravatar_id":"","url":"https://api.github.com/users/Nimmerwoner","html_url":"https://github.com/Nimmerwoner","followers_url":"https://api.github.com/users/Nimmerwoner/followers","following_url":"https://api.github.com/users/Nimmerwoner/following{/other_user}","gists_url":"https://api.github.com/users/Nimmerwoner/gists{/gist_id}","starred_url":"https://api.github.com/users/Nimmerwoner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nimmerwoner/subscriptions","organizations_url":"https://api.github.com/users/Nimmerwoner/orgs","repos_url":"https://api.github.com/users/Nimmerwoner/repos","events_url":"https://api.github.com/users/Nimmerwoner/events{/privacy}","received_events_url":"https://api.github.com/users/Nimmerwoner/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-27T10:59:38Z","updated_at":"2018-11-27T11:39:19Z","closed_at":"2018-11-27T11:39:19Z","author_association":"NONE","body":"Hello,\r\n\r\nI encounter the error `UnboundLocalError: local variable 'val_loader' referenced before assignment` when trying to train SR. The execution command is `python train.py -opt options/train/train_sr.json`.\r\n\r\nDo any one have an idea why this happens?\r\n\r\nThe full output and error is as follows and is encountered after iteration 8 in the validation phase:\r\n\r\n```export CUDA_VISIBLE_DEVICES=0,1,2,3\r\nPath already exists. Rename it to [/home/.../.../basicsr-xinntao/experiments/debug_001_RRDB_PSNR_x4_DIV2K_archived_181127-104642]\r\nRandom Seed:  0\r\nDataset [LRHRDataset - Sobolt] is created.\r\nNumber of train images: 9,687, iters: 606\r\nTotal epoches needed: 1651 for iters 1,000,000\r\ninitialization method [kaiming]\r\n---------- Model initialized ------------------\r\nNumber of parameters in G: 16,697,987\r\n-----------------------------------------\r\nModel [SRModel] is created.\r\n---------- Start training -------------\r\n/opt/anaconda3/lib/python3.6/site-packages/torch/nn/modules/upsampling.py:122: UserWarning: nn.Upsampling is deprecated. Use nn.functional.interpolate instead.\r\n  warnings.warn(\"nn.Upsampling is deprecated. Use nn.functional.interpolate instead.\")\r\n<epoch:  0, iter:       2, time:1.31, lr:2.0e-04> l_pix: 4.21e-01\r\n<epoch:  0, iter:       4, time:1.24, lr:2.0e-04> l_pix: 3.85e-01\r\n<epoch:  0, iter:       6, time:1.24, lr:2.0e-04> l_pix: 3.41e-01 \r\n<epoch:  0, iter:       8, time:1.25, lr:2.0e-04> l_pix: 2.01e-01 \r\nSaving the model at the end of iter 8.\r\n---------- validation -------------\r\nTraceback (most recent call last):\r\n  File \"train.py\", line 156, in <module>\r\n    main()\r\n  File \"train.py\", line 106, in main\r\n    for val_data in val_loader:\r\nUnboundLocalError: local variable 'val_loader' referenced before assignment\r\n```\r\n\r\nI am using 4 GPUs, a batch_size of 16 with 8 n_workers and an HR_size of 512.\r\n\r\nAny help is appreciated."}}
{"actor":{"display_login":"Nimmerwoner"}}