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 | |
from jax import numpy as jnp | |
from jax.lib import pytree | |
def tree_stack(trees): | |
"""Takes a list of trees and stacks every corresponding leaf. | |
For example, given two trees ((a, b), c) and ((a', b'), c'), returns | |
((stack(a, a'), stack(b, b')), stack(c, c')). |
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
[{"x":0,"y":0},{"x":1,"y":1},{"x":2,"y":2},{"x":3,"y":3},{"x":4,"y":4},{"x":5,"y":5},{"x":6,"y":6},{"x":7,"y":7},{"x":8,"y":8},{"x":9,"y":9}] |
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
class DmMujocoModel(nn.Module): | |
def __init__(self, embed_dim, env_name, traj_len, qpos_only=False, qpos_qvel=False): | |
super().__init__() | |
self.embed_dim = embed_dim | |
self.dataset = DmData(env_name, traj_len, qpos_only, qpos_qvel) | |
self.dataset.make_env() | |
self.env = self.dataset.env | |
self.dummy_parameter = nn.Parameter(torch.zeros(1)) | |
def forward(self, s, a): |
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 signal | |
# depends on requesting SIGUSR1 in runner file: https://gist.github.com/willwhitney/e1509c86522896c6930d2fe9ea49a522 | |
def handle_signal(signal_value, _): | |
signame = signal.Signals(signal_value).name | |
if signal_value == signal.SIGUSR1: | |
print('Process {} got signal {}. Saving and restarting.'.format( | |
os.getpid(), signame), flush=True) | |
save_dynamics(epoch) |
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 tensorboard.backend.event_processing import event_accumulator | |
import tensorflow as tf | |
import glob | |
import pandas as pd | |
tf.logging.set_verbosity(tf.logging.ERROR) | |
basedir = "/path/to/log/directory/" | |
def load_tf(dirname): | |
prefix = basedir + "tboard/VisibleSwimmer-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
#---------------------------------------------- | |
# things to change: | |
# code_dir (the full path of the directory that contains your source dir) | |
# true_source_dir (change it from TD3 to whatever your source dir is called) | |
# job_source_dir (someplace to throw a duplicate of the source dir for this job) | |
#---------------------------------------------- | |
import os | |
import sys | |
import itertools |
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
File "parallel_main.py", line 56, in <module> | |
parents = random.choices(population, scores + 1e-10, k=pop_size) | |
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/pool.py", line 260, in map | |
return self._map_async(func, iterable, mapstar, chunksize).get() | |
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/pool.py", line 608, in get | |
raise self._value | |
multiprocessing.pool.MaybeEncodingError: Error sending result: | |
<my object> | |
Reason: 'RuntimeError('unable to open shared memory object </torch_29253_1584213566> in read-write mode at /py/conda-bld/pytorch_1493680494901/work/torch/lib/TH/THAllocator.c:226',)' |
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
Traceback (most recent call last): | |
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap | |
self.run() | |
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/process.py", line 93, in run | |
self._target(*self._args, **self._kwargs) | |
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/pool.py", line 108, in worker | |
task = get() | |
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/queues.py", line 345, in get | |
return _ForkingPickler.loads(res) | |
File "/home/wwhitney/anaconda3/lib/python3.6/site-packages/torch/multiprocessing/reductions.py", line 86, in rebuild_storage_filename |
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
/* | |
To use me, go to one of the individual drug pages from propublica (e.g. https://projects.propublica.org/checkup/drugs/1726), | |
open the console (press ⌘-⌥-J on Mac), | |
paste in this script and hit Enter. | |
A new column should appear in your table. | |
This is very much hacked together in the console, so... no guarantees it will work next week. | |
*/ | |
states = [[1, "California", 39144818], |
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 requests | |
import sys | |
from datetime import datetime, timedelta | |
import pytz | |
from PIL import Image | |
from StringIO import StringIO | |
import os | |
import logging | |
# python himawari.py |
NewerOlder