Skip to content

Instantly share code, notes, and snippets.

View aonotas's full-sized avatar

Motoki Sato aonotas

View GitHub Profile
@aonotas
aonotas / chainer_example_n_step_lstm_cpu.py
Created September 13, 2017 07:04
Chainer Example for NStepLSTM code (CPU mode)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from chainer import Variable
import chainer.functions as F
import chainer.links as L
# 入力データの準備
@aonotas
aonotas / chainer_example_n_step_lstm_gpu.py
Created September 13, 2017 07:01
Chainer Example for NStepLSTM code (cudnn GPU)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from chainer import Variable
import chainer.functions as F
import chainer.links as L
from chainer import cuda

You Should load .bash_profile file when you login your sever.

cd /cl/work/hamada-n/
source /cl/work/hamada-n/.bash_profile

install pyenv

/**
* Copyright 2016 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and related documentation outside the terms of the EULA
* is strictly prohibited.
*
*/
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(
format='%(asctime)s : %(threadName)s : %(levelname)s : %(message)s',
level=logging.INFO)
logging.info('aaaaa')
@aonotas
aonotas / gpu
Last active July 26, 2017 05:08
```
export CUDA_HOME=$HOME/local/cuda-8.0
export PATH=$HOME/local/cuda-8.0/bin:$PATH
export CPATH=$HOME/local/cuda-8.0/include:$CPATH
export LIBRARY_PATH=$HOME/local/cuda-8.0/lib64:$LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
```
import logging
logger = logging.getLogger(__name__)
from chainer import cuda
def main():
logging.basicConfig(
format='%(asctime)s : %(threadName)s : %(levelname)s : %(message)s',
level=logging.INFO)
@aonotas
aonotas / download_wiki_pageview.sh
Created March 4, 2017 20:18
download Wikipedia Pageview file (english, pageview per hours)
year=2016;
month=09;
for day in `seq -w 1 31` ; do for hour in `seq -w 0 23`; do curl -s https://dumps.wikimedia.org/other/pageviews/${year}/${year}-${month}/pageviews-${year}${month}${day}-${hour}0000.gz | zcat | grep "^en " | cut -d' ' -f2,3,4 > ./pageview/files/${year}-${month}-${day}-${hour}.en.txt; done; done;
import itertools
import os
import numpy
import six
from chainer import cuda
from chainer.functions.activation import lstm
from chainer.functions.array import concat
from chainer.functions.array import reshape