Skip to content

Instantly share code, notes, and snippets.

View pltrdy's full-sized avatar

Paul Tardy pltrdy

View GitHub Profile
def scatter_hist(x, y, xlabel="", ylabel="", title="", left=0.1, width=0.65,
bottom=0.1, height=0.65, figsize=(8,8,),
ortho=False,
xbinwidth=None,
ybinwidth=None,
binwidth=5):
# scatter hist from [1] with small tweaks to work with different
# distributions on X and Y:
# [1]: https://matplotlib.org/examples/pylab_examples/scatter_hist.html
@pltrdy
pltrdy / cmp_models.py
Created September 30, 2019 16:15
Comparing ONMT checkpoint files
#!/usr/bin/env python3
import torch
def model_equals(model1, model2):
for p1, p2 in zip(model1.values(), model2.values()):
if p1.data.ne(p2.data).sum() > 0:
return False
return True
#!/usr/bin/env python
"""
https://twitter.com/ThomasCabaret84/status/1103324141493600256i
"""
import torch
def run(b, n=100, in_a_row=3):
"""
Expérience du lancer de pièce.
Une pièce parfaitement équilibrée est lancée `n` fois.
@pltrdy
pltrdy / t2t_lmptb_10k.sh
Created July 3, 2017 08:52
Running PTB LM (10k vocabulary) benchmark with tensor2tensor
#!/bin/bash
set -e
source activate tensorflow
# See what problems, models, and hyperparameter sets are available.
# You can easily swap between them (and add new ones).
#t2t-trainer --registry_help
@pltrdy
pltrdy / install.sh
Last active July 8, 2016 09:26 — forked from domderen/install.sh
Installation of apache spark on ubuntu machine.
#!/bin/sh
# stop execution on error
set -e
# installation of Oracle Java JDK.
sudo apt-get -y update
sudo apt-get -y install python-software-properties
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get -y update