This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Useful learning rate schedulers | |
Warmup | |
CosineAnnealingLRWarmup | |
""" | |
import torch | |
import math | |
import functools | |
def _cosine_decay_warmup(iteration, warmup_iterations, total_iterations): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "${CUDA_VISIBLE_DEVICES}" = "auto" ] | |
then | |
# number of gpus | |
NUMGPUS=`nvidia-smi -q -d MEMORY | grep "Attached GPU" | grep -P -o "\d"` | |
echo "NUMGPUS: $NUMGPUS" | |
# extract free-memory for each gpu | |
MEMLIST="ID FREEMEM" | |
for (( DEVICE=0; DEVICE<${NUMGPUS}; DEVICE++ )) | |
do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from keras.models import Model | |
from keras.layers import Dense, Activation, Lambda, Input | |
import keras.backend as K | |
from keras.utils import to_categorical | |
# Model definition | |
def foo(ip): | |
a = ip[1] | |
x = ip[0] |