facebookresearch/ELF

AttributeError: module 'minirts' has no attribute 'ContextOptions'

alatyshe opened this issue · 10 comments

Get this error when try to run train_minirts.sh:

Warning: argument ValueMatcher/grad_clip_norm cannot be added. Skipped.
PID: 1952
========== 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=None,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 ============
Traceback (most recent call last):
  File "train.py", line 21, in <module>
    GC = env["game"].initialize()
  File "/home/ubuntu/arvi_dima/ELF/rts/engine/common_loader.py", line 144, in initialize
    co, GC, params = self._init_gc()
  File "/home/ubuntu/arvi_dima/ELF/rts/engine/common_loader.py", line 88, in _init_gc
    co = self.module.ContextOptions()
AttributeError: module 'minirts' has no attribute 'ContextOptions'

Can somebody help please with it?

Download miniconda and install.

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $HOME/miniconda.sh
/bin/bash $HOME/miniconda.sh -b
$HOME/miniconda3/bin/conda update -y --all python=3

Add the following to ~/.bash_profile (if you haven't already) and source it:

export PATH=$HOME/miniconda3/bin:$PATH

Create a new conda environment and install the necessary packages:

conda create -n elf python=3
source activate elf

If you use cuda 8.0, try conda install pytorch cuda80 -c soumith

conda install pytorch -c soumith

pip install --upgrade pip
pip install msgpack_numpy
conda install tqdm
conda install libgcc

Install cmake >= 3.8 and gcc >= 4.9

This is platform-dependent.

If you use AWS, you can just skip this.

Install tbb

For ubuntu

sudo apt-get install libtbb-dev

For Fedora / CentOS

sudo yum install libtbb-devel

Clone and build the repository:

cd ~
git clone https://github.com/facebookresearch/ELF
cd ELF/rts/
mkdir build && cd build
cmake .. -DPYTHON_EXECUTABLE=$HOME/miniconda3/bin/python -DGAME_DIR=../game_MC
make

Make sure that python3 is the alias of python

alias python3=$HOME/miniconda3/bin/python

Train the model

sh ./train_minirts.sh --gpu 0

At the front was the tutorial I followed, and at the training step, when I ran sh ./train_minirts.sh --gpu 0, it came out
Traceback (most recent call last):
File "train.py", line 19, in
env, all_args = load_env(os.environ, trainer=trainer, runner=runner)
File "/home/liu/ELF/rlpytorch/model_loader.py", line 109, in load_env
game = load_module(envs["game"]).Loader()
File "/home/liu/ELF/rlpytorch/model_loader.py", line 18, in load_module
module = import(os.path.basename(mod))
File "./rts/game_MC/game.py", line 7, in
import minirts
ModuleNotFoundError: No module named 'minirts'.
Have you met this problem or do you know how to solve it?

Lausichen, your solution here:
#1

thanks

@alatyshe hey!alatyshe,have you solved this problem? I come up with this same problem. really confused.

nope, i stack on it.

same problem bro @alatyshe , have you find any solutions? It seems that I'm not building the “minirst” module right, all I got is a folder with some cmake stuff in it.

Gaoee commented

Maybe you used different python version.
Try use the same version of python in these two comment:
conda create -n elf python=3
cmake .. -DPYTHON_EXECUTABLE=$HOME/miniconda3/bin/python

@alatyshe hey, have you solved this problem?I dont know how to do

@huzhanming16 Why not trying Leela.
It seems fb has quit this updating. Still, you can see many "TODO" in the code.

@fantianwen so no one solved it?