The mini-AlphaStar (mini-AS, or mAS) - mini-scale version (non-official) of the AlphaStar (AS)

Overview

mini-AlphaStar

Introduction

The mini-AlphaStar (mini-AS, or mAS) project is a mini-scale version (non-official) of the AlphaStar (AS). AlphaStar is the intelligent AI proposed by DeepMind to play StarCraft II.

The "mini-scale" means making the original AS's hyper-parameters adjustable so that mini-AS can be trained and running on a small scale. E.g., we can train this model in a single commercial server machine.

We referred to the "Occam's Razor Principle" when designing the mini-AS": simple is sound. Therefore, we build mini-AS from scratch. Unless the function significantly impacts speed and performance, we shall omit it.

Meanwhile, we also try not to use too many dependency packages so that mini-AS should only depend on the PyTorch. In this way, we simplify the learning cost of the mini-AS and make the architecture of mini-AS relatively easy.

The Chinese shows a simple readme in Chinese.

Below 4 GIFs are mini-AS' trained performance on Simple64, supervised learning on 50 expert replays.

Left: At the start of the game. Right: In the middle period of the game.

Left: The agent's 1st attack. Right: The agent's 2nd Attack.

Update

This release is the "v_1.07" version. In this version, we give an agent which grows from 0.016 to 0.5667 win rate against the level-2 built-in bot training by reinforcement learning. Other improvements are shown below:

  • Use mimic_forward to replace forward in "rl_unroll", which increase the training accuracy;
  • Make RL training supports multi-GPU now;
  • Make RL training supports multi-process training based on multi-GPU now;
  • Use new architecture for RL loss, which reduces 86% GPU memory;
  • Use new architecture for RL to increase the sampling speed by 6x faster;
  • Validate UPGO and V-trace loss again;
  • By a "multi-process plus multi-thread" training, increase the sampling speed more by 197%;
  • Fix the GPU memory leak and reduce the CPU memory leak;
  • Increase the RL training win rate (without units loss) on level-2 to 0.57!

Hints

Warning: SC2 is extremely difficult, and AlphaStar is also very complex. Even our project is a mini-AlphaStar, it has almost the similar technologies as AS, and the training resource also costs very high. We can hardly train mini-AS on a laptop. The recommended way is to use a commercial server with a GPU card and enough large memory and disk space. For someone interested in this project for the first time, we recommend you collect (star) this project and devolve deeply into researching it when you have enough free time and training resources.

Location

We store the codes and show videos in two places.

Codes location Result video location Usage
Github Youtube for global users
Gitee Bilibili for users in China

Contents

The table below shows the corresponding packages in the project.

Packages Content
alphastarmini.core.arch deep neural architecture
alphastarmini.core.sl supervised learning
alphastarmini.core.rl reinforcement learning
alphastarmini.core.ma multi-agent league traning
alphastarmini.lib lib functions
alphastarmini.third third party functions

Requirements

PyTorch >= 1.5, others please see requirements.txt.

Install

The SCRIPT Guide gives some commands to install PyTorch by conda (this will automatically install CUDA and cudnn, which is convenient).

E.g., like (to install PyTorch 1.5 with accompanied CUDA and cudnn):

conda create -n th_1_5 python=3.7 pytorch=1.5 -c pytorch

Next, activate the conda environment, like:

conda activate th_1_5

Then you can install other python packages by pip, e.g., the command in the below line:

pip install -r requirements.txt

Usage

After you have done all requirements, run the below python file to run the program:

python run.py

You may use comments and uncomments in "run.py" to select the training process you want.

The USAGE Guide provides answers to some problems and questions.

You should follow the following instructions to get results similar and/or better than the provided gifs on the main page.

The processing sequences can be summarised as the following:

  1. Transform replays: download the replays for training, then use the script in mAS to transform the replays to trainable data;
  2. Supervised learning: use the trainable data to supervise learning an initial model;
  3. Evaluate SL model: the trained SL model should be evaluated on the RL environment to make sure it behaves right;
  4. Reinforcement learning: use the trained SL model to do reinforcement learning in the SC environment, seeing the win rate starts growing.

We give detailed descriptions below.

Transofrm replays

In supervised learning, you first need to download SC2 replays.

The REPLAY Guide shows a guide to download these SC2 replays.

The ZHIHU Guide provides Chinese users who are not convenient to use Battle.net (outside China) a guide to download replays.

After downloading replays, you should move the replays to "./data/Replays/filtered_replays_1" (you can change the name in transform_replay_data.py).

Then use transform_replay_data.py to transform these replays to pickles or tensors (you can change the output type in the code of that file).

You don't need to run the transform_replay_data.py directly. Only run "run.py" is OK. Make the run.py has the following code

    # from alphastarmini.core.sl import transform_replay_data
    # transform_replay_data.test(on_server=P.on_server)

uncommented. Then you can directly run "run.py".

Note: To get the effect of the trained agent in the gifs, use the replays in Useful-Big-Resources. These replays are generatedy by our experts, to get an agent having the ability to win the built-in bot.

Supervised learning

After getting the trainable data (we use tensor data). Make the run.py has the following code

    # from alphastarmini.core.sl import sl_train_by_tensor
    # sl_train_by_tensor.test(on_server=P.on_server)

uncommented. Then you can directly run "run.py" to do supervised learning.

The default learning rate is 1e-4, and the training epochs should best be 10 (more epochs may cause the training effect overfitting).

From the v_1.05 version, we start to support multi-GPU supervised learning training for mini-AS, improving the training speed. The way to use multi-GPU training is straightforward, as follows:

python run_multi-gpu.py

Multi-GPU training has some unstable factors (caused because of PyTorch). If you find your multi-GPU training has training instability errors, please switch to the single-GPU training.

We currently support four types of supervised training, which all reside in the "alphastarmini.core.sl" package.

File Content
sl_train_by_pickle.py pickle (data not preprocessed) training: Slow, but need small disk space.
sl_train_by_tensor.py tensor (data preprocessed) training: Fast, but cost colossal disk space.
sl_multi_gpu_by_pickle.py multi-GPU, pickle training: It has a requirement need for large shared memory.
sl_multi_gpu_by_tensor.py multi-GPU, tensor training: It needs both large memory and large shared memory.

You can use the load_pickle.py to transform the generated pickles (in "./data/replay_data") to tensors (in "./data/replay_data_tensor").

Note: from v_1.06, we still recommend using single-GPU training. We provide the new training ways in the single-GPU type. This is due to multi-GPU training cost so much memory.

Evaluate SL model

After getting the supervised learning model. We should test the performance of the model in the SC2 environment this is due to there is domain shift from SL data and RL environment.

Make the run.py has the following code

    # from alphastarmini.core.rl import rl_eval_sl
    # rl_eval_sl.test(on_server=P.on_server)

uncommented. Then you can directly run "run.py" to do an evaluation of the SL model.

The evaluation is similar to RL training but the learning is closed and the running is single-thread and single-process, to make the randomness due to multi-thread not affect the evaluation.

Reinforcement learning

After making sure the supervised learning model is OK and suitable for RL training. We do RL training based on the learned supervised learning model.

Make the run.py has the following code

    # from alphastarmini.core.rl import rl_vs_inner_bot_mp
    # rl_vs_inner_bot_mp.test(on_server=P.on_server, replay_path=P.replay_path)

uncommented. Then you can directly run "run.py" to do reinforcement learning.

Note, this training will use a multi-process plus multi-thread RL training (to accelerate the learning speed), so make sure to run this codes on a high-performance computer.

E.g., we run 15 processes, and each process has 2 actor threads and 1 learner thread in a commercial server. If your computer is not strong as that, reduce the parallel and thread nums.

The learning rate should be very small (below 1e-5, because you are training on an initially trained model), and the training iterations should be as long as best (more training iterations can reduce the unstable of RL training).

If you find the training is not as like as you imagine, please open an issue to ask us or discuss with us (though we can not make sure to respond to it in time or there is a solution to every problem).

Results

Here are some illustration figures of the SL training process below:

SL training process

We can see the loss (one primary loss and six argument losses) fall quickly.

The trained behavior of the agents can be seen in the gifs on this page.

A more detailed illustration of the experiments (such as the effects of the different hyper-parameters) will be provided in our later paper.

History

The HISTORY is the historical introduction of the previous versions of mini-AS.

Citing

If you find our repository useful, please cite our project or the below technical report:

@misc{liu2021mAS,
  author = {Ruo{-}Ze Liu and Wenhai Wang and Yang Yu and Tong Lu},
  title = {mini-AlphaStar},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/liuruoze/mini-AlphaStar}},
}

The An Introduction of mini-AlphaStar is a technical report introducing the mini-AS (not full version).

@article{liu2021mASreport,
  author    = {Ruo{-}Ze Liu and
               Wenhai Wang and
               Yanjie Shen and
               Zhiqi Li and
               Yang Yu and
               Tong Lu},
  title     = {An Introduction of mini-AlphaStar},
  journal   = {CoRR},
  volume    = {abs/2104.06890},
  year      = {2021},
}

Rethinking

The Rethinking of AlphaStar is our thinking of the advantages and disadvantages of AlphaStar.

Paper

We will give a paper (which is now under peer-review) that may be available in the future, presenting detailed experiments and evaluations using the mini-AS.

Comments
  • IndexError

    IndexError

    It is very exciting to see the implementation of Alphastar after 2 years since release of the paper. I am trying to run miniAlphaStar. But after a few tries I am stuck at an error. Could you give me some help?

    Steps I take:

    1. install the environment with "conda create -n th_1_5 python=3.7 pytorch=1.5 -c pytorch", "conda activate th_1_5" and "pip install -r requirements.txt". conda version 4.8.2.
    2. download StarCraft from "http://blzdistsc2-a.akamaihd.net/Linux/SC2.4.6.0.67926.zip" in page "https://github.com/Blizzard/s2client-proto" and unzip to ~/
    3. download all maps from "https://github.com/Blizzard/s2client-proto" and move them to ~/StarCraftII/Maps/
    4. download replays with command "python download_replays.py --key=mykey --secret=mysecrete --version="4.6.0" --download_dir=./download/download-4-6 --extract --replays_dir=./replay/replay-4-6 --filter_version="delete"
    5. make a soft link "data/Replays/filtered_replays_1/" to "replay/replay-4-6"
    6. change line 71 of mini-AlphaStar/alphastarmini/core/sl/transform_replay_data.py from "flags.DEFINE_string("replay_version", "3.16.1", "the replays released by blizzard are all 3.16.1 version")" to "flags.DEFINE_string("replay_version", "4.6.0", "the replays released by blizzard are all 4.1.2 version")"
    7. change "flags.DEFINE_string("no_server_replay_path", "D:/work/gitproject/mini-AlphaStar/data/Replays/small_simple64_replays/", "path of replay data")" to "flags.DEFINE_string("no_server_replay_path", "/home/user/Project/mini-AlphaStar/scripts/download_replay/third/replay/replay-4-6/", "path of replay data")"

    then "python run.py"

    but I got following error:

      0%|                                     | 10/60474 [00:29<19:04:31,  1.14s/it]Traceback (most recent call last):
      File "/home/ats/Project/mini-AlphaStar/alphastarmini/core/sl/transform_replay_data.py", line 493, in test
        feature, label = getFeatureAndLabel_numpy(obs, func_call)
      File "/home/ats/Project/mini-AlphaStar/alphastarmini/core/sl/transform_replay_data.py", line 135, in getFeatureAndLabel_numpy
        s = Agent.get_state_and_action_from_pickle_numpy(obs)
      File "/home/ats/Project/mini-AlphaStar/alphastarmini/core/arch/agent.py", line 95, in get_state_and_action_from_pickle_numpy
        batch_entities_tensor = Agent.preprocess_state_entity_numpy(obs)
      File "/home/ats/Project/mini-AlphaStar/alphastarmini/core/arch/agent.py", line 355, in preprocess_state_entity_numpy
        entities_array = ArchModel.preprocess_entity_numpy(e_list)
      File "/home/ats/Project/mini-AlphaStar/alphastarmini/core/arch/arch_model.py", line 88, in preprocess_entity_numpy
        return EntityEncoder.preprocess_numpy(e_list)
      File "/home/ats/Project/mini-AlphaStar/alphastarmini/core/arch/entity_encoder.py", line 111, in preprocess_numpy
        return cls.preprocess_in_numpy(entity_list)
      File "/home/ats/Project/mini-AlphaStar/alphastarmini/core/arch/entity_encoder.py", line 524, in preprocess_in_numpy
        order_queue_length_encoding = L.np_one_hot(np.array([order_queue_length]), cls.max_order_queue_length).reshape(1, -1)
      File "/home/ats/Project/mini-AlphaStar/alphastarmini/lib/utils.py", line 280, in np_one_hot
        res = np.eye(nb_classes)[np.array(targets).reshape(-1)]
    IndexError: index 9 is out of bounds for axis 0 with size 9```
    
    Firstly I tried Starcraft 4.1.2, but there is a pysc2 websocket timeout issue. Then I tried 4.6. The websocket timeout issue is gone but this index out of bound error arises. 
    
    My OS is ubuntu 20.04.3.
    
    
    
    
    opened by cloneniu 24
  • 运行sl_train_by_pickle.py 出错

    运行sl_train_by_pickle.py 出错

    太感谢了!已经成功对原始Replays进行了过滤,并成功运行transform_replay_data.py产生了5个.pickle文件。还有个问题,就是接下来我注释掉transform_replay_data.py,反注释sl_train_by_pickle.py,然后运行代码。出现了如下错误:

    (base) zhq@Ubuntu20:~/Doctor/RL_Project/mini-AlphaStar$ python run.py 
    arch init
    sl init
    rl init
    lt init
    core init
    transformer init
    third init
    lib init
    alphastarmini init
    pygame 2.0.1 (SDL 2.0.14, Python 3.8.5)
    Hello from the pygame community. https://www.pygame.org/contribute.html
    run init
    length of replay_files: 5
    100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 27.47it/s]
    training_size: 4
    val_size: 1
    torch.cuda.device_count(): 1
    Traceback (most recent call last):
      File "run.py", line 46, in <module>
        sl_train_by_pickle.test(on_server=P.on_server)
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/sl/sl_train_by_pickle.py", line 224, in test
        train_for_val(replays, None, agent)  # select the best hyper-parameters
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/sl/sl_train_by_pickle.py", line 132, in train_for_val
        traj = next(iter(train_loader)) # 通过iter()函数获取这些可迭代对象的迭代器。然后我们可以对获取到的迭代器不断使??next()函数来获取下??条数据。iter()函数实际上就是调??了可迭代对象的
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
        data = self._next_data()
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 557, in _next_data
        data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
        data = [self.dataset[idx] for idx in possibly_batched_index]
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
        data = [self.dataset[idx] for idx in possibly_batched_index]
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/sl/dataset_pickle.py", line 110, in __getitem__
        replay = self._get_random_trajectory(index)
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/sl/dataset_pickle.py", line 105, in _get_random_trajectory
        the_item = next(iter(traj_loader))
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
        data = self._next_data()
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 557, in _next_data
        data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
        data = [self.dataset[idx] for idx in possibly_batched_index]
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
        data = [self.dataset[idx] for idx in possibly_batched_index]
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/sl/dataset_pickle.py", line 73, in __getitem__
        feature, label = obs2feature(obs, self.agent)
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/sl/dataset_pickle.py", line 31, in obs2feature
        feature = Feature.state2feature(s)
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/sl/feature.py", line 60, in state2feature
        feature_3 = map_data.reshape(batch_size, AHP.map_channels * AHP.minimap_size * AHP.minimap_size)
    RuntimeError: shape '[1, 139264]' is invalid for input of size 73728
    
    opened by ZHQ-air 21
  • 回放文件Replays

    回放文件Replays

       您好,关于“data/Replays/filtered_replays_1”中的回放文件是怎么得到的呀? 我尝试的操作是:利用sc2client-proto/samples/replay-api/download_replays.py下载与我的StarCraftII(4.9.3)对应版本的回放文件,但是运行download_replays.py文件时提示“Failed to get oauth access token.”,其中我的运行命令是 python download_replays.py --key=我的battle.net邮箱账号 --secret=我的battle.net账号密码 --version=4.9.3 --replays_dir=/home/zhq/Doctor/RL_Project/s2client-proto/samples/replay-api/replays --extract。
       请问下,这种情况是怎么回事呀?
    
    opened by ZHQ-air 14
  • Reproducing the recent SL model featured in README.md

    Reproducing the recent SL model featured in README.md

    @liuruoze, let me first thank you for your effort to develop a practical version of AlphaStar!

    I am really interested in reproducing your recent SL-based agent, which you featured in README.md via several video clips. I’d like to know which StarCraft II version (e.g., 3.16.1) and training values (batch size and the number of epochs) you used when building the SL model.

    Thank you again for your amazing work - hopefully, I can contribute to your work, too!

    opened by infphilo 12
  • mini-AlphaStar V1.05编译报错

    mini-AlphaStar V1.05编译报错

    这次我是用 3.16.1版本的replay files,v4.1.2版本的StarCraftII,然后直接运行 rl_train_with_replay.test,提示如下错误:

    (base) zhq@Ubuntu20:~/Doctor/RL_Project/mini-AlphaStar$ python run.py 
    pygame 2.0.1 (SDL 2.0.14, Python 3.8.5)
    Hello from the pygame community. https://www.pygame.org/contribute.html
    run init
    cudnn available
    cudnn version 7605
    learner trajectories size: 0
    learner trajectories size: 0
    start_time before training: 2021-12-07 17:23:35
    map name: AbyssalReef
    player.name: MainPlayer
    opponent.name: Historical
    player.race: Race.protoss
    opponent.race: Race.protoss
    Version: B60604 (SC2.4.01)
    Build: May  1 2018 19:24:12
    Command Line: '"/home/zhq/StarCraftII/Versions/Base60321/SC2_x64" -listen 127.0.0.1 -port 21930 -dataDir /home/zhq/StarCraftII/ -tempDir /tmp/sc-7nrvdwyr/ -dataVersion 33D9FE28909573253B7FC352CE7AEA40'
    Starting up...
    Startup Phase 1 complete
    learner trajectories size: 0
    Startup Phase 2 complete
    Creating stub renderer...
    Listening on: 127.0.0.1:21930
    Startup Phase 3 complete. Ready for commands.
    learner trajectories size: 0
    Version: B60604 (SC2.4.01)
    Build: May  1 2018 19:24:12
    Command Line: '"/home/zhq/StarCraftII/Versions/Base60321/SC2_x64" -listen 127.0.0.1 -port 18821 -dataDir /home/zhq/StarCraftII/ -tempDir /tmp/sc-4olvry4e/ -dataVersion 33D9FE28909573253B7FC352CE7AEA40'
    Starting up...
    Startup Phase 1 complete
    learner trajectories size: 0
    Startup Phase 2 complete
    Creating stub renderer...
    Listening on: 127.0.0.1:18821
    Startup Phase 3 complete. Ready for commands.
    learner trajectories size: 0
    Requesting to join a multiplayer game
    Configuring interface options
    Configure: raw interface enabled
    Configure: feature layer interface enabled
    Configure: score interface enabled
    Configure: render interface disabled
    Requesting to join a multiplayer game
    Configuring interface options
    Configure: raw interface enabled
    Configure: feature layer interface enabled
    Configure: score interface enabled
    Configure: render interface disabled
    Entering load game phase.
    Entering load game phase.
    Create game with map path: AbyssalReefLE.SC2Map
    learner trajectories size: 0
    Attempting to join a game with the map: Ladder2017Season4/AbyssalReefLE.SC2Map
    learner trajectories size: 0
    learner trajectories size: 0
    learner trajectories size: 0
    learner trajectories size: 0
    learner trajectories size: 0
    Game has started.
    Sending ResponseJoinGame
    Game has started.
    Sending ResponseJoinGame
    start_time before reset: 2021-12-07 17:23:46
    total_episodes: 1
    learner trajectories size: 0
    Version: B55958 (SC2.3.16)
    Build: Jul 31 2017 13:19:41
    Command Line: '"/home/zhq/StarCraftII/Versions/Base55958/SC2_x64" -listen 127.0.0.1 -port 17945 -dataDir /home/zhq/StarCraftII/ -tempDir /tmp/sc-s6etrbvj/ -dataVersion 5BD7C31B44525DAB46E64C4602A81DC2 -eglpath libEGL.so'
    Starting up...
    Startup Phase 1 complete
    learner trajectories size: 0
    Startup Phase 2 complete
    Creating stub renderer...
    Listening on: 127.0.0.1:17945 (17945)
    Startup Phase 3 complete. Ready for commands.
    learner trajectories size: 0
    replay_path:------------- /home/zhq/Doctor/RL_Project/mini-AlphaStar/data/Replays/filtered_replays_1/fdcd9f6c099e6efd1d490be9299f3a19451aad9b56ddc48acf52f7233fbe8561.SC2Replay
    Configuring interface options
    Configure: raw interface enabled
    Configure: feature layer interface enabled
    Configure: score interface enabled
    Configure: render interface disabled
    Launching next game.
    Next launch phase started: 2
    Next launch phase started: 3
    Next launch phase started: 4
    Next launch phase started: 5
    Next launch phase started: 6
    Next launch phase started: 7
    Next launch phase started: 8
    learner trajectories size: 0
    learner trajectories size: 0
    Starting replay 'TempStartReplay.SC2Replay'
    learner trajectories size: 0
    learner trajectories size: 0
    Game has started.
    start_episode_time before is_final: 2021-12-07 17:23:52
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [928,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [929,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [930,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [931,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [932,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [933,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [934,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [935,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [936,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [937,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [938,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [939,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [940,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [941,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [942,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [943,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [944,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [945,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [946,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [947,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [948,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [949,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [950,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [951,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [952,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [953,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [954,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [955,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [956,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [957,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [958,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [959,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [384,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [385,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [386,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [387,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [388,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [389,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [390,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [391,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [392,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [393,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [394,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [395,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [396,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [397,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [398,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [399,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [400,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [401,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [402,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [403,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [404,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [405,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [406,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [407,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [408,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [409,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [410,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [411,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [412,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [413,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [414,0,0] Assertion `val >= zero` failed.
    /opt/conda/conda-bld/pytorch_1616554788289/work/aten/src/ATen/native/cuda/MultinomialKernel.cu:197: sampleMultinomialOnce: block: [0,0,0], thread: [415,0,0] Assertion `val >= zero` failed.
    unable to parse websocket frame.
    RequestQuit command received.
    Closing Application...
    unable to parse websocket frame.
    RequestQuit command received.
    Closing Application...
    RequestQuit command received.
    unable to parse websocket frame.
    Closing Application...
    ActorLoop.run() Exception cause return, Detials of the Exception: CUDA error: device-side assert triggered
    Traceback (most recent call last):
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/rl/actor_plus_z.py", line 282, in run
        player_step = self.player.agent.step_from_state(state, player_memory)
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/rl/alphastar_agent.py", line 234, in step_from_state
        action_logits, action, hidden_state, select_units_num = self.agent_nn.action_logits_by_state(state,
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/arch/agent.py", line 328, in action_logits_by_state
        action_logits, actions, new_state, select_units_num = self.model.forward(state, batch_size = batch_size,
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/arch/arch_model.py", line 128, in forward
        target_location_logits, target_location = self.location_head(autoregressive_embedding, action_type, map_skip)
      File "/home/zhq/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
        result = self.forward(*input, **kwargs)
      File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/arch/location_head.py", line 293, in forward
        location_id = torch.multinomial(target_location_probs, num_samples=1, replacement=True)
    RuntimeError: CUDA error: device-side assert triggered
    
    Actor stops!
    Learner also stops!
    run over
    

    请问这是这是为什么呀

    opened by ZHQ-air 12
  • 想请教一下关于预训练的数据问题

    想请教一下关于预训练的数据问题

    大佬您好,想请教下关于与训练的数据问题: 1.通过对回放视频进行处理,可以得到预训练数据,关于这里我想请教问下:这个提取数据,以及出来的特征和标签是暴雪那边给好的吗?也就是这一部分数据打标是怎么来的呢? 特征我理解就是当前局面的一些统计特征、地图特征等等,但标签是什么呢?是动作的one-hot形式? 2.如果仅仅是动作的话,怎么实现对整个网络的训练的呢? 我理解按照:动作类型——delay——排序队伍——选择动作执行单位——目标单位——目标地址(这里可以是目标单位,或者某一个地方),那么后面几步的标签怎么来呢? 还是我理解的哪里不到位,希望能够给出一点指点,感谢。 3.那么后续强化学习的奖励,是否就和这个地方标签如何打标是具有一定的关系了? 因为我看论文里面,奖励主要是设置伪奖励,伪奖励除开较为好设计的击杀等,主要是建造顺序这些设置,那么这种设置是否就要和前面的标签结合

    opened by Lucklycat 10
  • Starcraft 2 version problem

    Starcraft 2 version problem

    Hi, I am having latest starcraft 2 version which is 5.0.8 on windows 10, when I try to run " python run.py" with codes below:

    # 5. we use SL model and replays to do reinforcement learning

    from alphastarmini.core.rl import rl_train_with_replay
    rl_train_with_replay.test(on_server=P.on_server, replay_path=P.replay_path)
    

    Result with error below:

    ActorLoop.run() Exception cause return, Detials of the Exception: Unknown game version: 3.16.1. Known versions: ['latest']. Traceback (most recent call last): File "C:\Users\alexa\Downloads\mini-AlphaStar-main\alphastarmini\core\rl\actor_plus_z.py", line 130, in run run_config = run_configs.get(version=self.replay_version) # the replays released by blizzard are all 3.16.1 version File "C:\Users\alexa\anaconda3\envs\torch_1_5\lib\site-packages\pysc2\run_configs_init_.py", line 40, in get return max(configs.values(), key=lambda c: c.priority())(version=version) File "C:\Users\alexa\anaconda3\envs\torch_1_5\lib\site-packages\pysc2\run_configs\platforms.py", line 121, in init version=version, cwd="Support64") File "C:\Users\alexa\anaconda3\envs\torch_1_5\lib\site-packages\pysc2\run_configs\platforms.py", line 63, in init data_dir=base_dir, tmp_dir=None, version=version, cwd=cwd, env=env) File "C:\Users\alexa\anaconda3\envs\torch_1_5\lib\site-packages\pysc2\run_configs\lib.py", line 112, in init self.version = self._get_version(version) File "C:\Users\alexa\anaconda3\envs\torch_1_5\lib\site-packages\pysc2\run_configs\lib.py", line 220, in _get_version versions = self.get_versions(containing=game_version) File "C:\Users\alexa\anaconda3\envs\torch_1_5\lib\site-packages\pysc2\run_configs\platforms.py", line 109, in get_versions containing, sorted(ret.keys()))) ValueError: Unknown game version: 3.16.1. Known versions: ['latest'].

    run over

    Which I know it needs SC2 3.16.1 version to work, but I cannot get older version of Starcraft 2. Please advice me on this. Thanks!!

    opened by khcf123 10
  • Unable to Process Replays?

    Unable to Process Replays?

    Just discovered this repo, and I'm extremely interested in getting started with SC2 RL, but I'm quickly finding that most of these repo's aren't maintained anymore/they're from versions of the game LONG ago, so I'm hoping to get some insight.

    Now, using this repo, and running Windows 10, Python 3.10, and SC2 version 5.0.9, my run.py looks like this:

    image

    Pretty standard, I'm just trying to run the transform_replay_data part. I've also updated the path where the replays are read from in the transform_replay_data.py file to flags.DEFINE_string("no_server_replay_path", "C:\\Program Files (x86)\\StarCraft II\\Replays\\", "path of replay data"). (Double slashes re: Windows).

    I run the script, and it looks like it's trying to run, but essentially, it just flies through all the replay files I have in that directory, but it doesn't actually "do" anything, it just looks like this at the end:

    image

    I don't see any errors or anything to suggest what it might be, but my guess is it has something to do with the version of replays vs the version of my current game. I've seen in previous posts that you need to actually open the replays in order to download the older versions of the games, which I have done already, and I can see the added version in my Versions directory, but still no dice.

    The maps I've downloaded include:

    image

    ....in case that's relevant. I've also read online that there's a difference between local maps files, and battle.net map files as the latter is played online, and uses a .s2ma extension. In order to download the maps for each replay, the best advice I saw was to enter -PrePopulateCache as an additional command argument in the Battle.net > Game Options settings which downloads those cache files for you, so I've done that as well.

    Any ideas on what a guy can try to troubleshoot this? Any help would be greatly appreciated as I'd love to explore this space using the current versions of everything! lol Thanks!

    opened by windowshopr 7
  • TypeError

    TypeError

    In run.py, I run codes below:

    # 6. we use SL model and replays to do reinforcement learning

    from alphastarmini.core.rl import rl_train_with_replay
    rl_train_with_replay.test(on_server=P.on_server, replay_path=P.replay_path)
    

    And the outcome is shown below with error:

    (torch_1_5) PS C:\Users\alexa\Downloads\mini-AlphaStar-main> python run.py pygame 2.1.2 (SDL 2.0.18, Python 3.7.11) Hello from the pygame community. https://www.pygame.org/contribute.html run init cudnn available cudnn version 7604 start_time before training: 2022-01-22 13:00:03 map name: AbyssalReef player.name: MainPlayer opponent.name: MainPlayer player.race: Race.protoss opponent.race: Race.protoss start_time before reset: 2022-01-22 13:01:34 total_episodes: 1 replay_path: C:/Program Files (x86)/StarCraft II/Replays_small/fffeb9b9437fde426b5e51a700bd339e0eedb127a2106ff9920b65c2bccfd4f4.SC2Replay start_episode_time before is_final: 2022-01-22 13:03:07 ActorLoop.run() Exception cause return, Detials of the Exception: get_baseline_state_from_multi_source_state() missing 1 required positional argument: 'msstate' Traceback (most recent call last): File "C:\Users\alexa\Downloads\mini-AlphaStar-main\alphastarmini\core\rl\actor_plus_z.py", line 279, in run baseline_state = self.player.agent.agent_nn.get_baseline_state_from_multi_source_state(state) TypeError: get_baseline_state_from_multi_source_state() missing 1 required positional argument: 'msstate'

    run over

    Please help me, thanks!!

    opened by khcf123 7
  • 代码的运行

    代码的运行

    运行run.py后出错,终端提示如下: File "/home/zhq/Doctor/RL_Project/mini-AlphaStar/alphastarmini/core/sl/test_alphastar_replay.py", line 192, in run_alphastar_replay replay_files = os.listdir(REPLAY_PATH) FileNotFoundError: [Errno 2] No such file or directory: './data/Replays/replays_paper_ready/Final/Protoss/'

    我已经把StarCraftII/Replays文件夹放入了mini-AlphaStar/data文件夹中,但依然找不到相应的路径,请问下“Replays/replays_paper_ready/Final/Protoss/” 回放的数据我能怎么获得呢?

    opened by ZHQ-air 5
  • CUDA out of memory

    CUDA out of memory

    Hi, im running on windows 10 and using latest starcraft 2. The error shown as below when I run "python run.py"

    (torch_1_5) PS C:\Users\alexa\Downloads\mini-AlphaStar-main> python run.py pygame 2.1.2 (SDL 2.0.18, Python 3.7.11) Hello from the pygame community. https://www.pygame.org/contribute.html run init cudnn available cudnn version 7604 initialed player initialed teacher start_time before training: 2022-01-01 18:11:32 map name: Simple64 player.name: MainPlayer player.race: Race.protoss start_time before reset: 2022-01-01 18:13:12 total_episodes: 1 start_episode_time before is_final: 2022-01-01 18:13:13 ActorLoop.run() Exception cause return, Detials of the Exception: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 2.00 GiB total capacity; 1.27 GiB already allocated; 0 bytes free; 1.33 GiB reserved in total by PyTorch) Traceback (most recent call last): File "C:\Users\alexa\Downloads\mini-AlphaStar-main\alphastarmini\core\rl\rl_vs_computer_wo_replay.py", line 213, in run player_step = self.player.agent.step_from_state(state, player_memory) File "C:\Users\alexa\Downloads\mini-AlphaStar-main\alphastarmini\core\rl\alphastar_agent.py", line 235, in step_from_state hidden_state=hidden_state) File "C:\Users\alexa\Downloads\mini-AlphaStar-main\alphastarmini\core\arch\agent.py", line 299, in action_logits_by_state return_logits = True) File "C:\Users\alexa\Downloads\mini-AlphaStar-main\alphastarmini\core\arch\arch_model.py", line 134, in forward entity_embeddings, embedded_entity, entity_nums = self.entity_encoder(state.entity_state) File "C:\Users\alexa\anaconda3\envs\torch_1_5\lib\site-packages\torch\nn\modules\module.py", line 550, in call result = self.forward(*input, **kwargs) File "C:\Users\alexa\Downloads\mini-AlphaStar-main\alphastarmini\core\arch\entity_encoder.py", line 390, in forward unit_types_one = torch.nonzero(batch, as_tuple=True)[-1] RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 2.00 GiB total capacity; 1.27 GiB already allocated; 0 bytes free; 1.33 GiB reserved in total by PyTorch)

    run over

    Can i know what is the problem here and what is the solution? Thanks

    opened by khcf123 4
  • 运行rl_vs_inner_bot_mp.py没有输出

    运行rl_vs_inner_bot_mp.py没有输出

    作者您好,我已经用sl模型训练得到了rl模型,现在我想看一下这个模型和bot的对战效果,但当我试图运行rl_vs_inner_bot_mp.py时,程序没有任何输出就退出了。图片中的运行界面是我在win11系统用pycharm运行得到的,我在实验室的服务器上进行训练后,将训练得到的model中的rl模型下载到我的电脑中并放在model文件夹内,运行rl_vs_inner_bot_mp.py,产生了这样的问题。想问下您这个问题怎么解决,感谢!

    图片2

    opened by Zhouchenhaoustc 0
  • Some questions in Rl-training

    Some questions in Rl-training

    1.问一下你们是在什么系统上运行的呢?我在使用gpu运行rl_vs_inner_bot时会报错,查了下似乎是在主进程中把模型参数放到了GPU上会报错,Windows似乎不支持在CUDA上进行multiprocess的操作?有什么好的解决方法吗? RuntimeError:cuda runtime error(801) : operation not supported at ... 2.请问可以提供RL训练过程的曲线、结果以及相关技巧吗?我在arxiv和github上似乎没有找到rl训练过程的更多内容。直接运行开源程序rl_vs_inner_bot模块,Tensorboard的结果似乎存在问题?

    opened by DreamerSurpass 1
  • Is it possible to share some experiment details about model training ?

    Is it possible to share some experiment details about model training ?

    Thanks a lot for sharing this awesome project !

    I really want to have a try for the training part, but didn't find any experiment details in README or your arxiv paper. Is it possible for you to kindly share some info about the questions below ?

    • How many disk/memory space should I prepare for the training part?
    • How long it takes to do supervised/rl train with single or multi gpus?
    • What level can the trained agent achieve? Can the trained agent beat easy/median/hard bot in sc2 ?
    opened by nicklhy 1
  • Reproducing results on latest Starcraft version (5.0.9)

    Reproducing results on latest Starcraft version (5.0.9)

    Hi, thank you for your work! I downloaded pretrained weights ("rl_22-02-07_16-26-48.pth") and then i ran:

    from alphastarmini.core.rl import rl_vs_inner_bot_mp
    rl_vs_inner_bot_mp.test(on_server=P.on_server, replay_path=P.replay_path)
    

    Unfortunately, agent is only building probes, and definitely not acting according to anyhow optimal policy. I am using latest SC2 version, is this the reason? Is it possible to provide model weights for a new version?

    opened by Misterion777 1
Owner
Ruo-Ze Liu
Think deep, work hard.
Ruo-Ze Liu
A non-linear, non-parametric Machine Learning method capable of modeling complex datasets

Fast Symbolic Regression Symbolic Regression is a non-linear, non-parametric Machine Learning method capable of modeling complex data sets. fastsr aim

VAMSHI CHOWDARY 3 Jun 22, 2022
Code for "Contextual Non-Local Alignment over Full-Scale Representation for Text-Based Person Search"

Contextual Non-Local Alignment over Full-Scale Representation for Text-Based Person Search This is an implementation for our paper Contextual Non-Loca

Tencent YouTu Research 50 Dec 3, 2022
A pytorch-version implementation codes of paper: "BSN++: Complementary Boundary Regressor with Scale-Balanced Relation Modeling for Temporal Action Proposal Generation"

BSN++: Complementary Boundary Regressor with Scale-Balanced Relation Modeling for Temporal Action Proposal Generation A pytorch-version implementation

null 11 Oct 8, 2022
A PaddlePaddle version of Neural Renderer, refer to its PyTorch version

Neural 3D Mesh Renderer in PadddlePaddle A PaddlePaddle version of Neural Renderer, refer to its PyTorch version Install Run: pip install neural-rende

AgentMaker 13 Jul 12, 2022
This is the official implementation of TrivialAugment and a mini-library for the application of multiple image augmentation strategies including RandAugment and TrivialAugment.

Trivial Augment This is the official implementation of TrivialAugment (https://arxiv.org/abs/2103.10158), as was used for the paper. TrivialAugment is

AutoML-Freiburg-Hannover 94 Dec 30, 2022
Language models are open knowledge graphs ( non official implementation )

language-models-are-knowledge-graphs-pytorch Language models are open knowledge graphs ( work in progress ) A non official reimplementation of Languag

theblackcat102 132 Dec 18, 2022
Non-Official Pytorch implementation of "Face Identity Disentanglement via Latent Space Mapping" https://arxiv.org/abs/2005.07728 Using StyleGAN2 instead of StyleGAN

Face Identity Disentanglement via Latent Space Mapping - Implement in pytorch with StyleGAN 2 Description Pytorch implementation of the paper Face Ide

Daniel Roich 58 Dec 24, 2022
The official implementation of VAENAR-TTS, a VAE based non-autoregressive TTS model.

VAENAR-TTS This repo contains code accompanying the paper "VAENAR-TTS: Variational Auto-Encoder based Non-AutoRegressive Text-to-Speech Synthesis". Sa

THUHCSI 138 Oct 28, 2022
Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

Official code release for ICCV 2021 paper SNARF: Differentiable Forward Skinning for Animating Non-rigid Neural Implicit Shapes.

null 235 Dec 26, 2022
Official implementation of NLOS-OT: Passive Non-Line-of-Sight Imaging Using Optimal Transport (IEEE TIP, accepted)

NLOS-OT Official implementation of NLOS-OT: Passive Non-Line-of-Sight Imaging Using Optimal Transport (IEEE TIP, accepted) Description In this reposit

Ruixu Geng(耿瑞旭) 16 Dec 16, 2022
Official pytorch implementation for Learning to Listen: Modeling Non-Deterministic Dyadic Facial Motion (CVPR 2022)

Learning to Listen: Modeling Non-Deterministic Dyadic Facial Motion This repository contains a pytorch implementation of "Learning to Listen: Modeling

null 50 Dec 17, 2022
The official repo for OC-SORT: Observation-Centric SORT on video Multi-Object Tracking. OC-SORT is simple, online and robust to occlusion/non-linear motion.

OC-SORT Observation-Centric SORT (OC-SORT) is a pure motion-model-based multi-object tracker. It aims to improve tracking robustness in crowded scenes

Jinkun Cao 325 Jan 5, 2023
(ImageNet pretrained models) The official pytorch implemention of the TPAMI paper "Res2Net: A New Multi-scale Backbone Architecture"

Res2Net The official pytorch implemention of the paper "Res2Net: A New Multi-scale Backbone Architecture" Our paper is accepted by IEEE Transactions o

Res2Net Applications 928 Dec 29, 2022
This repo contains the official code of our work SAM-SLR which won the CVPR 2021 Challenge on Large Scale Signer Independent Isolated Sign Language Recognition.

Skeleton Aware Multi-modal Sign Language Recognition By Songyao Jiang, Bin Sun, Lichen Wang, Yue Bai, Kunpeng Li and Yun Fu. Smile Lab @ Northeastern

Isen (Songyao Jiang) 128 Dec 8, 2022
Official implementation of "Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets" (CVPR2021)

Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets This is the official implementation of "Towards Good Pract

Sanja Fidler's Lab 52 Nov 22, 2022
Official Implementation and Dataset of "PPR10K: A Large-Scale Portrait Photo Retouching Dataset with Human-Region Mask and Group-Level Consistency", CVPR 2021

Portrait Photo Retouching with PPR10K Paper | Supplementary Material PPR10K: A Large-Scale Portrait Photo Retouching Dataset with Human-Region Mask an

null 184 Dec 11, 2022
Official Implement of CVPR 2021 paper “Cross-Modal Collaborative Representation Learning and a Large-Scale RGBT Benchmark for Crowd Counting”

RGBT Crowd Counting Lingbo Liu, Jiaqi Chen, Hefeng Wu, Guanbin Li, Chenglong Li, Liang Lin. "Cross-Modal Collaborative Representation Learning and a L

null 37 Dec 8, 2022
Official repository for the paper, MidiBERT-Piano: Large-scale Pre-training for Symbolic Music Understanding.

MidiBERT-Piano Authors: Yi-Hui (Sophia) Chou, I-Chun (Bronwin) Chen Introduction This is the official repository for the paper, MidiBERT-Piano: Large-

null 137 Dec 15, 2022