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 / 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]"
@syuntoku14
syuntoku14 / mm_to_m.py
Last active June 9, 2022 06:39
STLファイルの単位をミリメートルからメートルに変換する
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
[summary]
mm 単位になっているstlファイルを m 単位に変換する
[description]
python mm_to_m.py sample.stl
のように実行すると、sample_m.stlという名前の m 単位に変換したファイルを保存する。
@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_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 / 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
@syuntoku14
syuntoku14 / build_env_colab.sh
Last active February 24, 2020 07:45
Install marlo environment on the google colab
# after run sh 'build_env_colab.sh', run
# import sys
# sys.path.append('/usr/local/lib/python3.6/site-packages/')
# in the python.
# To run the gym in server, pyvirtualdisplay is the best solution
# see https://qiita.com/ikeyasu/items/ec3c88ce13a2d5e41f26
# install anaconda
wget https://repo.anaconda.com/archive/Anaconda3-5.1.0-Linux-x86_64.sh
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