friendship ended with earlyoom
, now nohang
is my best friend
Published:
Published:
Siamese network is an architecture which runs two networks with shared weights (effectively runs the same network twice) on two different inputs simultaneously. It is commonly trained with a contrastive loss such as triplet loss in order to draw together the representations of similar inputs and push apart the representations of contrasting inputs.
Published:
Use ${BASH_SOURCE[0]}
to reference the filepath of a Bash script. Unlike $0
, this works if the script is called via bash script.sh
or source script.sh
.
Published:
webcam-mods is the best method I have found for webcam background blur/swap on Linux. I use this for my meetings on Google Meet and Webex.
Published:
I fell into the habit of using any()
to check if a list is empty. It’s nice because it works for any enumerable, including generators, even if len()
is not defined. However, it has a pitfall where if the list is nonempty but contains only falsy values, any()
returns False
. For this reason, I advise to use len()
to check if a list is empty.
Published:
You may know that you can use head -n $n
to get the first N lines of a list. But you may not know that you can supply n=-0
to get all items in the list.
Published:
Recently I wanted to write program logs to a file, then copy it to the directory where I store my checkpoints. Because I want to log things before I create the checkpoint directory, I attached my logger to a file in my root directory.
Published:
PyTorch Lightning + TorchMetrics can log metrics per step and per epoch. It also has MetricCollection
, which can be used to compute several metrics at once, getting rid of redundant code. Here is how I have it set up:
Published:
Use this snippet to print a pd.Series
of floats as percentages.
.apply(lambda x: x * 100).apply("{:,.2f}%".format)
Published:
Encoder decoder is a deep neural network architecture that consists of 2 components:
Published:
I can use jq
to print the keys in an array of JSON objects quickly.
jq '.[0] | keys[]' $filename
Published:
Embeddings are used to map high-dimensional data to low-dimensional floating-point representation. This may improve the performance because it improves the representation of the input given to the model.