Skip to content

Instantly share code, notes, and snippets.

View visionscaper's full-sized avatar

Freddy Snijder visionscaper

View GitHub Profile
@visionscaper
visionscaper / binder1stCompileErrorXCode4.3
Created April 28, 2012 10:56
C++ compile error in stl_function.h: class member cannot be redeclared (binder1st) (in XCode 4.3.2)
I came across this compile error in XCode 4.3.2: In stl_function.h:
typename _Operation::result_type
operator()(const typename _Operation::second_argument_type& __x) const
{ return op(value, __x); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 109. Missing binders for non-const sequence elements
typename _Operation::result_type
operator()(typename _Operation::second_argument_type& __x) const <--------- Class member cannot be redeclared
@visionscaper
visionscaper / issue_must_feed_value_for_tensor_stateful_submodel_14012018.py
Last active February 5, 2018 15:30
[Python 3.5.2] Script showing that A) predicting and training a Keras model with non-stateful sub-models works, B) predicting and training a Keras model with stateful processing embedded (no sub-model) works, C) training of a Keras model with a stateful sub-model works, BUT predicting does NOT work!. Implementation C) is desired.
from keras.layers import Input
from keras.layers.recurrent import GRU, LSTM, SimpleRNN
from keras.layers.wrappers import TimeDistributed
from keras.layers.core import Dense, Activation, RepeatVector
from keras.layers.merge import Concatenate
from keras.layers import Dropout
from keras.optimizers import Adam
from keras.models import Model
@visionscaper
visionscaper / preprocessing.py
Last active May 18, 2021 17:11
Shared code for GPT-2 demo chatbot
# This gist contains shared code for the Colab demo-chatbot.ipynb and demo-chatbot-inference.ipynb
# Copyright Globescope and Freddy Snijder.
# License "GNU General Public License v3.0"
# Also see https://choosealicense.com/licenses/gpl-3.0/
from enum import Enum
import re
@visionscaper
visionscaper / settting_up_tpu_for_pytorch_gcloud.md
Last active December 18, 2023 11:09
Setting up a TPU and Ubuntu VM instance for use with Pytorch on Google Cloud
@visionscaper
visionscaper / test_gather_deadlock.py
Last active October 8, 2023 10:09
Tensorflow distribution strategy gather hangs
import tensorflow as tf
import numpy as np
def load_data():
fashion_mnist = tf.keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
# Adding a dimension to the array -> new shape == (28, 28, 1)
@visionscaper
visionscaper / gist:a5b1d8c5a95b08958aefd2a2591a1045
Created May 3, 2024 11:51
MLPug persona chatbot training example used for testing 6xAMD MI100 experimental server build
python examples/persona_chatbot/pytorch/train.py \
--experiment-name persona-bot-6xMI100 \
--num-dataloader-workers 2 \
--use-mixed-precision \
--batch-size 30 \
--batch-chunk-size 10 \
--num-choices 8 \
--sequence-length-outlier-threshold 0.05 \
--learning-rate 6.25e-5 \
--lr-warmup-schedule \