I hereby claim:
- I am kengz on github.
- I am kengz (https://keybase.io/kengz) on keybase.
- I have a public key ASCZnM1pXJ3J3XW9-Nk2h22qWrep6ra1BfxuN6YBZFTbggo
To claim this, I am signing this object:
The HEX color for Atom highlighter theme: close to Base16 but lighter. | |
bgdark: #2b303b | |
red: #e26a78 | |
cyan: #78dbf9 | |
green: #8bdb97 | |
purple: #d59cf6 | |
orange: #dbad83 |
# First create a Google Compute Engine (GCE) VM instance, then SSH into the VM. | |
# 1. update everything | |
sudo apt-get update | |
# 2. install these 4 things | |
sudo apt-get install python g++ make checkinstall | |
# 3. make a src directory and go into it | |
mkdir ~/src && cd $_ |
Global Hackers Missions | |
[ Feel free to contribute and sign your own contribution! Separate by “Insert > Horizontal line”. See example below. ] | |
[ Anyone can edit this document, so be responsible. Of course we back this up somewhere else too | |
### | |
This page is for doers who dare to, and for builders who want to, make a dent in the universe. | |
Do's: Be open minded, be dare, believe. | |
Don’t be butt-hurt, don’t be evil. |
I hereby claim:
To claim this, I am signing this object:
def post_body_init(self): | |
'''Initializes the part of algorithm needing a body to exist first.''' | |
self.body = self.agent.nanflat_body_a[0] # single-body algo | |
# create the extra replay memory for SIL | |
memory_name = self.memory_spec['sil_replay_name'] | |
MemoryClass = getattr(memory, memory_name) | |
self.body.replay_memory = MemoryClass(self.memory_spec, self, self.body) | |
self.init_algorithm_params() | |
self.init_nets() | |
logger.info(util.self_desc(self)) |
def train_shared(self): | |
''' | |
Trains the network when the actor and critic share parameters | |
''' | |
if self.to_train == 1: | |
# onpolicy a2c update | |
a2c_loss = super(SIL, self).train_shared() | |
# offpolicy sil update with random minibatch | |
total_sil_loss = torch.tensor(0.0) | |
for _ in range(self.training_epoch): |
# init singleton agent and env | |
self.env = make_env(self.spec) | |
body = Body(self.env, self.spec['agent']) | |
self.agent = Agent(self.spec, self.info_space, body=body) |
def run_episode(self): | |
self.env.clock.tick('epi') | |
reward, state, done = self.env.reset() | |
self.agent.reset(state) | |
while not done: | |
self.env.clock.tick('t') | |
action = self.agent.act(state) | |
reward, state, done = self.env.step(action) | |
self.agent.update(action, reward, state, done) | |
self.agent.body.log_summary() |
def run(self): | |
while self.env.clock.get('epi') <= self.env.max_episode: | |
self.run_episode() | |
self.data = analysis.analyze_session(self) # session fitness | |
self.close() | |
return self.data |
''' | |
Demo: SLM Lab as pip module for lightweight usecases | |
Installation: | |
1. Clone SLM-Lab | |
``` | |
git clone https://github.com/kengz/SLM-Lab.git | |
cd SLM-Lab | |
``` |