Skip to content

Instantly share code, notes, and snippets.

View mehdidc's full-sized avatar

Mehdi Cherti mehdidc

View GitHub Profile
#!/usr/bin/env bash
set -e
cd
case "$OSTYPE" in
darwin*) DOWNLOAD=https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh ;;
linux*) DOWNLOAD=https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh ;;
*) echo "unknown: $OSTYPE" ;;
esac
@mehdidc
mehdidc / tensorboard_to_csv.py
Created June 21, 2020 11:54
tensorboard_to_csv
#Credits to https://stackoverflow.com/questions/49697634/tensorboard-export-csv-file-from-command-line
from collections import defaultdict
import argparse
import numpy as np
import tensorflow as tf
from clize import run
import pandas as pd
def save_tag_to_csv(fn):
sess = tf.InteractiveSession()
#!/bin/bash
# This file sets the environment variable CUDA_VISIBLE_DEVICES to the MPI local rank to enable multi-GPU usage of this benchmark. Note that this disables any GPU distribution handling by he batch scheduler.
# Background: Most/some batch schedulers set CUDA_VISIBLE_DEVICES to all available GPUs on a node. In that case, the Arbor benchmark would only use the first entry in the list, probably GPU#0. This script changes that.
# -Andreas Herten, Nov 2018
_verbose=1
localrank=$CUDA_VISIBLE_DEVICES
if [[ -n "$OMPI_COMM_WORLD_NODE_RANK" ]]; then
@mehdidc
mehdidc / scanner.sh
Created May 12, 2020 20:50 — forked from andyrbell/scanner.sh
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@mehdidc
mehdidc / nes.py
Created December 24, 2018 13:25 — forked from karpathy/nes.py
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
"""
A bare bones examples of optimizing a black-box function (f) using
Natural Evolution Strategies (NES), where the parameter distribution is a
gaussian of fixed standard deviation.
"""
import numpy as np
np.random.seed(0)
# the function we want to optimize

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@mehdidc
mehdidc / tensorflow_finetune.py
Created June 8, 2018 07:03 — forked from omoindrot/tensorflow_finetune.py
Example TensorFlow script for fine-tuning a VGG model (uses tf.contrib.data)
"""
Example TensorFlow script for finetuning a VGG model on your own data.
Uses tf.contrib.data module which is in release v1.2
Based on PyTorch example from Justin Johnson
(https://gist.github.com/jcjohnson/6e41e8512c17eae5da50aebef3378a4c)
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
```
wget http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz
{
"embeddings": [
{
"tensorName": "WIPO",
"tensorShape": [
5799,
300
],
"tensorPath": "https://files.fm/down.php?i=yrkmskvv",
"metadataPath": "https://gist.githubusercontent.com/mehdidc/af6727cec814cb37a9bc36f6620bc288/raw/383d6805b294397307b659242328cd446cfded1f/labels.tsv"
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
portable bath bench/seat
bathtub
bath for invalid
a multi-purpose shower device
children's bath
a foot care device
a showering appliance
knockdown bath bench
safety devices
a shower-bath booth structure
"FIRST do : curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
set autoindent
set nocindent
set nosmartindent
set autoindent
set indentexpr=
set tabstop=8
set expandtab
set shiftwidth=4
set softtabstop=4