This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bitmaps::Bitmap; | |
use std::cmp::max; | |
use std::collections::HashMap; | |
use std::hash::Hash; | |
use std::io; | |
fn parsei(s: &str) -> i32 { | |
s.parse().unwrap() | |
} | |
const NUM_LETTERS: usize = 26; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bitmaps::Bitmap; | |
use std::cmp::max; | |
use std::collections::HashMap; | |
use std::hash::Hash; | |
use std::io; | |
fn parsei(s: &str) -> i32 { | |
s.parse().unwrap() | |
} | |
const NUM_LETTERS: usize = 26; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import torch | |
import argparse | |
import numpy as np | |
from copy import deepcopy | |
from typing import Optional, Tuple | |
from torch.utils.tensorboard import SummaryWriter | |
from tianshou.utils import BasicLogger | |
from tianshou.env import DummyVectorEnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from all.environments import MultiagentAtariEnv | |
from all.experiments.multiagent_env_experiment import MultiagentEnvExperiment | |
from all.presets import atari | |
from all.agents import Agent | |
from all.logging import DummyWriter | |
from all.presets import IndependentMultiagentPreset, Preset | |
from all.core import State | |
import torch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
from numpy import float32 | |
import os | |
from supersuit import dtype_v0 | |
import ray | |
import argparse | |
from ray import tune | |
from ray.rllib.agents.registry import get_agent_class | |
from ray.rllib.env import PettingZooEnv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy | |
from numpy import float32 | |
import os | |
from supersuit import dtype_v0 | |
import ray | |
from ray import tune | |
from ray.rllib.agents.registry import get_agent_class | |
from ray.rllib.env import PettingZooEnv | |
from pettingzoo.classic import leduc_holdem_v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
from torch.optim import Adam | |
from torch.optim.lr_scheduler import CosineAnnealingLR | |
from all.approximation import QDist, FixedTarget | |
from all.agents import Rainbow, RainbowTestAgent | |
from all.bodies import DeepmindAtariBody | |
from all.logging import DummyWriter | |
from all.memory import PrioritizedReplayBuffer, NStepReplayBuffer | |
from all.optim import LinearScheduler | |
from all.presets.atari.models import nature_rainbow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
class random_state_swap: | |
''' | |
usage: | |
np_random, _ = gym.seeding.np_random(seed) | |
with random_state_swap(np_random): | |
# uses np_random's local random state | |
r = np.random.normal(size=10) | |
# can safely call external libraries which use np.random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pettingzoo.tests.all_modules import all_environments | |
from pettingzoo.tests.seed_test import calc_hash | |
import time | |
import random | |
import numpy as np | |
import supersuit | |
import gym | |
import random | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ray.rllib.env.multi_agent_env import MultiAgentEnv | |
class PettingZooEnv(MultiAgentEnv): | |
"""An interface to the PettingZoo MARL environment library. | |
See: https://github.com/PettingZoo-Team/PettingZoo | |
Inherits from MultiAgentEnv and exposes a given AEC | |
(actor-environment-cycle) game from the PettingZoo project via the |
NewerOlder