Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

TypeError: cuda() got an unexpected keyword argument 'device_id' #120

Open
VictorLeeLk opened this issue Nov 26, 2018 · 1 comment
Open

Comments

@VictorLeeLk
Copy link

VictorLeeLk commented Nov 26, 2018

Hi,when I run the command sh ./train_minirts.sh --gpu 0,I got this problem.
`Warning: argument ValueMatcher/grad_clip_norm cannot be added. Skipped.
PID: 51523
========== Args ============
Loader: handicap_level=0,players="type=AI_NN,fs=50,args=backup/AI_SIMPLE|start/500|decay/0.99;type=AI_SIMPLE,fs=20",max_tick=30000,shuffle_player=False,num_frames_in_state=1,max_unit_cmd=1,seed=0,actor_only=False,model_no_spatial=False,save_replay_prefix=None,output_file=None,cmd_dumper_prefix=None,gpu=0,use_unit_action=False,disable_time_decay=False,use_prev_units=False,attach_complete_info=False,feature_type="ORIGINAL"
ContextArgs: num_games=1024,batchsize=128,game_multi=None,T=20,eval=False,wait_per_group=False,num_collectors=0,verbose_comm=False,verbose_collector=False,mcts_threads=0,mcts_rollout_per_thread=1,mcts_verbose=False,mcts_save_tree_filename="",mcts_verbose_time=False,mcts_use_prior=False,mcts_pseudo_games=0,mcts_pick_method="most_visited"
MoreLabels: additional_labels="id,last_terminal"
ActorCritic:
PolicyGradient: entropy_ratio=0.01,grad_clip_norm=None,min_prob=1e-06,ratio_clamp=10,policy_action_nodes="pi,a"
DiscountedReward: discount=0.99
ValueMatcher: grad_clip_norm=None,value_node="V"
Sampler: sample_policy="epsilon-greedy",greedy=False,epsilon=0.0,sample_nodes="pi,a"
ModelLoader: load=None,onload=None,omit_keys=None,arch="ccpccp;-,64,64,64,-"
ModelInterface: opt_method="adam",lr=0.001,adam_eps=0.001
Trainer: freq_update=1
Evaluator: keys_in_reply="V"
Stats: trainer_stats="winrate"
ModelSaver: record_dir="./record",save_prefix="save",save_dir="./",latest_symlink="latest"
SingleProcessRun: num_minibatch=5000,num_episode=10000,tqdm=True
========== End of Args ============
Options:
Map: 20 by 20
Handicap: 0
Max tick: 30000
Max #Unit Cmd: 1
Seed: 0
Shuffled: False
[name=][fs=50][type=AI_NN][FoW=True][#frames_in_state=1][args=backup/AI_SIMPLE|start/500|decay/0.99]
[name=][fs=20][type=AI_SIMPLE][FoW=True][#frames_in_state=1]
Output_prompt_filename: ""
Cmd_dumper_prefix: ""
Save_replay_prefix: ""
ContextOptions:
#Game: 1024
#Max_thread: 0
#Collectors: 0
T: 20
Wait per group: False
Maximal #moves (0 = no constraint): 0
#Threads: 0
#Rollout per thread: 1
Verbose: False, Verbose_time: False
Use prior: False
Persistent tree: False
#Pseudo game: 0
Pick method: most_visited

Use time decay: True
Save prev seen units: False
Attach complete info: False

ORIGINAL
Version: 6a769a02dc0ab11e5a7633c337b5d3ce0d0bf511_GIT_UNSTAGED
Num Actions: 9
Num unittype: 6
num planes: 22
#recv_thread = 4
Group 0:
Collector[0] Batchsize: 128 Info: [gid=0][T=1][name=""]
Collector[1] Batchsize: 128 Info: [gid=1][T=1][name=""]
Collector[2] Batchsize: 128 Info: [gid=2][T=1][name=""]
Collector[3] Batchsize: 128 Info: [gid=3][T=1][name=""]
Group 1:
Collector[4] Batchsize: 128 Info: [gid=4][T=20][name=""]
Collector[5] Batchsize: 128 Info: [gid=5][T=20][name=""]
Collector[6] Batchsize: 128 Info: [gid=6][T=20][name=""]
Collector[7] Batchsize: 128 Info: [gid=7][T=20][name=""]

Traceback (most recent call last):
File "train.py", line 23, in
model = env["model_loaders"][0].load_model(GC.params)
File "/home/victorleelk/ELF/rlpytorch/model_loader.py", line 95, in load_model
model.cuda(device_id=args.gpu)
TypeError: cuda() got an unexpected keyword argument 'device_id'
`

my basic software versions are as follows:
`
cudatoolkit 9.0 h13b8566_0

cudnn 7.1.2 cuda9.0_0

python 3.6.7 h0371630_0

pytorch 0.4.1 py36_cuda9.0.176_cudnn7.1.2_1 soumith

torchvision 0.2.1 py36_0
`

what is the problem?how can I solve it?Thanks!

@lafmdp
Copy link

lafmdp commented Mar 18, 2019

Just remove device_id from model.cuda() with args.gpu remaining.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants