In the middle of the desert you can say anything you want
A Snowclone is a cliché and phrasal template that can be used and recognized in multiple variants.
Examples:
The Annotated Transformer seems the very best explanation I’ve found. It’s a Jupyter notebook, very detailed and containing an implementation. Link found here: course-nlp/8-translation-transformer.ipynb at master · fastai/course-nlp which in turn is a Jupyter Notebook used in this nice Youtube video lecture: Introduction to the Transformer (NLP video 17) - YouTube.
In this post I present an “annotated” version of the paper in the form of a line-by-line implementation. I have reordered and deleted some sections from the original paper and added comments throughout.
In general everything posted by the Harvard NLP team is very interesting for me especially: Code. It’s all nicely visualized and/or with source code.
watch
commandIt runs a command continuously and updates the screen when the output changes. Found in my zsh history, watch nvidia-smi
is one example.
Heaps’ law - Wikipedia “is an empirical law which describes the number of distinct words in a document (or set of documents) as a function of the document length (so called type-token relation)”. In “See also” it has quite a large amound of other “laws” which may be interesting.
unittest
@skipUnless
Python unit testingmodels/transformer_main_test.py at master · tensorflow/models uses a neat thing:
@unittest.skipUnless(tf.test.is_built_with_cuda(), 'requires GPU')
def test_train_1_gpu_with_dist_strat(self):
FLAGS.distribution_strategy = 'one_device'
t = transformer_main.TransformerTask(FLAGS)
t.train()}
Yet another change to the layout - now compose lives on rwin:
setxkbmap -option -option 'grp:rctrl_toggle, compose:rwin' v4,ru &
This makes the entire file as follows:
setxkbmap -option -option 'grp:rctrl_toggle, compose:rwin' v4,ru &
xrandr --output HDMI-2 --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-1 --off --output DP-1 --off --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-2 --off
xcape -e 'Control_L=Escape' -t 100 &
xmodmap ~/s/mod4 &
keynav &
To get requests
one has to install requests-html
. requests
might already be installed.
Why did I get ModuleNotFoundError
instead of ImportError
? Apparently it’s new in Python 3.6 and it’s a subclass of ImportError
, just more precise; catching ImportError
would work for it too.
From naming - What are the different kinds of cases? - Stack Overflow:
myvariable
my-variable
(this is the most famous. Other names include: caterpillar case, dash case, hyphen case, lisp case, spinal case and css-case)myVariable
MyVariable
(other names: capital camel case)my_variable
(other names: c case)MY_VARIABLE
(other names: upper case)COBOL-CASE
(other names: Train case)The following inside the .vimrc moves the selected line to the end of the file and takes the cursor back:
map <C-d> dGp''
For details, cursor movement - How do I jump to the location of my last edit? - Vi and Vim Stack Exchange.
From the first answer:
The
`.
command will bring you to your last change.The
`
goes to a mark, and.
is a “special” mark which is automatically set to the position where the last change was made. See:help `.
for some more information.There is also
``
which will bring you back to where the cursor was before you made your last jump. See :help``
for more information.Another useful mark is
`^
; this is the position where the cursor was the last time when insert mode was stopped. See:help `^
.See
:help mark-motions
for some more general info about using marks (including some other “special” marks that are automatically set).
tf.math.count_nonzero()
works for booleans, as in “number of True elements in tensor”
Tutorial: Why Functions Modify Lists, Dictionaries in Python just got bitten by this again :)
TL;DR lists and dicts are mutable, therefore if I pass them to a function and it does stuff to it they will get changed outside the function too. dict.copy()
helps.
concat.sh
to dtbOne thing which I continuously missed was a way to quickly search through all the files visually - :Ag
as fuzzy search is a really nice solution, but I still like the usual way.
So now the following was added:
cat * | grep -v "layout: post" | grep -v "categories: \[\]" > ../master_file.md
This is purely a text file that I plan to work with as a text file (though it gets compiled to .html during deployment), and we’ll see what happens next with it.
Compass rose - Wikipedia, especially the names of the winds. I wonder if they could become names for hostnames/servers or something.
Simple Introduction to Convolutional Neural Networks is really nice and has pictures of swans.
Changed zsh alias to alias s='task s sprint.is:$SPRINT or sprint:c'
, it didn’t have the .is
before showing me 40, 41… for sprint 4 etc.
For next year:
10270 for i in $(seq 4 9 52)\nt add project:h +MOD sprint:$i change toothbrush 10272 for i in $(seq 4 4 52)\nt add project:h +MOD sprint:$i Master monthly backup
And let’s come back to an old favourite of this Diensttagebuch…
Today's Sets 1.D3B 86% 1m. 27s. 2.D4B 56% 1m. 48s. 3.D4B 28% 1m. 48s. 4.D4B 39% 1m. 48s. 5.D4B 39% 1m. 48s
Ctrl+F4
closes the current tab, which is not too easy to type. But I set a nice shortcut Ctrl-I
which is not, action is “Close all unmodified”, it closes all the tabs I usually close manually - all internal TF stuffs that open when debugging and that I don’t want to change or edit (but breakpoints are okay, and they don’t seem to count as “modification”)
go
is the default shortcut for this.
This is very nice and easy and easy to forget:
mask = tf.not_equal(inputs, '')
It has sisters such as tf.math.less
, etc.
tf.assertEqual(x, y)
exists, can be used in unittests as is, if it raises an error the test automatically fails.
This is awesome! Right click on class name -> Generate -> Test, and this creates a boilerplate file with the right name and right methods.
TIL that values considered true/false without being explicitly True/False have a name, and from python - What is Truthy and Falsy? How is it different from True and False? - Stack Overflow here’s a handy list of them:
All values are considered “truthy” except for the following, which are “falsy”:
None
False
0
0.0
0j
Decimal(0)
Fraction(0, 1)
[]
- an empty list
{}
- an empty dict
()
- an empty tuple
''
- an empty str
b''
- an empty bytes
set()
- an empty set
range
, like range(0)
obj.__bool__()
returns False
obj.__len__()
returns 0
A “truthy” value will satisfy the check performed by if
or while
statements. We use “truthy” and “falsy” to differentiate from the bool
values True
and False
.