Skip to content

Instantly share code, notes, and snippets.

Sung-ju Kim goddoe

Block or report user

Report or block goddoe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ctags -R --fields=+l --languages=python --python-kinds=-iv ./
goddoe /
Created Mar 26, 2019 — forked from jeasinema/
A simple script for parameter initialization for PyTorch
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
import torch
import torch.nn as nn
import torch.nn.init as init
def weight_init(m):
goddoe /
Created Mar 19, 2019
pytorch: save data parallel model
state_dict = model.module.state_dict()
except AttributeError:
state_dict = model.state_dict()
goddoe / Increase container volume(disk) size
Created Feb 21, 2019
Increase container volume(disk) size
View Increase container volume(disk) size
With Centos 7 I did the following to increase the default size of the containers
Modify the docker config in /etc/sysconfig/docker-storage to add the line:
DOCKER_STORAGE_OPTIONS= - -storage-opt dm.basesize=20G
service docker stop
service docker start
docker load < [each_save_in_backup.tar]
docker run -i -t [imagename] /bin/bash
goddoe / How to change default editor of
Last active Feb 14, 2019
How to change default editor of git
View How to change default editor of
git config --global core.editor "vim"

if you want to set the editor for Git and also other programs, set the standardized VISUAL and EDITOR environment variables*:

export VISUAL=vim
View mysql remote
View change docker stroage.txt
Hello all,
I have been using Docker with the Devicemapper storage driver. After manually editing the launcher script, I finally took the time to convert to Overlay2. Here are the instructions I took to do this. I hope this helps others. I see others have asked the question 9, but I don’t see any answers. I used this excellent guide 64 to help figure this out.
Step 1: Halt your Discourse application (and other docker apps)
./launcher stop app
Step 2: Commit and save your old Docker containers/images
goddoe /
Created Jan 31, 2019
pandas apply multiprocessing

(ref: I'm trying to use multiprocessing with pandas dataframe, that is split the dataframe to 8 parts. apply some function to each part using apply (with each part processed in different process).

EDIT: Here's the solution I finally found:

import multiprocessing as mp
import pandas.util.testing as pdt

def process_apply(x):
View gist:88dfba762e046c150bc022a3bf01d379
TMPDIR=/root/users/sungju/tmp/ pip install --cache-dir=/root/users/sungju/tmp/ --build /root/users/sungju/tmp/ torch
View gist:dfd50258c0d6e996da265e0e94e77695
Batch Norm:
(+) Stable if the batch size is large
(+) Robust (in train) to the scale & shift of input data
(+) Robust to the scale of weight vector
(+) Scale of update decreases while training
(-) Not good for online learning
(-) Not good for RNN, LSTM
(-) Different calculation between train and test
Weight Norm:
You can’t perform that action at this time.