Skip to content

Instantly share code, notes, and snippets.

@przemb
przemb / dinobot_oneshot_il.py
Created March 13, 2024 22:06 — forked from normandipalo/dinobot_oneshot_il.py
Code snippet for the one-shot imitation learning phase of DINOBot (alignment + replay).
"""
In this script, we demonstrate how to use DINOBot to do one-shot imitation learning.
You first need to install the following repo and its requirements: https://github.com/ShirAmir/dino-vit-features.
You can then run this file inside that repo.
There are a few setup-dependent functions you need to implement, like getting an RGBD observation from the camera
or moving the robot, that you will find on top of this file.
"""
import torch
import numpy as np
@przemb
przemb / reproducibility.md
Created August 13, 2023 12:37 — forked from Guitaricet/reproducibility.md
Notes on reproducibility in PyTorch

Reproducibility

ML experiments may be very hard to reproduce. You have a lot of hyperparameters, different dataset splits, different ways to preprocess your data, bugs, etc. Ideally, you should log data split (already preprocessed), all hyperparameters (including learning rate scheduling), the initial state of your model and optimizer, random seeds used for initialization, dataset shuffling and all of your code. Your GPU is also should be in deterministic mode (which is not the default mode). For every single model run. This is a very hard task. Different random seed can significantly change your metrics and even GPU-induced randomness can be important. We're not solving all of these problems, but we need to address at least what we can handle.

For every result you report in the paper you need (at least) to:

  1. Track your model and optimizer hyperparameters (including learning rate schedule)
  2. Save final model parameters
  3. Report all of the parameters in the pap
@przemb
przemb / gist:cc7309a13d76d0f75330d84c9e4250d6
Created January 25, 2020 14:53
Failing integration tests - fasttext
pb@pb:~/dev/Projects/fastText$ python3 runtests.py -i --data-dir=/home/pb/dev/Projects/fastText/tests/data
test_sup_0_ag_news (fasttext.tests.test_script.gen_tests.<locals>.TestFastTextPy) ...
Read 5M words
Number of words: 95811
Number of labels: 4
Progress: 100.0% words/sec/thread: 2294324 lr: 0.000000 avg.loss: 0.161548 ETA: 0h 0m 0s
Progress: 100.0% words/sec/thread: 1516129 lr: 0.000000 avg.loss: 0.066035 ETA: 0h 0m 0s
FAIL
test_sup_10_langid (fasttext.tests.test_script.gen_tests.<locals>.TestFastTextPy) ...
@przemb
przemb / glove_fixed_complete
Created January 19, 2020 22:22
Fixed memory violations - GLOVE - complete report.
pb@pb:~/dev/Projects/glove$ valgrind --leak-check=yes ./build/vocab_count -min-count 5 -verbose 2 < text8 > vocab.txt
==31969== Memcheck, a memory error detector
==31969== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==31969== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==31969== Command: ./build/vocab_count -min-count 5 -verbose 2
==31969==
BUILDING VOCABULARY
Processed 17005207 tokens.
Counted 253854 unique words.
Truncating vocabulary at min count 5.
@przemb
przemb / glove_fixed_short
Last active January 19, 2020 22:21
Fixed memory violations - GLOVE - short report.
pb@pb:~/dev/Projects/glove$ valgrind --leak-check=yes ./build/vocab_count -min-count 5 -verbose 2 < text8 > vocab.txt
BUILDING VOCABULARY
Processed 17005207 tokens.
Counted 253854 unique words.
Truncating vocabulary at min count 5.
Using vocabulary of size 71290.
==31969==
==31969== HEAP SUMMARY:
@przemb
przemb / original_complete.txt
Last active January 19, 2020 22:16
Memory violations - GLOVE - full report.
pb@pb:~/dev/Projects/glove$ valgrind --leak-check=yes ./build/vocab_count -min-count 5 -verbose 2 < text8 > vocab.txt
==627== Memcheck, a memory error detector
==627== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==627== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==627== Command: ./build/vocab_count -min-count 5 -verbose 2
==627==
BUILDING VOCABULARY
Processed 17005207 tokens.
Counted 253854 unique words.
Truncating vocabulary at min count 5.
@przemb
przemb / original_short.txt
Last active January 19, 2020 22:17
Memory violations - GLOVE - short report
pb@pb:~/dev/Projects/glove$ valgrind --leak-check=yes ./build/vocab_count -min-count 5 -verbose 2 < text8 > vocab.txt
BUILDING VOCABULARY
Processed 17005207 tokens.
Counted 253854 unique words.
Truncating vocabulary at min count 5.
Using vocabulary of size 71290.
....
==627== LEAK SUMMARY: