Skip to content

Instantly share code, notes, and snippets.

Christian Schell cschell

Block or report user

Report or block cschell

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
View train.py
losses = []
loss_function = nn.NLLLoss()
model = LeModel(len(vocab))
optimizer = optim.SGD(model.parameters(), lr=0.001)
for epoch in tqdm(range(1), leave=False):
total_loss = 0
for context, target in tqdm(data, leave=False):
model.zero_grad()
View model.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class CBOW(nn.Module):
def __init__(self, vocab_size: int, embedding_dim: int = 100, context_size: int = 4):
super(CBOW, self).__init__()
self.embeddings = nn.Embedding(vocab_size, embedding_dim)
self.linear1 = nn.Linear(context_size * embedding_dim, 128)
@cschell
cschell / Dockerfile
Last active Mar 14, 2019
Dockerfile for building MVIG-SJTU/AlphaPose
View Dockerfile
# based on [sberryman/Dockerfile.yml](https://gist.github.com/sberryman/82a6d13a44f9c4a3bfaf9263b36c92ed)
# You need the cuda drivers and [nvidia-docker](https://github.com/NVIDIA/nvidia-docker)
#
# build with
# docker build .
#
# run with
# docker run --runtime=nvidia -it --rm -v $(realpath ./data):/root/AlphaPose/data [imagename] ./run.sh --indir=/root/AlphaPose/data/in/ --outdir=data/out
FROM nvidia/cuda:8.0-cudnn5-devel
@cschell
cschell / sample.ipynb
Created Apr 29, 2018
Sample for `gp_minimize` result problem
View sample.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cschell
cschell / last_game.rb
Last active Feb 11, 2019
This script queries the RIOT-API for the last game of a summoner
View last_game.rb
# Usage: ruby last_game.rb <summoner_name> <na/euw/...>
require "net/http"
require "json"
require "date"
# TODO: Insert your own key here!
API_KEY = "<YOUR-RIOT-API-KEY-HERE>"
@summoner_name = ARGV[0]
@cschell
cschell / delete_old_backups.sh
Created Aug 8, 2014
Delete backups that are x days old (from ftp server)
View delete_old_backups.sh
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+%Y-%m-%d_'`*; exit"
# make sure to escape % for cron:
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+\%Y-\%m-\%d_'`*; exit"
@cschell
cschell / postgres_ftp_backup.sh
Created Aug 8, 2014
Backup gziped postgresql dump to a ftp server
View postgres_ftp_backup.sh
# shell command:
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+%Y-%m-%d_%H-%M'`/db_backup.sql.gz --ftp-create-dirs -T -
# if you want to execute it through cron, be sure to escape all %!
# for crontab:
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+\%Y-\%m-\%d_\%H-\%M'`/db_backup.sql.gz --ftp-create-dirs -T -
View gist:10317378
### Keybase proof
I hereby claim:
* I am cschell on github.
* I am cschell (https://keybase.io/cschell) on keybase.
* I have a public key whose fingerprint is D5A4 78EF 6166 5BAC A6D5 E6AC 4BED 524B 758B D750
To claim this, I am signing this object:
You can’t perform that action at this time.