Skip to content

Instantly share code, notes, and snippets.

🤖
On research

Takuma Seno takuseno

View GitHub Profile
@takuseno
takuseno / dqn.py
Last active Jan 15, 2019
Deep Q-Network implementation with NNabla
View dqn.py
import numpy as np
import nnabla as nn
import nnabla.parametric_functions as PF
import nnabla.functions as F
import nnabla.solvers as S
import random
import argparse
import gym
import os
import cv2
@takuseno
takuseno / gpu_info.py
Created Oct 10, 2018
Parse nvidia-smi by Python
View gpu_info.py
from subprocess import Popen, PIPE
from xml.etree.ElementTree import fromstring
def main():
p = Popen(['nvidia-smi', '-q', '-x'], stdout=PIPE)
outs, errors = p.communicate()
xml = fromstring(outs)
num_gpus = int(xml.getiterator('attached_gpus')[0].text)
results = []
@takuseno
takuseno / reptile.py
Last active Jun 6, 2018
TensorFlow version of reptile sample https://blog.openai.com/reptile/
View reptile.py
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
mode = 'maml'
seed = 0
plot = True
innerstepsize = 0.02 # stepsize in inner SGD
innerepochs = 1 # number of epochs of each inner SGD
outerstepsize0 = 0.1 if mode == 'reptile' else 0.001 # stepsize of outer optimization, i.e., meta-optimization
You can’t perform that action at this time.