Skip to content

Instantly share code, notes, and snippets.

View vict0rsch's full-sized avatar
🌍
AI vs Climate Change

Victor Schmidt vict0rsch

🌍
AI vs Climate Change
View GitHub Profile
@vict0rsch
vict0rsch / protonmail-read.js
Last active February 22, 2022 15:21
Protonmail bulk "mark as read" and "move to trash" workarounds
// -----------------------
// ----- Functions -----
// -----------------------
/**
*
* @param {string} testId The string id for the element to find,
* matchec against elements' `data-testid` attribute.
* @returns HTML element
*/
@vict0rsch
vict0rsch / streaming_multilabel_f1_score.py
Last active March 16, 2021 03:17
Streaming and Multilabel F1 score in Tensorflow
# From my blog post: http://vict0rsch.github.io/2018/06/06/tensorflow-streaming-multilabel-f1/
import tensorflow as tf
import numpy as np
from tensorflow.python.ops import variable_scope
from tensorflow.python.ops import array_ops
from tensorflow.python.framework import ops
from sklearn.metrics import f1_score
GPU fp32 GPU fp16 TPU fp32* TPU fp16*
Largest batch size 32 64 1024 2048
Min-inference batch size 4 64 1024 2048
Masker inference (s/i) 0.059 0.019 3.80e-5 1.36e-5
Painter inference (s/i) 0.068 0.041 2.53e-5 1.16e-5
Inference loop (s) 130.382 60.567 0.073 0.0392
Inference loop (i/s) ~8 ~17 ~14 000 ~26 000
Full dataset with loading (s) 151.546 76.953 18.05 15.31
Total Device -> CPU (s) 2.816 2.528 inf inf
@vict0rsch
vict0rsch / milacheatsheet.md
Last active June 18, 2020 13:07
Mila's cluster cheat sheet

Mila Cluster Cheat Cheat

This is merely an introduction to get you started quickly. This does not replace Mila's official cluster documentation => docs.mila.quebec which you should definitely go through, thoroughly before you start using the cluster.

Before starting: get your Mila cluster account ready. Should look something like surname[:6]firstname[0] but this may vary, it’s not a necessary condition.

@vict0rsch
vict0rsch / doudou-web.md
Created March 4, 2020 13:51
Ressources Doudou
from pathlib import Path
import re
from rstcloth.rstcloth import RstCloth
if __name__ == "__main__":
conf = Path() / "conf.txt"
clusterdest = Path() / "clusterconf.rst"
clouddest = Path() / "cloudconf.rst"
with conf.open("r") as f:
lines = [l.strip() for l in f.readlines()]
[
{
"key": "ctrl+shift+left",
"command": "workbench.action.previousEditor"
},
{
"key": "ctrl+alt+cmd+5",
"command": "-workbench.action.previousEditor"
},
{
[Info - 11:44:14 PM] Analysis cache path: /Users/victor/Library/Caches/Microsoft/Python Language Server
[Info - 11:44:14 PM] Microsoft Python Language Server version 0.5.10.0
[Info - 11:44:14 PM] Workspace root: /Users/victor/Documents/Experiments/torch
[Info - 11:44:14 PM] GetCurrentSearchPaths /Users/victor/Documents/Experiments/torch/nndebug/bin/python
[Info - 11:44:14 PM] Interpreter search paths:
[Info - 11:44:14 PM] /Users/victor/.pyenv/versions/3.6.9/lib/python3.6
[Info - 11:44:14 PM] /Users/victor/.pyenv/versions/3.6.9/lib/python3.6/lib-dynload
[Info - 11:44:14 PM] /Users/victor/Documents/Experiments/torch/nndebug/lib/python3.6/site-packages
[Info - 11:44:14 PM] User search paths:
[Info - 11:44:18 PM] Initializing for /Users/victor/Documents/Experiments/torch/nndebug/bin/python
[Info - 1:16:10 PM] Analysis cache path: /Users/victor/Library/Caches/Microsoft/Python Language Server
[Info - 1:16:10 PM] Microsoft Python Language Server version 0.4.127.0
[Info - 1:16:10 PM] Workspace root: /Users/victor/Documents/Experiments/torch
[Info - 1:16:11 PM] GetCurrentSearchPaths /Users/victor/Documents/Experiments/torch/nndebug/bin/python
[Info - 1:16:11 PM] Interpreter search paths:
[Info - 1:16:11 PM] /Users/victor/.pyenv/versions/3.6.9/lib/python3.6
[Info - 1:16:11 PM] /Users/victor/.pyenv/versions/3.6.9/lib/python3.6/lib-dynload
[Info - 1:16:11 PM] /Users/victor/Documents/Experiments/torch/nndebug/lib/python3.6/site-packages
[Info - 1:16:11 PM] User search paths:
[Info - 1:16:14 PM] Initializing for /Users/victor/Documents/Experiments/torch/nndebug/bin/python
[Info - 5:00:33 PM] Analysis cache path: /Users/victor/Library/Caches/Microsoft/Python Language Server
[Info - 5:00:33 PM] Microsoft Python Language Server version 0.4.114.0
[Info - 5:00:33 PM] Workspace root: /Users/victor/Documents/ccai/github/omnigan
[Info - 5:00:34 PM] GetCurrentSearchPaths /Users/victor/Documents/ccai/github/omnigan/omnienv/bin/python
[Info - 5:00:34 PM] Interpreter search paths:
[Info - 5:00:34 PM] /Users/victor/.pyenv/versions/3.7.4/lib/python3.7
[Info - 5:00:34 PM] /Users/victor/.pyenv/versions/3.7.4/lib/python3.7/lib-dynload
[Info - 5:00:34 PM] /Users/victor/Documents/ccai/github/omnigan/omnienv/lib/python3.7/site-packages
[Info - 5:00:34 PM] User search paths:
[Info - 5:00:37 PM] Initializing for /Users/victor/Documents/ccai/github/omnigan/omnienv/bin/python