Skip to content

Instantly share code, notes, and snippets.

View syuntoku14's full-sized avatar

Toshinori Kitamura syuntoku14

  • The University of Tokyo
View GitHub Profile
@syuntoku14
syuntoku14 / launch.json
Created April 2, 2020 07:22
vscode_debug
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
@syuntoku14
syuntoku14 / img2eps.bash
Last active March 22, 2020 08:50
Convert to eps
for file in *.png; do
convert $file eps2:${file%.*}.eps ;
done
for file in *.jpg; do
convert $file eps2:${file%.*}.eps ;
done
import argparse
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader
from pytorch_pretrained_bert import BertModel, BertTokenizer
import torch.nn.utils.rnn as rnn
import torch.nn.functional as F
import torch.utils.data as data
import sys
import argparse
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader
import sys
from torch.nn.utils import clip_grad_norm_
import parser
import torch
import os
@syuntoku14
syuntoku14 / .profile
Last active May 18, 2022 12:32
i3 config
export DefaultImModule=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
@syuntoku14
syuntoku14 / setup_DL.bash
Created June 27, 2019 14:17
Install DL packages
# install python packages
conda config --add channels conda-forge
conda install -y jupyter pytorch torchvision -c pytorch
conda install -y pyvirtualdisplay
yes | pip3 install torchvision
yes | pip3 install gym "gym[atari]"
# Configure jupyter notebook server
jupyter notebook --generate-config
echo "c = get_config()" >> ~/.jupyter/jupyter_notebook_config.py
@syuntoku14
syuntoku14 / setup_server.bash
Last active April 19, 2020 06:10
install docker, tmux and mosh on a headless server
#!/bin/bash
sudo apt update && sudo apt upgrade -y
# install tmux and mosh
sudo apt install tmux mosh curl
# install docker
# sudo apt install nvidia-container-toolkit # uncomment if you want to use gpus
sudo curl -fsSL https://get.docker.com -o get-docker.sh
@syuntoku14
syuntoku14 / flow_run.bash
Last active March 23, 2019 08:27
Command to run the flow on the headless server(without vnc) Please see https://flow.readthedocs.io/en/latest/flow_setup.html#id16
docker run -it --rm \
--net=host \
-e DISPLAY=$DISPLAY \
-v /home/syuntoku/.Xauthority:/headless/.Xauthority:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--entrypoint=/bin/bash \
lucasfischerberkeley/flowdesktop
# inside the container, run "conda activate flow-rllab"
@syuntoku14
syuntoku14 / dqn_atari_colab.ipynb
Last active December 31, 2023 12:51
DQN Implementation on google colab
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@syuntoku14
syuntoku14 / build_gym_colab.sh
Created November 14, 2018 05:39
Install gym environment into google colab
apt update
apt install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb ffmpeg xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
pip3 install pyvirtualdisplay piglet gym torch torchvision
pip3 install "gym[atari]"