Skip to content

Instantly share code, notes, and snippets.

View BenjaminWegener's full-sized avatar
🙃
I may be slow to respond.

@BenjaminWegener BenjaminWegener

🙃
I may be slow to respond.
View GitHub Profile
@BenjaminWegener
BenjaminWegener / conda keras api change
Created November 30, 2017 07:30
change the version to keras v1 or keras v2 to use the other api under anaconda
conda install keras=1.0.7 -c conda-forge
OR
conda install keras=2.0.9 -c conda-forge
@BenjaminWegener
BenjaminWegener / readme
Last active May 8, 2021 09:20
android xmrig install
install termux from play store or aptoide
termux-setup-storage
pkg install cmake git libuv* openssl-dev unstable-repo -y
pkg install libmicrohttpd-dev -y
git clone https://github.com/xmrig/xmrig
cd xmrig && mkdir build && cd build
cmake ..
make
cp xmrig ..
@BenjaminWegener
BenjaminWegener / andronix.md
Last active January 1, 2024 07:19
install xfce debian in termux android
@BenjaminWegener
BenjaminWegener / andronix.md 2
Created July 7, 2019 19:34
install arch linux in termux
pkg install wget openssl-tool proot tar -y && hash -r && wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Arch/armhf/arch.sh && bash arch.sh
pacman -Sy --noconfirm wget && wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/DesktopEnvironment/Pacman/de-pac.sh && bash de-pac.sh
@BenjaminWegener
BenjaminWegener / sub_pixel_conv.py
Created December 6, 2019 10:35
Keras only 2x pixel-shuffle / sub_pixel_conv
def sub_pixel_conv(inputs, height, width, out_channels): #keras version of 2x pixel shuffle
x = inputs
x = SeparableConv2D(out_channels * 4, kernel_size = 9, depth_multiplier = 1, activation = 'tanh', padding = 'same')(x)
x = Reshape((height, width, out_channels, 2, 2))(x)
x = Permute((3, 2, 4, 1, 5))(x)
x = Reshape((out_channels, height * 2, height * 2))(x)
x = Permute((2, 3, 1))(x)
return x
@BenjaminWegener
BenjaminWegener / colab.js
Last active December 18, 2019 04:50
auto reconnect google colab bookmarklet
javascript:(function(){
console.log("Working");
document.querySelector("colab-toolbar-button#connect").click()
}.setInterval(60000))
@BenjaminWegener
BenjaminWegener / bpe.js
Created December 15, 2020 15:43 — forked from atdt/bpe.js
var assert = require( 'assert' );
function findFrequentBigram( s ) {
var i, freqs = {}, topFreq = 0, topPair = null, bigram;
for ( i = 0; i < s.length; i += 2 ) {
bigram = s.slice( i, i + 2 );
freq = ++freqs[bigram];
@BenjaminWegener
BenjaminWegener / attention_layer_tfjs
Created April 14, 2021 18:02
Causal Attention Layer Tensorflow.js
//---------------------------------------------------
//setup
var dModel = 256; //dimension of embedding
var INPUTSIZE = 1024; //length of input
var BLOCKS = 3;
var LEARNING_RATE = 0.003;
var OPTIMIZER = tf.train.adam(LEARNING_RATE, beta_1 = 0.85, beta_2 = 0.9, epsilon = 1e-9);
var LOSS = 'categoricalCrossentropy';
var INITIALIZER = 'GlorotUniform';
@BenjaminWegener
BenjaminWegener / entfox.py
Last active November 1, 2022 11:28 — forked from justheuristic/entfox.py
updated for > tf2.0
import tensorflow as tf
def entmax15(inputs, axis=-1):
"""
Entmax 1.5 implementation, heavily inspired by
* paper: https://arxiv.org/pdf/1905.05702.pdf
* pytorch code: https://github.com/deep-spin/entmax
:param inputs: similar to softmax logits, but for entmax1.5
:param axis: entmax1.5 outputs will sum to 1 over this axis
:return: entmax activations of same shape as inputs

Install armhf debian system on qemu

Environment

Operation system: Raspbery Pi OS (Debian 10)

QEMU emulator version: 2+

Installation