Skip to content

Instantly share code, notes, and snippets.

View noorvir's full-sized avatar

Noorvir Aulakh noorvir

View GitHub Profile
@noorvir
noorvir / scrollable-panel.tsx
Last active February 18, 2024 09:03
Bare minimum hierarchy to enable scrollable component that stretches to fill all available space.
<div style={{ display: 'flex', height: '100vh', flexGrow: 1, flexDirection: 'column' }}>
<div
style={{
display: 'flex',
height: '100%',
flexDirection: 'column',
backgroundColor: 'red',
}}
>
<div style={{ backgroundColor: 'yellow' }}>Element above</div>

Keybase proof

I hereby claim:

  • I am noorvir on github.
  • I am noorvir (https://keybase.io/noorvir) on keybase.
  • I have a public key ASBq_QwtJuQyvEFwjizF-Ty9lAm-6bycSjNG7ARRoxXGqAo

To claim this, I am signing this object:

@noorvir
noorvir / map_and_assign_checkpoint.py
Last active July 18, 2022 11:17
Load pre-trained weights in TensorFlow by mapping variable names in the new model to those in the saved checkpoint.
"""
You sometimes need to load weights from a checkpoint file to a new/different TensorFlow architecture where the
variable names for the layers are different (see example below). For instance, you might need to load the first
few layers of AlexNet pre-trained on ImageNet to your custom model which for some reason has a different naming
convention.
I couldn't find any convinient piece of code to do this; this gist is aimed at addressing this.
Example mapping:
@noorvir
noorvir / neural_net_training_blueprint.py
Created June 12, 2018 10:41
A blueprint class to bunch together most of the boilerplate required to train neural-networks with TensorFlow. It is meant to be general enough to work with any neural net architecture/training regime.
"""
Inspired by:
https://blog.metaflow.fr/tensorflow-a-proposal-of-good-practices-for-files-folders-and-models-architecture-f23171501ae3
Recommended guidelines for child classes:
1) Abstract away common/repeated functionality that remains the same for multiple models whose use is obvious to the
reader.
2) Do not abstract essential parts of the model (such as loss terms, optimisers, layer names). Name these variables