Comparing networks#
Comparing networks: Characterizing computational similarity in task-trained recurrent neural networks
By Neuromatch Academy
Content creators: Chris Versteeg
Content reviewers: Chris Versteeg, Hannah Choi, Eva Dyer
Production editors: Konstantine Tsafatinos, Ella Batty, Spiros Chavlis, Samuele Bolotta, Hlib Solodzhuk
Background#
Researchers training artificial networks to perform tasks (e.g., image classification, motor control) have found that the activity in the artificial networks can resemble the activity of biological neurons from brain areas thought to perform similar tasks. Unfortunately, it is unclear whether a superficial similarity in neural activation necessarily translates to a conserved computational strategy. We need ways to assess how well different models are able to capture the computational principles, which will require datasets where the ground-truth computations are known, and we can analyze the similarity between artificial and natural systems. The aim of this project is to explore ways to measure alignment in dynamical systems, and to study different approaches to quantify the changes in representations across different tasks and across different architectures.
Install and import feedback gadget#
Show code cell source
# @title Install and import feedback gadget
!pip install vibecheck datatops --quiet
from vibecheck import DatatopsContentReviewContainer
def content_review(notebook_section: str):
return DatatopsContentReviewContainer(
"", # No text prompt
notebook_section,
{
"url": "https://pmyvdlilci.execute-api.us-east-1.amazonaws.com/klab",
"name": "neuromatch_neuroai",
"user_key": "wb2cxze8",
},
).render()
feedback_prefix = "Project_ComparingNetworks"
Project Background#
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_project_background")
Project slides#
If you want to download the slides: https://osf.io/download/vb3tw/
Project Template#
Show code cell source
#@title Project Template
from IPython.display import Image, display
import os
from pathlib import Path
url = "https://github.com/neuromatch/NeuroAI_Course/blob/main/projects/project-notebooks/static/ComputationalSimilarityTemplate.png?raw=true"
display(Image(url=url))

Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_project_template")
In this notebook, we are going to provide code to get you started on Q1-Q3 of this project!
The basic outline looks like this:
Section 1: Preparing the environment.
Section 2: Overview of the available tasks.
Section 3: Understanding the Three-Bit Flip-Flop task (3BFF).
Section 4: Training a model to perform 3BFF.
Section 5: Inspecting the performance of trained models.
Part 1: Visualizing latent activity
Part 2: Quantifying latent similarity with State R2.
Part 3: Visualizing Fixed-Point architectures.
Section 6: Introduction to Random Target task.
Importantly, we’ve put landmarks in the notebook to indicate:
Interactive exercises
❓❓❓
Cells that will a decent amount of time to run (>5 mins)
⏳⏳⏳
Tutorial links
This project is mostly associated with the materials presented in W1D3, on comparing activities of artificial and biological networks. One of the main techniques here, DSA, completes and empowers your toolbox by enabling dynamic analysis of activity patterns. You will find the Tutorial 2 from the W1D1 the most similar by the model’s architecture and the idea of goal-oriented networks.
Section 1: Preparing the environment#
Disclaimer: As an alternative to Google Colab, Kaggle, and local installation, we have prepared a Dockerfile with the instructions on the virtual environment setup. It will allow you to work locally with no interventions into already installed packages (you will just need to install Docker and run two commands). Grab a Dockerfile, put it in the same folder as this notebook, and follow the instructions in README file.
IF USING COLAB // KAGGLE:
Uncomment the lines of code below and run them in order. The top, the second, and the last cells only need to be run once, but the third cells (envStr) need to be re-run if the Colab // Kaggle notebook crashes. These blocks install the needed dependencies and set up your environment. Notice that the first and third cell contents depend on whether you use Colab or Kaggle.
⏳⏳⏳
Colab // Kaggle installation (Part 1)
Show code cell source
# @markdown Colab // Kaggle installation (Part 1)
! git clone https://github.com/neuromatch/ComputationThruDynamicsBenchmark
%cd ComputationThruDynamicsBenchmark
! pip install -e .
## RUN THIS CELL, THEN RESTART SESSION AS PROMPTED (BUTTON AT BOTTOM OF THIS CELL'S FINISHED OUTPUT). DO NOT NEED TO RUN AGAIN
## PLEASE RESTART THE ENVIRONMENT FOR KAGGLE MANUALLY (Run > Restart & clear cell outputs)
Cloning into 'ComputationThruDynamicsBenchmark'...
remote: Enumerating objects: 3359, done.
remote: Counting objects: 0% (1/585)
remote: Counting objects: 1% (6/585)
remote: Counting objects: 2% (12/585)
remote: Counting objects: 3% (18/585)
remote: Counting objects: 4% (24/585)
remote: Counting objects: 5% (30/585)
remote: Counting objects: 6% (36/585)
remote: Counting objects: 7% (41/585)
remote: Counting objects: 8% (47/585)
remote: Counting objects: 9% (53/585)
remote: Counting objects: 10% (59/585)
remote: Counting objects: 11% (65/585)
remote: Counting objects: 12% (71/585)
remote: Counting objects: 13% (77/585)
remote: Counting objects: 14% (82/585)
remote: Counting objects: 15% (88/585)
remote: Counting objects: 16% (94/585)
remote: Counting objects: 17% (100/585)
remote: Counting objects: 18% (106/585)
remote: Counting objects: 19% (112/585)
remote: Counting objects: 20% (117/585)
remote: Counting objects: 21% (123/585)
remote: Counting objects: 22% (129/585)
remote: Counting objects: 23% (135/585)
remote: Counting objects: 24% (141/585)
remote: Counting objects: 25% (147/585)
remote: Counting objects: 26% (153/585)
remote: Counting objects: 27% (158/585)
remote: Counting objects: 28% (164/585)
remote: Counting objects: 29% (170/585)
remote: Counting objects: 30% (176/585)
remote: Counting objects: 31% (182/585)
remote: Counting objects: 32% (188/585)
remote: Counting objects: 33% (194/585)
remote: Counting objects: 34% (199/585)
remote: Counting objects: 35% (205/585)
remote: Counting objects: 36% (211/585)
remote: Counting objects: 37% (217/585)
remote: Counting objects: 38% (223/585)
remote: Counting objects: 39% (229/585)
remote: Counting objects: 40% (234/585)
remote: Counting objects: 41% (240/585)
remote: Counting objects: 42% (246/585)
remote: Counting objects: 43% (252/585)
remote: Counting objects: 44% (258/585)
remote: Counting objects: 45% (264/585)
remote: Counting objects: 46% (270/585)
remote: Counting objects: 47% (275/585)
remote: Counting objects: 48% (281/585)
remote: Counting objects: 49% (287/585)
remote: Counting objects: 50% (293/585)
remote: Counting objects: 51% (299/585)
remote: Counting objects: 52% (305/585)
remote: Counting objects: 53% (311/585)
remote: Counting objects: 54% (316/585)
remote: Counting objects: 55% (322/585)
remote: Counting objects: 56% (328/585)
remote: Counting objects: 57% (334/585)
remote: Counting objects: 58% (340/585)
remote: Counting objects: 59% (346/585)
remote: Counting objects: 60% (351/585)
remote: Counting objects: 61% (357/585)
remote: Counting objects: 62% (363/585)
remote: Counting objects: 63% (369/585)
remote: Counting objects: 64% (375/585)
remote: Counting objects: 65% (381/585)
remote: Counting objects: 66% (387/585)
remote: Counting objects: 67% (392/585)
remote: Counting objects: 68% (398/585)
remote: Counting objects: 69% (404/585)
remote: Counting objects: 70% (410/585)
remote: Counting objects: 71% (416/585)
remote: Counting objects: 72% (422/585)
remote: Counting objects: 73% (428/585)
remote: Counting objects: 74% (433/585)
remote: Counting objects: 75% (439/585)
remote: Counting objects: 76% (445/585)
remote: Counting objects: 77% (451/585)
remote: Counting objects: 78% (457/585)
remote: Counting objects: 79% (463/585)
remote: Counting objects: 80% (468/585)
remote: Counting objects: 81% (474/585)
remote: Counting objects: 82% (480/585)
remote: Counting objects: 83% (486/585)
remote: Counting objects: 84% (492/585)
remote: Counting objects: 85% (498/585)
remote: Counting objects: 86% (504/585)
remote: Counting objects: 87% (509/585)
remote: Counting objects: 88% (515/585)
remote: Counting objects: 89% (521/585)
remote: Counting objects: 90% (527/585)
remote: Counting objects: 91% (533/585)
remote: Counting objects: 92% (539/585)
remote: Counting objects: 93% (545/585)
remote: Counting objects: 94% (550/585)
remote: Counting objects: 95% (556/585)
remote: Counting objects: 96% (562/585)
remote: Counting objects: 97% (568/585)
remote: Counting objects: 98% (574/585)
remote: Counting objects: 99% (580/585)
remote: Counting objects: 100% (585/585)
remote: Counting objects: 100% (585/585), done.
remote: Compressing objects: 1% (1/84)
remote: Compressing objects: 2% (2/84)
remote: Compressing objects: 3% (3/84)
remote: Compressing objects: 4% (4/84)
remote: Compressing objects: 5% (5/84)
remote: Compressing objects: 7% (6/84)
remote: Compressing objects: 8% (7/84)
remote: Compressing objects: 9% (8/84)
remote: Compressing objects: 10% (9/84)
remote: Compressing objects: 11% (10/84)
remote: Compressing objects: 13% (11/84)
remote: Compressing objects: 14% (12/84)
remote: Compressing objects: 15% (13/84)
remote: Compressing objects: 16% (14/84)
remote: Compressing objects: 17% (15/84)
remote: Compressing objects: 19% (16/84)
remote: Compressing objects: 20% (17/84)
remote: Compressing objects: 21% (18/84)
remote: Compressing objects: 22% (19/84)
remote: Compressing objects: 23% (20/84)
remote: Compressing objects: 25% (21/84)
remote: Compressing objects: 26% (22/84)
remote: Compressing objects: 27% (23/84)
remote: Compressing objects: 28% (24/84)
remote: Compressing objects: 29% (25/84)
remote: Compressing objects: 30% (26/84)
remote: Compressing objects: 32% (27/84)
remote: Compressing objects: 33% (28/84)
remote: Compressing objects: 34% (29/84)
remote: Compressing objects: 35% (30/84)
remote: Compressing objects: 36% (31/84)
remote: Compressing objects: 38% (32/84)
remote: Compressing objects: 39% (33/84)
remote: Compressing objects: 40% (34/84)
remote: Compressing objects: 41% (35/84)
remote: Compressing objects: 42% (36/84)
remote: Compressing objects: 44% (37/84)
remote: Compressing objects: 45% (38/84)
remote: Compressing objects: 46% (39/84)
remote: Compressing objects: 47% (40/84)
remote: Compressing objects: 48% (41/84)
remote: Compressing objects: 50% (42/84)
remote: Compressing objects: 51% (43/84)
remote: Compressing objects: 52% (44/84)
remote: Compressing objects: 53% (45/84)
remote: Compressing objects: 54% (46/84)
remote: Compressing objects: 55% (47/84)
remote: Compressing objects: 57% (48/84)
remote: Compressing objects: 58% (49/84)
remote: Compressing objects: 59% (50/84)
remote: Compressing objects: 60% (51/84)
remote: Compressing objects: 61% (52/84)
remote: Compressing objects: 63% (53/84)
remote: Compressing objects: 64% (54/84)
remote: Compressing objects: 65% (55/84)
remote: Compressing objects: 66% (56/84)
remote: Compressing objects: 67% (57/84)
remote: Compressing objects: 69% (58/84)
remote: Compressing objects: 70% (59/84)
remote: Compressing objects: 71% (60/84)
remote: Compressing objects: 72% (61/84)
remote: Compressing objects: 73% (62/84)
remote: Compressing objects: 75% (63/84)
remote: Compressing objects: 76% (64/84)
remote: Compressing objects: 77% (65/84)
remote: Compressing objects: 78% (66/84)
remote: Compressing objects: 79% (67/84)
remote: Compressing objects: 80% (68/84)
remote: Compressing objects: 82% (69/84)
remote: Compressing objects: 83% (70/84)
remote: Compressing objects: 84% (71/84)
remote: Compressing objects: 85% (72/84)
remote: Compressing objects: 86% (73/84)
remote: Compressing objects: 88% (74/84)
remote: Compressing objects: 89% (75/84)
remote: Compressing objects: 90% (76/84)
remote: Compressing objects: 91% (77/84)
remote: Compressing objects: 92% (78/84)
remote: Compressing objects: 94% (79/84)
remote: Compressing objects: 95% (80/84)
remote: Compressing objects: 96% (81/84)
remote: Compressing objects: 97% (82/84)
remote: Compressing objects: 98% (83/84)
remote: Compressing objects: 100% (84/84)
remote: Compressing objects: 100% (84/84), done.
Receiving objects: 0% (1/3359)
Receiving objects: 1% (34/3359)
Receiving objects: 2% (68/3359)
Receiving objects: 2% (99/3359), 52.37 MiB | 52.36 MiB/s
Receiving objects: 3% (101/3359), 52.37 MiB | 52.36 MiB/s
Receiving objects: 4% (135/3359), 52.37 MiB | 52.36 MiB/s
Receiving objects: 5% (168/3359), 52.37 MiB | 52.36 MiB/s
Receiving objects: 6% (202/3359), 52.37 MiB | 52.36 MiB/s
Receiving objects: 7% (236/3359), 52.37 MiB | 52.36 MiB/s
Receiving objects: 8% (269/3359), 52.37 MiB | 52.36 MiB/s
Receiving objects: 9% (303/3359), 52.37 MiB | 52.36 MiB/s
Receiving objects: 9% (320/3359), 98.50 MiB | 49.22 MiB/s
Receiving objects: 10% (336/3359), 98.50 MiB | 49.22 MiB/s
Receiving objects: 11% (370/3359), 98.50 MiB | 49.22 MiB/s
Receiving objects: 12% (404/3359), 98.50 MiB | 49.22 MiB/s
Receiving objects: 13% (437/3359), 98.50 MiB | 49.22 MiB/s
Receiving objects: 14% (471/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 15% (504/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 16% (538/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 17% (572/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 18% (605/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 19% (639/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 20% (672/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 21% (706/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 22% (739/3359), 126.56 MiB | 50.60 MiB/s
Receiving objects: 22% (768/3359), 159.46 MiB | 53.13 MiB/s
Receiving objects: 23% (773/3359), 159.46 MiB | 53.13 MiB/s
Receiving objects: 24% (807/3359), 159.46 MiB | 53.13 MiB/s
Receiving objects: 25% (840/3359), 191.04 MiB | 54.56 MiB/s
Receiving objects: 26% (874/3359), 191.04 MiB | 54.56 MiB/s
Receiving objects: 27% (907/3359), 191.04 MiB | 54.56 MiB/s
Receiving objects: 28% (941/3359), 191.04 MiB | 54.56 MiB/s
Receiving objects: 28% (959/3359), 224.77 MiB | 56.17 MiB/s
Receiving objects: 29% (975/3359), 224.77 MiB | 56.17 MiB/s
Receiving objects: 30% (1008/3359), 224.77 MiB | 56.17 MiB/s
Receiving objects: 31% (1042/3359), 224.77 MiB | 56.17 MiB/s
Receiving objects: 32% (1075/3359), 224.77 MiB | 56.17 MiB/s
Receiving objects: 33% (1109/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 34% (1143/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 35% (1176/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 36% (1210/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 37% (1243/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 38% (1277/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 39% (1311/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 40% (1344/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 41% (1378/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 42% (1411/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 43% (1445/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 44% (1478/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 45% (1512/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 46% (1546/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 47% (1579/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 48% (1613/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 49% (1646/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 50% (1680/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 51% (1714/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 52% (1747/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 53% (1781/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 54% (1814/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 55% (1848/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 56% (1882/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 57% (1915/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 58% (1949/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 59% (1982/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 60% (2016/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 61% (2049/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 62% (2083/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 63% (2117/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 64% (2150/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 65% (2184/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 66% (2217/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 67% (2251/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 68% (2285/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 69% (2318/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 70% (2352/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 71% (2385/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 72% (2419/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 73% (2453/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 74% (2486/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 75% (2520/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 76% (2553/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 77% (2587/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 78% (2621/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 79% (2654/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 80% (2688/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 81% (2721/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 82% (2755/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 83% (2788/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 84% (2822/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 85% (2856/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 86% (2889/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 87% (2923/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 88% (2956/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 89% (2990/3359), 261.23 MiB | 58.04 MiB/s
Receiving objects: 89% (3016/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 90% (3024/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 91% (3057/3359), 287.10 MiB | 59.56 MiB/s
remote: Total 3359 (delta 519), reused 501 (delta 501), pack-reused 2774 (from 1)
Receiving objects: 92% (3091/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 93% (3124/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 94% (3158/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 95% (3192/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 96% (3225/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 97% (3259/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 98% (3292/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 99% (3326/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 100% (3359/3359), 287.10 MiB | 59.56 MiB/s
Receiving objects: 100% (3359/3359), 296.08 MiB | 57.36 MiB/s, done.
Resolving deltas: 0% (0/1883)
Resolving deltas: 1% (19/1883)
Resolving deltas: 2% (38/1883)
Resolving deltas: 3% (57/1883)
Resolving deltas: 4% (76/1883)
Resolving deltas: 5% (95/1883)
Resolving deltas: 6% (113/1883)
Resolving deltas: 7% (132/1883)
Resolving deltas: 8% (151/1883)
Resolving deltas: 9% (170/1883)
Resolving deltas: 10% (189/1883)
Resolving deltas: 11% (208/1883)
Resolving deltas: 12% (226/1883)
Resolving deltas: 13% (245/1883)
Resolving deltas: 14% (264/1883)
Resolving deltas: 15% (283/1883)
Resolving deltas: 16% (302/1883)
Resolving deltas: 17% (321/1883)
Resolving deltas: 18% (339/1883)
Resolving deltas: 19% (358/1883)
Resolving deltas: 20% (377/1883)
Resolving deltas: 21% (396/1883)
Resolving deltas: 22% (415/1883)
Resolving deltas: 23% (434/1883)
Resolving deltas: 24% (452/1883)
Resolving deltas: 25% (471/1883)
Resolving deltas: 26% (490/1883)
Resolving deltas: 27% (509/1883)
Resolving deltas: 28% (528/1883)
Resolving deltas: 29% (547/1883)
Resolving deltas: 30% (565/1883)
Resolving deltas: 31% (584/1883)
Resolving deltas: 32% (603/1883)
Resolving deltas: 33% (622/1883)
Resolving deltas: 34% (641/1883)
Resolving deltas: 35% (660/1883)
Resolving deltas: 36% (678/1883)
Resolving deltas: 37% (697/1883)
Resolving deltas: 38% (716/1883)
Resolving deltas: 39% (735/1883)
Resolving deltas: 40% (754/1883)
Resolving deltas: 41% (773/1883)
Resolving deltas: 42% (791/1883)
Resolving deltas: 43% (810/1883)
Resolving deltas: 44% (829/1883)
Resolving deltas: 45% (848/1883)
Resolving deltas: 46% (867/1883)
Resolving deltas: 47% (886/1883)
Resolving deltas: 48% (904/1883)
Resolving deltas: 49% (923/1883)
Resolving deltas: 50% (942/1883)
Resolving deltas: 51% (961/1883)
Resolving deltas: 52% (980/1883)
Resolving deltas: 53% (998/1883)
Resolving deltas: 54% (1017/1883)
Resolving deltas: 55% (1036/1883)
Resolving deltas: 56% (1055/1883)
Resolving deltas: 57% (1074/1883)
Resolving deltas: 58% (1093/1883)
Resolving deltas: 59% (1111/1883)
Resolving deltas: 60% (1130/1883)
Resolving deltas: 61% (1149/1883)
Resolving deltas: 62% (1168/1883)
Resolving deltas: 63% (1187/1883)
Resolving deltas: 64% (1206/1883)
Resolving deltas: 65% (1224/1883)
Resolving deltas: 66% (1243/1883)
Resolving deltas: 67% (1262/1883)
Resolving deltas: 68% (1281/1883)
Resolving deltas: 69% (1300/1883)
Resolving deltas: 70% (1319/1883)
Resolving deltas: 71% (1337/1883)
Resolving deltas: 72% (1356/1883)
Resolving deltas: 73% (1375/1883)
Resolving deltas: 74% (1394/1883)
Resolving deltas: 75% (1413/1883)
Resolving deltas: 76% (1432/1883)
Resolving deltas: 77% (1450/1883)
Resolving deltas: 78% (1469/1883)
Resolving deltas: 79% (1488/1883)
Resolving deltas: 80% (1507/1883)
Resolving deltas: 81% (1526/1883)
Resolving deltas: 82% (1545/1883)
Resolving deltas: 83% (1563/1883)
Resolving deltas: 84% (1582/1883)
Resolving deltas: 85% (1601/1883)
Resolving deltas: 86% (1620/1883)
Resolving deltas: 87% (1639/1883)
Resolving deltas: 88% (1658/1883)
Resolving deltas: 89% (1676/1883)
Resolving deltas: 90% (1695/1883)
Resolving deltas: 91% (1714/1883)
Resolving deltas: 92% (1733/1883)
Resolving deltas: 93% (1752/1883)
Resolving deltas: 94% (1771/1883)
Resolving deltas: 95% (1789/1883)
Resolving deltas: 96% (1808/1883)
Resolving deltas: 97% (1827/1883)
Resolving deltas: 98% (1846/1883)
Resolving deltas: 99% (1865/1883)
Resolving deltas: 100% (1883/1883)
Resolving deltas: 100% (1883/1883), done.
/home/runner/work/instructor-neuroai-course-content/instructor-neuroai-course-content/projects/project-notebooks/ComputationThruDynamicsBenchmark
Obtaining file:///home/runner/work/instructor-neuroai-course-content/instructor-neuroai-course-content/projects/project-notebooks/ComputationThruDynamicsBenchmark
Installing build dependencies ... ?25l-
\
done
?25h Checking if build backend supports build_editable ... ?25ldone
?25h Getting requirements to build editable ... ?25l-
done
?25h Preparing editable metadata (pyproject.toml) ... ?25l-
done
?25hRequirement already satisfied: torch>=1.13.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (2.1.0)
Collecting torchmetrics==1.3.0.post0 (from ctd==1.0)
Downloading torchmetrics-1.3.0.post0-py3-none-any.whl.metadata (20 kB)
Collecting pytorch-lightning==2.1.3 (from ctd==1.0)
Downloading pytorch_lightning-2.1.3-py3-none-any.whl.metadata (21 kB)
Collecting ray[tune] (from ctd==1.0)
Downloading ray-2.56.0-cp310-cp310-manylinux2014_x86_64.whl.metadata (22 kB)
Requirement already satisfied: omegaconf in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (2.3.1)
Collecting wandb (from ctd==1.0)
Downloading wandb-0.28.0-py3-none-manylinux_2_28_x86_64.whl.metadata (11 kB)
Collecting hydra-core (from ctd==1.0)
Downloading hydra_core-1.3.4-py3-none-any.whl.metadata (5.7 kB)
Requirement already satisfied: gymnasium in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (0.29.1)
Requirement already satisfied: h5py in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (3.16.0)
Requirement already satisfied: scikit-learn in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (1.4.1.post1)
Requirement already satisfied: matplotlib in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (3.8.3)
Requirement already satisfied: python-dotenv in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (1.0.1)
Requirement already satisfied: imageio[ffmpeg] in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (2.37.3)
Requirement already satisfied: motornet in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (0.2.0)
Requirement already satisfied: ipykernel in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (7.3.0)
Requirement already satisfied: ipywidgets in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (8.1.2)
Requirement already satisfied: opencv-python in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ctd==1.0) (4.11.0.86)
Requirement already satisfied: numpy>=1.17.2 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pytorch-lightning==2.1.3->ctd==1.0) (1.26.4)
Requirement already satisfied: tqdm>=4.57.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pytorch-lightning==2.1.3->ctd==1.0) (4.66.2)
Requirement already satisfied: PyYAML>=5.4 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pytorch-lightning==2.1.3->ctd==1.0) (6.0.3)
Requirement already satisfied: fsspec>=2022.5.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (2026.6.0)
Requirement already satisfied: packaging>=20.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pytorch-lightning==2.1.3->ctd==1.0) (26.2)
Requirement already satisfied: typing-extensions>=4.0.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pytorch-lightning==2.1.3->ctd==1.0) (4.16.0)
Requirement already satisfied: lightning-utilities>=0.8.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pytorch-lightning==2.1.3->ctd==1.0) (0.15.3)
Requirement already satisfied: aiohttp!=4.0.0a0,!=4.0.0a1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (3.14.1)
Requirement already satisfied: aiohappyeyeballs>=2.5.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (2.7.1)
Requirement already satisfied: aiosignal>=1.4.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (1.4.0)
Requirement already satisfied: async-timeout<6.0,>=4.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (5.0.1)
Requirement already satisfied: attrs>=17.3.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (26.1.0)
Requirement already satisfied: frozenlist>=1.1.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (1.8.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (6.7.1)
Requirement already satisfied: propcache>=0.2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (0.5.2)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (1.24.2)
Requirement already satisfied: idna>=2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from yarl<2.0,>=1.17.0->aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>=2022.5.0->pytorch-lightning==2.1.3->ctd==1.0) (3.18)
Requirement already satisfied: filelock in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (3.29.6)
Requirement already satisfied: sympy in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (1.14.0)
Requirement already satisfied: networkx in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (3.2.1)
Requirement already satisfied: jinja2 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (3.1.6)
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (12.1.105)
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (12.1.105)
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (12.1.105)
Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (8.9.2.26)
Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (12.1.3.1)
Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (11.0.2.54)
Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (10.3.2.106)
Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (11.4.5.107)
Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (12.1.0.106)
Requirement already satisfied: nvidia-nccl-cu12==2.18.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (2.18.1)
Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (12.1.105)
Requirement already satisfied: triton==2.1.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.13.1->ctd==1.0) (2.1.0)
Requirement already satisfied: nvidia-nvjitlink-cu12 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch>=1.13.1->ctd==1.0) (12.9.86)
Requirement already satisfied: cloudpickle>=1.2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from gymnasium->ctd==1.0) (3.1.2)
Requirement already satisfied: farama-notifications>=0.0.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from gymnasium->ctd==1.0) (0.0.6)
Requirement already satisfied: antlr4-python3-runtime==4.9.* in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from hydra-core->ctd==1.0) (4.9.3)
Requirement already satisfied: pillow>=8.3.2 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from imageio[ffmpeg]->ctd==1.0) (10.2.0)
Requirement already satisfied: imageio-ffmpeg in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from imageio[ffmpeg]->ctd==1.0) (0.6.0)
Requirement already satisfied: psutil in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from imageio[ffmpeg]->ctd==1.0) (7.2.2)
Requirement already satisfied: comm>=0.1.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (0.2.3)
Requirement already satisfied: debugpy>=1.6.5 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (1.8.21)
Requirement already satisfied: ipython>=7.23.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (8.39.0)
Requirement already satisfied: jupyter-client>=8.9.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (8.9.1)
Requirement already satisfied: jupyter-core!=6.0.*,>=5.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (5.9.1)
Requirement already satisfied: matplotlib-inline>=0.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (0.2.2)
Requirement already satisfied: nest-asyncio2>=1.7.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (1.7.2)
Requirement already satisfied: pyzmq>=25 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (27.1.0)
Requirement already satisfied: tornado>=6.4.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (6.5.7)
Requirement already satisfied: traitlets>=5.4.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipykernel->ctd==1.0) (5.15.1)
Requirement already satisfied: decorator in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->ctd==1.0) (5.0.9)
Requirement already satisfied: exceptiongroup in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->ctd==1.0) (1.3.1)
Requirement already satisfied: jedi>=0.16 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->ctd==1.0) (0.20.0)
Requirement already satisfied: pexpect>4.3 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->ctd==1.0) (4.9.0)
Requirement already satisfied: prompt_toolkit<3.1.0,>=3.0.41 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->ctd==1.0) (3.0.52)
Requirement already satisfied: pygments>=2.4.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->ctd==1.0) (2.20.0)
Requirement already satisfied: stack_data in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipython>=7.23.1->ipykernel->ctd==1.0) (0.6.3)
Requirement already satisfied: wcwidth in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from prompt_toolkit<3.1.0,>=3.0.41->ipython>=7.23.1->ipykernel->ctd==1.0) (0.8.2)
Requirement already satisfied: parso<0.9.0,>=0.8.6 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel->ctd==1.0) (0.8.7)
Requirement already satisfied: python-dateutil>=2.8.2 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from jupyter-client>=8.9.0->ipykernel->ctd==1.0) (2.9.0.post0)
Requirement already satisfied: platformdirs>=2.5 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from jupyter-core!=6.0.*,>=5.1->ipykernel->ctd==1.0) (4.10.0)
Requirement already satisfied: ptyprocess>=0.5 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pexpect>4.3->ipython>=7.23.1->ipykernel->ctd==1.0) (0.7.0)
Requirement already satisfied: six>=1.5 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from python-dateutil>=2.8.2->jupyter-client>=8.9.0->ipykernel->ctd==1.0) (1.17.0)
Requirement already satisfied: widgetsnbextension~=4.0.10 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipywidgets->ctd==1.0) (4.0.15)
Requirement already satisfied: jupyterlab-widgets~=3.0.10 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ipywidgets->ctd==1.0) (3.0.16)
Requirement already satisfied: MarkupSafe>=2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from jinja2->torch>=1.13.1->ctd==1.0) (2.1.5)
Requirement already satisfied: contourpy>=1.0.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from matplotlib->ctd==1.0) (1.3.2)
Requirement already satisfied: cycler>=0.10 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from matplotlib->ctd==1.0) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from matplotlib->ctd==1.0) (4.63.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from matplotlib->ctd==1.0) (1.5.0)
Requirement already satisfied: pyparsing>=2.3.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from matplotlib->ctd==1.0) (3.3.2)
Requirement already satisfied: click>=7.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ray[tune]->ctd==1.0) (8.4.2)
Requirement already satisfied: jsonschema in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ray[tune]->ctd==1.0) (4.26.0)
Collecting msgpack<2.0.0,>=1.0.0 (from ray[tune]->ctd==1.0)
Downloading msgpack-1.2.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (8.3 kB)
Requirement already satisfied: protobuf>=3.20.3 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ray[tune]->ctd==1.0) (3.20.3)
Requirement already satisfied: requests in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ray[tune]->ctd==1.0) (2.31.0)
Requirement already satisfied: pandas in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ray[tune]->ctd==1.0) (2.3.3)
Collecting tensorboardX>=1.9 (from ray[tune]->ctd==1.0)
Downloading tensorboardx-2.6.5-py3-none-any.whl.metadata (6.6 kB)
Collecting pyarrow>=17.0.0 (from ray[tune]->ctd==1.0)
Downloading pyarrow-24.0.0-cp310-cp310-manylinux_2_28_x86_64.whl.metadata (3.0 kB)
Requirement already satisfied: pydantic<3,>=2.5.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from ray[tune]->ctd==1.0) (2.13.4)
Requirement already satisfied: annotated-types>=0.6.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pydantic<3,>=2.5.0->ray[tune]->ctd==1.0) (0.7.0)
Requirement already satisfied: pydantic-core==2.46.4 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pydantic<3,>=2.5.0->ray[tune]->ctd==1.0) (2.46.4)
Requirement already satisfied: typing-inspection>=0.4.2 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pydantic<3,>=2.5.0->ray[tune]->ctd==1.0) (0.4.2)
Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from jsonschema->ray[tune]->ctd==1.0) (2025.9.1)
Requirement already satisfied: referencing>=0.28.4 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from jsonschema->ray[tune]->ctd==1.0) (0.37.0)
Requirement already satisfied: rpds-py>=0.25.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from jsonschema->ray[tune]->ctd==1.0) (0.30.0)
Requirement already satisfied: pytz>=2020.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pandas->ray[tune]->ctd==1.0) (2026.2)
Requirement already satisfied: tzdata>=2022.7 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pandas->ray[tune]->ctd==1.0) (2026.2)
Requirement already satisfied: charset-normalizer<4,>=2 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from requests->ray[tune]->ctd==1.0) (3.4.8)
Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from requests->ray[tune]->ctd==1.0) (2.7.0)
Requirement already satisfied: certifi>=2017.4.17 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from requests->ray[tune]->ctd==1.0) (2026.6.17)
Requirement already satisfied: scipy>=1.6.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from scikit-learn->ctd==1.0) (1.12.0)
Requirement already satisfied: joblib>=1.2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from scikit-learn->ctd==1.0) (1.5.3)
Requirement already satisfied: threadpoolctl>=2.0.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from scikit-learn->ctd==1.0) (3.6.0)
Requirement already satisfied: executing>=1.2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from stack_data->ipython>=7.23.1->ipykernel->ctd==1.0) (2.2.1)
Requirement already satisfied: asttokens>=2.1.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from stack_data->ipython>=7.23.1->ipykernel->ctd==1.0) (3.0.1)
Requirement already satisfied: pure-eval in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from stack_data->ipython>=7.23.1->ipykernel->ctd==1.0) (0.2.3)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from sympy->torch>=1.13.1->ctd==1.0) (1.3.0)
Collecting gitpython!=3.1.29,>=1.0.0 (from wandb->ctd==1.0)
Downloading gitpython-3.1.50-py3-none-any.whl.metadata (14 kB)
Collecting protobuf>=3.20.3 (from ray[tune]->ctd==1.0)
Downloading protobuf-7.35.1-cp310-abi3-manylinux2014_x86_64.whl.metadata (595 bytes)
Collecting sentry-sdk>=2.0.0 (from wandb->ctd==1.0)
Downloading sentry_sdk-2.64.0-py3-none-any.whl.metadata (10 kB)
Collecting gitdb<5,>=4.0.1 (from gitpython!=3.1.29,>=1.0.0->wandb->ctd==1.0)
Downloading gitdb-4.0.12-py3-none-any.whl.metadata (1.2 kB)
Collecting smmap<6,>=3.0.1 (from gitdb<5,>=4.0.1->gitpython!=3.1.29,>=1.0.0->wandb->ctd==1.0)
Downloading smmap-5.0.3-py3-none-any.whl.metadata (4.6 kB)
Downloading pytorch_lightning-2.1.3-py3-none-any.whl (777 kB)
?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/777.7 kB ? eta -:--:--
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 777.7/777.7 kB 67.4 MB/s 0:00:00
?25hDownloading torchmetrics-1.3.0.post0-py3-none-any.whl (840 kB)
?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/840.2 kB ? eta -:--:--
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 840.2/840.2 kB 94.5 MB/s 0:00:00
?25hDownloading hydra_core-1.3.4-py3-none-any.whl (155 kB)
Downloading ray-2.56.0-cp310-cp310-manylinux2014_x86_64.whl (74.1 MB)
?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/74.1 MB ? eta -:--:--
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━ 69.5/74.1 MB 347.3 MB/s eta 0:00:01
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 74.1/74.1 MB 257.5 MB/s 0:00:00
?25hDownloading msgpack-1.2.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (407 kB)
Downloading pyarrow-24.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (48.8 MB)
?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/48.8 MB ? eta -:--:--
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.8/48.8 MB 363.8 MB/s 0:00:00
?25hDownloading tensorboardx-2.6.5-py3-none-any.whl (87 kB)
Downloading wandb-0.28.0-py3-none-manylinux_2_28_x86_64.whl (26.8 MB)
?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/26.8 MB ? eta -:--:--
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 26.8/26.8 MB 211.2 MB/s 0:00:00
?25hDownloading protobuf-7.35.1-cp310-abi3-manylinux2014_x86_64.whl (327 kB)
Downloading gitpython-3.1.50-py3-none-any.whl (212 kB)
Downloading gitdb-4.0.12-py3-none-any.whl (62 kB)
Downloading smmap-5.0.3-py3-none-any.whl (24 kB)
Downloading sentry_sdk-2.64.0-py3-none-any.whl (498 kB)
Building wheels for collected packages: ctd
Building editable for ctd (pyproject.toml) ... ?25l-
done
?25h Created wheel for ctd: filename=ctd-1.0-0.editable-py3-none-any.whl size=2760 sha256=8cd48189788f6352d75a55b63c83a4d25b1f3f5061d491fcb5acb74415d3a077
Stored in directory: /tmp/pip-ephem-wheel-cache-cecw6u21/wheels/c6/8d/ec/1e59eccc3b641bdfe4765542e80694d6e77e8280189b019ddf
Successfully built ctd
Installing collected packages: smmap, sentry-sdk, pyarrow, protobuf, msgpack, tensorboardX, hydra-core, gitdb, gitpython, wandb, torchmetrics, ray, pytorch-lightning, ctd
?25l
━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/14 [sentry-sdk]
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
Attempting uninstall: protobuf
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
Found existing installation: protobuf 3.20.3
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
Uninstalling protobuf-3.20.3:
━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2/14 [pyarrow]
━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/14 [protobuf]
━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/14 [protobuf]
━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/14 [protobuf]
Successfully uninstalled protobuf-3.20.3
━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/14 [protobuf]
━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3/14 [protobuf]
━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━ 5/14 [tensorboardX]
━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━ 7/14 [gitdb]
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
Attempting uninstall: torchmetrics
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
Found existing installation: torchmetrics 1.9.0
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
Uninstalling torchmetrics-1.9.0:
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
Successfully uninstalled torchmetrics-1.9.0
━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━ 9/14 [wandb]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━ 10/14 [torchmetrics]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━ 10/14 [torchmetrics]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━ 10/14 [torchmetrics]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
Attempting uninstall: pytorch-lightning
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
Found existing installation: pytorch-lightning 2.2.4
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
Uninstalling pytorch-lightning-2.2.4:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
Successfully uninstalled pytorch-lightning-2.2.4
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━ 11/14 [ray]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━ 12/14 [pytorch-lightning]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━ 12/14 [pytorch-lightning]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14/14 [ctd]
?25h
Successfully installed ctd-1.0 gitdb-4.0.12 gitpython-3.1.50 hydra-core-1.3.4 msgpack-1.2.1 protobuf-7.35.1 pyarrow-24.0.0 pytorch-lightning-2.1.3 ray-2.56.0 sentry-sdk-2.64.0 smmap-5.0.3 tensorboardX-2.6.5 torchmetrics-1.3.0.post0 wandb-0.28.0
Colab // Kaggle installation (Part 2)
Show code cell source
# @markdown Colab // Kaggle installation (Part 2)
!pip uninstall -y torchaudio torchvision
WARNING: Skipping torchaudio as it is not installed.
Found existing installation: torchvision 0.16.0
Uninstalling torchvision-0.16.0:
Successfully uninstalled torchvision-0.16.0
Colab // Kaggle installation (Part 3)
Show code cell source
# @markdown Colab // Kaggle installation (Part 3)
## GET BACK TO THE DIRECTORY AND CONFIGURE .env
################ COLAB #####################
%cd /content/ComputationThruDynamicsBenchmark/
envStr = """HOME_DIR=/content/ComputationThruDynamicsBenchmark/
#Don't change these
TRAIN_INPUT_FILE=train_input.h5\nEVAL_INPUT_FILE=eval_input.h5
EVAL_TARGET_FILE=eval_target.h5
"""
#############################################
################ KAGGLE #####################
# %cd /kaggle/working/ComputationThruDynamicsBenchmark/
# envStr = """HOME_DIR=/kaggle/working/ComputationThruDynamicsBenchmark/
# #Don't change these
# TRAIN_INPUT_FILE=train_input.h5\nEVAL_INPUT_FILE=eval_input.h5
# EVAL_TARGET_FILE=eval_target.h5
# """
##############################################
################ COLAB // KAGGLE #####################
with open('.env','w') as f:
f.write(envStr)
##############################################
[Errno 2] No such file or directory: '/content/ComputationThruDynamicsBenchmark/'
/home/runner/work/instructor-neuroai-course-content/instructor-neuroai-course-content/projects/project-notebooks/ComputationThruDynamicsBenchmark
Colab // Kaggle installation (Part 4)
Show code cell source
# @markdown Colab // Kaggle installation (Part 4)
!git clone https://github.com/mitchellostrow/DSA/
%cd DSA/
!git checkout a46c3194eb1f736db31e7eca5f433839c2cbc311
!pip install -e .
!pip uninstall -y kooplearn
!pip install git+https://github.com/Machine-Learning-Dynamical-Systems/kooplearn.git@260ad84beb86acc706e4f43d9b7b5e8bc4e8b18c
Cloning into 'DSA'...
remote: Enumerating objects: 1179, done.
remote: Counting objects: 0% (1/207)
remote: Counting objects: 1% (3/207)
remote: Counting objects: 2% (5/207)
remote: Counting objects: 3% (7/207)
remote: Counting objects: 4% (9/207)
remote: Counting objects: 5% (11/207)
remote: Counting objects: 6% (13/207)
remote: Counting objects: 7% (15/207)
remote: Counting objects: 8% (17/207)
remote: Counting objects: 9% (19/207)
remote: Counting objects: 10% (21/207)
remote: Counting objects: 11% (23/207)
remote: Counting objects: 12% (25/207)
remote: Counting objects: 13% (27/207)
remote: Counting objects: 14% (29/207)
remote: Counting objects: 15% (32/207)
remote: Counting objects: 16% (34/207)
remote: Counting objects: 17% (36/207)
remote: Counting objects: 18% (38/207)
remote: Counting objects: 19% (40/207)
remote: Counting objects: 20% (42/207)
remote: Counting objects: 21% (44/207)
remote: Counting objects: 22% (46/207)
remote: Counting objects: 23% (48/207)
remote: Counting objects: 24% (50/207)
remote: Counting objects: 25% (52/207)
remote: Counting objects: 26% (54/207)
remote: Counting objects: 27% (56/207)
remote: Counting objects: 28% (58/207)
remote: Counting objects: 29% (61/207)
remote: Counting objects: 30% (63/207)
remote: Counting objects: 31% (65/207)
remote: Counting objects: 32% (67/207)
remote: Counting objects: 33% (69/207)
remote: Counting objects: 34% (71/207)
remote: Counting objects: 35% (73/207)
remote: Counting objects: 36% (75/207)
remote: Counting objects: 37% (77/207)
remote: Counting objects: 38% (79/207)
remote: Counting objects: 39% (81/207)
remote: Counting objects: 40% (83/207)
remote: Counting objects: 41% (85/207)
remote: Counting objects: 42% (87/207)
remote: Counting objects: 43% (90/207)
remote: Counting objects: 44% (92/207)
remote: Counting objects: 45% (94/207)
remote: Counting objects: 46% (96/207)
remote: Counting objects: 47% (98/207)
remote: Counting objects: 48% (100/207)
remote: Counting objects: 49% (102/207)
remote: Counting objects: 50% (104/207)
remote: Counting objects: 51% (106/207)
remote: Counting objects: 52% (108/207)
remote: Counting objects: 53% (110/207)
remote: Counting objects: 54% (112/207)
remote: Counting objects: 55% (114/207)
remote: Counting objects: 56% (116/207)
remote: Counting objects: 57% (118/207)
remote: Counting objects: 58% (121/207)
remote: Counting objects: 59% (123/207)
remote: Counting objects: 60% (125/207)
remote: Counting objects: 61% (127/207)
remote: Counting objects: 62% (129/207)
remote: Counting objects: 63% (131/207)
remote: Counting objects: 64% (133/207)
remote: Counting objects: 65% (135/207)
remote: Counting objects: 66% (137/207)
remote: Counting objects: 67% (139/207)
remote: Counting objects: 68% (141/207)
remote: Counting objects: 69% (143/207)
remote: Counting objects: 70% (145/207)
remote: Counting objects: 71% (147/207)
remote: Counting objects: 72% (150/207)
remote: Counting objects: 73% (152/207)
remote: Counting objects: 74% (154/207)
remote: Counting objects: 75% (156/207)
remote: Counting objects: 76% (158/207)
remote: Counting objects: 77% (160/207)
remote: Counting objects: 78% (162/207)
remote: Counting objects: 79% (164/207)
remote: Counting objects: 80% (166/207)
remote: Counting objects: 81% (168/207)
remote: Counting objects: 82% (170/207)
remote: Counting objects: 83% (172/207)
remote: Counting objects: 84% (174/207)
remote: Counting objects: 85% (176/207)
remote: Counting objects: 86% (179/207)
remote: Counting objects: 87% (181/207)
remote: Counting objects: 88% (183/207)
remote: Counting objects: 89% (185/207)
remote: Counting objects: 90% (187/207)
remote: Counting objects: 91% (189/207)
remote: Counting objects: 92% (191/207)
remote: Counting objects: 93% (193/207)
remote: Counting objects: 94% (195/207)
remote: Counting objects: 95% (197/207)
remote: Counting objects: 96% (199/207)
remote: Counting objects: 97% (201/207)
remote: Counting objects: 98% (203/207)
remote: Counting objects: 99% (205/207)
remote: Counting objects: 100% (207/207)
remote: Counting objects: 100% (207/207), done.
remote: Compressing objects: 0% (1/111)
remote: Compressing objects: 1% (2/111)
remote: Compressing objects: 2% (3/111)
remote: Compressing objects: 3% (4/111)
remote: Compressing objects: 4% (5/111)
remote: Compressing objects: 5% (6/111)
remote: Compressing objects: 6% (7/111)
remote: Compressing objects: 7% (8/111)
remote: Compressing objects: 8% (9/111)
remote: Compressing objects: 9% (10/111)
remote: Compressing objects: 10% (12/111)
remote: Compressing objects: 11% (13/111)
remote: Compressing objects: 12% (14/111)
remote: Compressing objects: 13% (15/111)
remote: Compressing objects: 14% (16/111)
remote: Compressing objects: 15% (17/111)
remote: Compressing objects: 16% (18/111)
remote: Compressing objects: 17% (19/111)
remote: Compressing objects: 18% (20/111)
remote: Compressing objects: 19% (22/111)
remote: Compressing objects: 20% (23/111)
remote: Compressing objects: 21% (24/111)
remote: Compressing objects: 22% (25/111)
remote: Compressing objects: 23% (26/111)
remote: Compressing objects: 24% (27/111)
remote: Compressing objects: 25% (28/111)
remote: Compressing objects: 26% (29/111)
remote: Compressing objects: 27% (30/111)
remote: Compressing objects: 28% (32/111)
remote: Compressing objects: 29% (33/111)
remote: Compressing objects: 30% (34/111)
remote: Compressing objects: 31% (35/111)
remote: Compressing objects: 32% (36/111)
remote: Compressing objects: 33% (37/111)
remote: Compressing objects: 34% (38/111)
remote: Compressing objects: 35% (39/111)
remote: Compressing objects: 36% (40/111)
remote: Compressing objects: 37% (42/111)
remote: Compressing objects: 38% (43/111)
remote: Compressing objects: 39% (44/111)
remote: Compressing objects: 40% (45/111)
remote: Compressing objects: 41% (46/111)
remote: Compressing objects: 42% (47/111)
remote: Compressing objects: 43% (48/111)
remote: Compressing objects: 44% (49/111)
remote: Compressing objects: 45% (50/111)
remote: Compressing objects: 46% (52/111)
remote: Compressing objects: 47% (53/111)
remote: Compressing objects: 48% (54/111)
remote: Compressing objects: 49% (55/111)
remote: Compressing objects: 50% (56/111)
remote: Compressing objects: 51% (57/111)
remote: Compressing objects: 52% (58/111)
remote: Compressing objects: 53% (59/111)
remote: Compressing objects: 54% (60/111)
remote: Compressing objects: 55% (62/111)
remote: Compressing objects: 56% (63/111)
remote: Compressing objects: 57% (64/111)
remote: Compressing objects: 58% (65/111)
remote: Compressing objects: 59% (66/111)
remote: Compressing objects: 60% (67/111)
remote: Compressing objects: 61% (68/111)
remote: Compressing objects: 62% (69/111)
remote: Compressing objects: 63% (70/111)
remote: Compressing objects: 64% (72/111)
remote: Compressing objects: 65% (73/111)
remote: Compressing objects: 66% (74/111)
remote: Compressing objects: 67% (75/111)
remote: Compressing objects: 68% (76/111)
remote: Compressing objects: 69% (77/111)
remote: Compressing objects: 70% (78/111)
remote: Compressing objects: 71% (79/111)
remote: Compressing objects: 72% (80/111)
remote: Compressing objects: 73% (82/111)
remote: Compressing objects: 74% (83/111)
remote: Compressing objects: 75% (84/111)
remote: Compressing objects: 76% (85/111)
remote: Compressing objects: 77% (86/111)
remote: Compressing objects: 78% (87/111)
remote: Compressing objects: 79% (88/111)
remote: Compressing objects: 80% (89/111)
remote: Compressing objects: 81% (90/111)
remote: Compressing objects: 82% (92/111)
remote: Compressing objects: 83% (93/111)
remote: Compressing objects: 84% (94/111)
remote: Compressing objects: 85% (95/111)
remote: Compressing objects: 86% (96/111)
remote: Compressing objects: 87% (97/111)
remote: Compressing objects: 88% (98/111)
remote: Compressing objects: 89% (99/111)
remote: Compressing objects: 90% (100/111)
remote: Compressing objects: 91% (102/111)
remote: Compressing objects: 92% (103/111)
remote: Compressing objects: 93% (104/111)
remote: Compressing objects: 94% (105/111)
remote: Compressing objects: 95% (106/111)
remote: Compressing objects: 96% (107/111)
remote: Compressing objects: 97% (108/111)
remote: Compressing objects: 98% (109/111)
remote: Compressing objects: 99% (110/111)
remote: Compressing objects: 100% (111/111)
remote: Compressing objects: 100% (111/111), done.
Receiving objects: 0% (1/1179)
Receiving objects: 1% (12/1179)
Receiving objects: 2% (24/1179)
Receiving objects: 3% (36/1179)
Receiving objects: 4% (48/1179)
Receiving objects: 5% (59/1179)
Receiving objects: 6% (71/1179)
Receiving objects: 7% (83/1179)
Receiving objects: 8% (95/1179)
Receiving objects: 9% (107/1179)
Receiving objects: 10% (118/1179)
Receiving objects: 11% (130/1179)
Receiving objects: 12% (142/1179)
Receiving objects: 13% (154/1179)
Receiving objects: 14% (166/1179)
Receiving objects: 15% (177/1179)
Receiving objects: 16% (189/1179)
Receiving objects: 17% (201/1179)
Receiving objects: 18% (213/1179)
Receiving objects: 19% (225/1179)
Receiving objects: 20% (236/1179)
Receiving objects: 21% (248/1179)
Receiving objects: 22% (260/1179)
Receiving objects: 23% (272/1179)
Receiving objects: 24% (283/1179)
Receiving objects: 25% (295/1179)
Receiving objects: 26% (307/1179)
Receiving objects: 27% (319/1179)
Receiving objects: 28% (331/1179)
Receiving objects: 29% (342/1179)
Receiving objects: 30% (354/1179)
Receiving objects: 31% (366/1179)
Receiving objects: 32% (378/1179)
Receiving objects: 33% (390/1179)
Receiving objects: 34% (401/1179)
Receiving objects: 35% (413/1179)
Receiving objects: 36% (425/1179)
Receiving objects: 37% (437/1179)
Receiving objects: 38% (449/1179)
Receiving objects: 39% (460/1179)
Receiving objects: 40% (472/1179)
Receiving objects: 41% (484/1179)
Receiving objects: 42% (496/1179)
Receiving objects: 43% (507/1179)
Receiving objects: 44% (519/1179)
Receiving objects: 45% (531/1179)
Receiving objects: 46% (543/1179)
Receiving objects: 47% (555/1179)
Receiving objects: 48% (566/1179)
Receiving objects: 49% (578/1179)
Receiving objects: 50% (590/1179)
Receiving objects: 51% (602/1179)
Receiving objects: 52% (614/1179)
Receiving objects: 53% (625/1179)
Receiving objects: 54% (637/1179)
Receiving objects: 55% (649/1179)
Receiving objects: 56% (661/1179)
Receiving objects: 57% (673/1179)
Receiving objects: 58% (684/1179)
Receiving objects: 59% (696/1179)
Receiving objects: 60% (708/1179)
Receiving objects: 61% (720/1179)
Receiving objects: 62% (731/1179)
Receiving objects: 63% (743/1179)
Receiving objects: 64% (755/1179)
Receiving objects: 65% (767/1179)
Receiving objects: 66% (779/1179)
Receiving objects: 67% (790/1179)
Receiving objects: 68% (802/1179)
Receiving objects: 69% (814/1179)
Receiving objects: 70% (826/1179)
Receiving objects: 71% (838/1179)
Receiving objects: 72% (849/1179)
Receiving objects: 73% (861/1179)
Receiving objects: 74% (873/1179)
Receiving objects: 75% (885/1179)
Receiving objects: 76% (897/1179)
Receiving objects: 77% (908/1179)
Receiving objects: 78% (920/1179)
Receiving objects: 79% (932/1179)
Receiving objects: 80% (944/1179)
Receiving objects: 81% (955/1179)
Receiving objects: 82% (967/1179)
Receiving objects: 83% (979/1179)
Receiving objects: 84% (991/1179)
Receiving objects: 85% (1003/1179)
Receiving objects: 86% (1014/1179)
Receiving objects: 87% (1026/1179)
Receiving objects: 88% (1038/1179)
Receiving objects: 89% (1050/1179)
Receiving objects: 90% (1062/1179)
Receiving objects: 91% (1073/1179)
Receiving objects: 92% (1085/1179)
Receiving objects: 93% (1097/1179)
Receiving objects: 94% (1109/1179)
Receiving objects: 95% (1121/1179)
Receiving objects: 96% (1132/1179)
Receiving objects: 97% (1144/1179)
Receiving objects: 98% (1156/1179)
Receiving objects: 99% (1168/1179)
remote: Total 1179 (delta 131), reused 134 (delta 96), pack-reused 972 (from 2)
Receiving objects: 100% (1179/1179)
Receiving objects: 100% (1179/1179), 11.76 MiB | 49.75 MiB/s, done.
Resolving deltas: 0% (0/694)
Resolving deltas: 1% (7/694)
Resolving deltas: 2% (14/694)
Resolving deltas: 3% (21/694)
Resolving deltas: 4% (28/694)
Resolving deltas: 5% (35/694)
Resolving deltas: 6% (42/694)
Resolving deltas: 7% (49/694)
Resolving deltas: 8% (56/694)
Resolving deltas: 9% (63/694)
Resolving deltas: 10% (70/694)
Resolving deltas: 11% (77/694)
Resolving deltas: 12% (84/694)
Resolving deltas: 13% (91/694)
Resolving deltas: 14% (98/694)
Resolving deltas: 15% (105/694)
Resolving deltas: 16% (112/694)
Resolving deltas: 17% (118/694)
Resolving deltas: 18% (125/694)
Resolving deltas: 19% (132/694)
Resolving deltas: 20% (139/694)
Resolving deltas: 21% (146/694)
Resolving deltas: 22% (153/694)
Resolving deltas: 23% (160/694)
Resolving deltas: 24% (167/694)
Resolving deltas: 25% (174/694)
Resolving deltas: 26% (181/694)
Resolving deltas: 27% (189/694)
Resolving deltas: 28% (195/694)
Resolving deltas: 29% (202/694)
Resolving deltas: 30% (209/694)
Resolving deltas: 31% (216/694)
Resolving deltas: 32% (223/694)
Resolving deltas: 33% (230/694)
Resolving deltas: 34% (236/694)
Resolving deltas: 35% (243/694)
Resolving deltas: 36% (250/694)
Resolving deltas: 37% (257/694)
Resolving deltas: 38% (264/694)
Resolving deltas: 39% (271/694)
Resolving deltas: 40% (278/694)
Resolving deltas: 41% (285/694)
Resolving deltas: 42% (292/694)
Resolving deltas: 43% (299/694)
Resolving deltas: 44% (306/694)
Resolving deltas: 45% (313/694)
Resolving deltas: 46% (320/694)
Resolving deltas: 47% (327/694)
Resolving deltas: 48% (334/694)
Resolving deltas: 49% (341/694)
Resolving deltas: 50% (348/694)
Resolving deltas: 51% (354/694)
Resolving deltas: 52% (361/694)
Resolving deltas: 53% (368/694)
Resolving deltas: 54% (375/694)
Resolving deltas: 55% (382/694)
Resolving deltas: 56% (389/694)
Resolving deltas: 57% (396/694)
Resolving deltas: 58% (403/694)
Resolving deltas: 59% (410/694)
Resolving deltas: 60% (417/694)
Resolving deltas: 61% (424/694)
Resolving deltas: 62% (432/694)
Resolving deltas: 63% (438/694)
Resolving deltas: 64% (445/694)
Resolving deltas: 65% (452/694)
Resolving deltas: 66% (459/694)
Resolving deltas: 67% (465/694)
Resolving deltas: 68% (472/694)
Resolving deltas: 69% (479/694)
Resolving deltas: 70% (486/694)
Resolving deltas: 71% (493/694)
Resolving deltas: 72% (500/694)
Resolving deltas: 73% (507/694)
Resolving deltas: 74% (514/694)
Resolving deltas: 75% (521/694)
Resolving deltas: 76% (528/694)
Resolving deltas: 77% (535/694)
Resolving deltas: 78% (542/694)
Resolving deltas: 79% (549/694)
Resolving deltas: 80% (556/694)
Resolving deltas: 81% (563/694)
Resolving deltas: 82% (570/694)
Resolving deltas: 83% (577/694)
Resolving deltas: 84% (583/694)
Resolving deltas: 85% (590/694)
Resolving deltas: 86% (597/694)
Resolving deltas: 87% (604/694)
Resolving deltas: 88% (611/694)
Resolving deltas: 89% (618/694)
Resolving deltas: 90% (625/694)
Resolving deltas: 91% (632/694)
Resolving deltas: 92% (639/694)
Resolving deltas: 93% (646/694)
Resolving deltas: 94% (653/694)
Resolving deltas: 95% (660/694)
Resolving deltas: 96% (667/694)
Resolving deltas: 97% (674/694)
Resolving deltas: 98% (681/694)
Resolving deltas: 99% (688/694)
Resolving deltas: 100% (694/694)
Resolving deltas: 100% (694/694), done.
/home/runner/work/instructor-neuroai-course-content/instructor-neuroai-course-content/projects/project-notebooks/ComputationThruDynamicsBenchmark/DSA
Note: switching to 'a46c3194eb1f736db31e7eca5f433839c2cbc311'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at a46c319 Update dmd.py
Obtaining file:///home/runner/work/instructor-neuroai-course-content/instructor-neuroai-course-content/projects/project-notebooks/ComputationThruDynamicsBenchmark/DSA
Installing build dependencies ... ?25l-
\
done
?25h Checking if build backend supports build_editable ... ?25ldone
?25h Getting requirements to build editable ... ?25l-
done
?25h Preparing editable metadata (pyproject.toml) ... ?25l-
done
?25hRequirement already satisfied: numpy>=1.24.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from DSA==1.0.1) (1.26.4)
Requirement already satisfied: torch>=1.3.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from DSA==1.0.1) (2.1.0)
Collecting kooplearn>=1.1.0 (from DSA==1.0.1)
Downloading kooplearn-2.0.3-py3-none-any.whl.metadata (5.6 kB)
Requirement already satisfied: pot in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from DSA==1.0.1) (0.9.6.post1)
Collecting numpy>=1.24.0 (from DSA==1.0.1)
Downloading numpy-2.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (62 kB)
Requirement already satisfied: pandas>=2.3.3 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from kooplearn>=1.1.0->DSA==1.0.1) (2.3.3)
Collecting scikit-learn>=1.6.1 (from kooplearn>=1.1.0->DSA==1.0.1)
Downloading scikit_learn-1.7.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (11 kB)
Collecting scipy>=1.13.1 (from kooplearn>=1.1.0->DSA==1.0.1)
Downloading scipy-1.15.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
Requirement already satisfied: python-dateutil>=2.8.2 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pandas>=2.3.3->kooplearn>=1.1.0->DSA==1.0.1) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pandas>=2.3.3->kooplearn>=1.1.0->DSA==1.0.1) (2026.2)
Requirement already satisfied: tzdata>=2022.7 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from pandas>=2.3.3->kooplearn>=1.1.0->DSA==1.0.1) (2026.2)
Requirement already satisfied: six>=1.5 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas>=2.3.3->kooplearn>=1.1.0->DSA==1.0.1) (1.17.0)
Requirement already satisfied: joblib>=1.2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from scikit-learn>=1.6.1->kooplearn>=1.1.0->DSA==1.0.1) (1.5.3)
Requirement already satisfied: threadpoolctl>=3.1.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from scikit-learn>=1.6.1->kooplearn>=1.1.0->DSA==1.0.1) (3.6.0)
Requirement already satisfied: filelock in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (3.29.6)
Requirement already satisfied: typing-extensions in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (4.16.0)
Requirement already satisfied: sympy in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (1.14.0)
Requirement already satisfied: networkx in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (3.2.1)
Requirement already satisfied: jinja2 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (3.1.6)
Requirement already satisfied: fsspec in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (2026.6.0)
Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.1.105 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (12.1.105)
Requirement already satisfied: nvidia-cuda-runtime-cu12==12.1.105 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (12.1.105)
Requirement already satisfied: nvidia-cuda-cupti-cu12==12.1.105 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (12.1.105)
Requirement already satisfied: nvidia-cudnn-cu12==8.9.2.26 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (8.9.2.26)
Requirement already satisfied: nvidia-cublas-cu12==12.1.3.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (12.1.3.1)
Requirement already satisfied: nvidia-cufft-cu12==11.0.2.54 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (11.0.2.54)
Requirement already satisfied: nvidia-curand-cu12==10.3.2.106 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (10.3.2.106)
Requirement already satisfied: nvidia-cusolver-cu12==11.4.5.107 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (11.4.5.107)
Requirement already satisfied: nvidia-cusparse-cu12==12.1.0.106 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (12.1.0.106)
Requirement already satisfied: nvidia-nccl-cu12==2.18.1 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (2.18.1)
Requirement already satisfied: nvidia-nvtx-cu12==12.1.105 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (12.1.105)
Requirement already satisfied: triton==2.1.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from torch>=1.3.0->DSA==1.0.1) (2.1.0)
Requirement already satisfied: nvidia-nvjitlink-cu12 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from nvidia-cusolver-cu12==11.4.5.107->torch>=1.3.0->DSA==1.0.1) (12.9.86)
Requirement already satisfied: MarkupSafe>=2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from jinja2->torch>=1.3.0->DSA==1.0.1) (2.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from sympy->torch>=1.3.0->DSA==1.0.1) (1.3.0)
Downloading kooplearn-2.0.3-py3-none-any.whl (90 kB)
Downloading numpy-2.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/16.8 MB ? eta -:--:--
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.8/16.8 MB 295.9 MB/s 0:00:00
?25hDownloading scikit_learn-1.7.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (9.7 MB)
?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/9.7 MB ? eta -:--:--
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.7/9.7 MB 352.6 MB/s 0:00:00
?25hDownloading scipy-1.15.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (37.7 MB)
?25l ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/37.7 MB ? eta -:--:--
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 37.7/37.7 MB 384.3 MB/s 0:00:00
?25h
Building wheels for collected packages: DSA
Building editable for DSA (pyproject.toml) ... ?25l-
done
?25h Created wheel for DSA: filename=dsa-1.0.1-0.editable-py3-none-any.whl size=3678 sha256=4da2945a0391b3cf4afc614a59dcc4f21529b878747dedf3a41256e31dc71269
Stored in directory: /tmp/pip-ephem-wheel-cache-nk85g4z6/wheels/56/20/cc/283f58406259218c4fce92af8a015a2f0ab2b00e2e1e6ef8db
Successfully built DSA
Installing collected packages: numpy, scipy, scikit-learn, kooplearn, DSA
?25l
Attempting uninstall: numpy
Found existing installation: numpy 1.26.4
Uninstalling numpy-1.26.4:
Successfully uninstalled numpy-1.26.4
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
Attempting uninstall: scipy
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
Found existing installation: scipy 1.12.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/5 [numpy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
Uninstalling scipy-1.12.0:
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
Successfully uninstalled scipy-1.12.0
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
Attempting uninstall: scikit-learn
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
Found existing installation: scikit-learn 1.4.1.post1
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
Uninstalling scikit-learn-1.4.1.post1:
━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/5 [scipy]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
Successfully uninstalled scikit-learn-1.4.1.post1
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━ 2/5 [scikit-learn]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5/5 [DSA]
?25h
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
gradio 4.19.2 requires numpy~=1.0, but you have numpy 2.2.6 which is incompatible.
matplotlib 3.8.3 requires numpy<2,>=1.21, but you have numpy 2.2.6 which is incompatible.
numba 0.59.0 requires numpy<1.27,>=1.22, but you have numpy 2.2.6 which is incompatible.
Successfully installed DSA-1.0.1 kooplearn-2.0.3 numpy-2.2.6 scikit-learn-1.7.2 scipy-1.15.3
Found existing installation: kooplearn 2.0.3
Uninstalling kooplearn-2.0.3:
Successfully uninstalled kooplearn-2.0.3
Collecting git+https://github.com/Machine-Learning-Dynamical-Systems/kooplearn.git@260ad84beb86acc706e4f43d9b7b5e8bc4e8b18c
Cloning https://github.com/Machine-Learning-Dynamical-Systems/kooplearn.git (to revision 260ad84beb86acc706e4f43d9b7b5e8bc4e8b18c) to /tmp/pip-req-build-t6bwt3co
Running command git clone --filter=blob:none --quiet https://github.com/Machine-Learning-Dynamical-Systems/kooplearn.git /tmp/pip-req-build-t6bwt3co
Running command git rev-parse -q --verify 'sha^260ad84beb86acc706e4f43d9b7b5e8bc4e8b18c'
Running command git fetch -q https://github.com/Machine-Learning-Dynamical-Systems/kooplearn.git 260ad84beb86acc706e4f43d9b7b5e8bc4e8b18c
Running command git checkout -q 260ad84beb86acc706e4f43d9b7b5e8bc4e8b18c
Resolved https://github.com/Machine-Learning-Dynamical-Systems/kooplearn.git to commit 260ad84beb86acc706e4f43d9b7b5e8bc4e8b18c
Installing build dependencies ... ?25l-
\
done
?25h Getting requirements to build wheel ... ?25ldone
?25h Preparing metadata (pyproject.toml) ... ?25ldone
?25hRequirement already satisfied: numpy>=1.20.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from kooplearn==1.2.0b1) (2.2.6)
Requirement already satisfied: scikit-learn in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from kooplearn==1.2.0b1) (1.7.2)
Requirement already satisfied: scipy in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from kooplearn==1.2.0b1) (1.15.3)
Requirement already satisfied: tqdm in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from kooplearn==1.2.0b1) (4.66.2)
Requirement already satisfied: joblib>=1.2.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from scikit-learn->kooplearn==1.2.0b1) (1.5.3)
Requirement already satisfied: threadpoolctl>=3.1.0 in /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages (from scikit-learn->kooplearn==1.2.0b1) (3.6.0)
Building wheels for collected packages: kooplearn
Building wheel for kooplearn (pyproject.toml) ... ?25ldone
?25h Created wheel for kooplearn: filename=kooplearn-1.2.0b1-py3-none-any.whl size=74144 sha256=8d3bd666d96de0e7e3960b0734eb62cf93fdaa4c679e8b57e9b154dcb45df935
Stored in directory: /home/runner/.cache/pip/wheels/90/05/c9/e4e1fb2607daf33aceae89088b2a0c5b6c0f48746e6f333138
Successfully built kooplearn
Installing collected packages: kooplearn
Successfully installed kooplearn-1.2.0b1
IMPORTANT!#
Restart the runtime here,#
then rerun the (Part 3) above,#
then continue to the cells below#
IF RUNNING LOCALLY:
Follow the instructions here to setup the separate environment for this project, or you can run the cell below for general installment.
Local installation
Show code cell source
# @markdown Local installation
import contextlib
import io
import os
dirname = "ComputationThruDynamicsBenchmark"
with contextlib.redirect_stdout(io.StringIO()): #to suppress output
if not os.path.isdir(dirname):
! git clone https://github.com/neuromatch/ComputationThruDynamicsBenchmark
%cd ComputationThruDynamicsBenchmark
! pip install -e .
envStr = """HOME_DIR=ComputationThruDynamicsBenchmark/
#Don't change these
TRAIN_INPUT_FILE=train_input.h5\nEVAL_INPUT_FILE=eval_input.h5
EVAL_TARGET_FILE=eval_target.h5
"""
with open('.env','w') as f:
f.write(envStr)
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_preparing_environment")
Section 2: Overview of the available tasks#
First, let’s take a high-level look at the tasks that we are going to use to understand computation in artificial networks!
We’ll start by loading in some packages.
# set the random seed for reproducibility
import random
import dotenv
import pathlib
import os
import logging
# comment the next three lines if you want to see all training logs
pl_loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict if 'pytorch_lightning' in name]
for pl_log in pl_loggers:
logging.getLogger(pl_log.name).setLevel(logging.WARNING)
random.seed(2024)
dotenv.load_dotenv(override=True)
HOME_DIR = os.getenv("HOME_DIR")
if HOME_DIR is None:
HOME_DIR = ""
print(HOME_DIR)
ComputationThruDynamicsBenchmark/
The Computation-Thru-Dynamics Benchmark has three distinct behavioral tasks.
These tasks are called:
Three-Bit Flip-Flop (3BFF) (see Sussillo & Barak 2013)
MultiTask (See Driscoll et al. 2023)
RandomTarget (See Codol et al. 2023)
We chose these tasks because they represent a variety of task complexities. We have a pretty good understanding of how the simpler tasks operate (3BFF), but really are only starting to scratch the surface of more complex tasks (RandomTarget).
Specificially, in the Random Target task, the actions that the model takes can affect the future inputs, making it an important test case for being able to understand the dynamics of interacting systems!
Each task (which we call a “task environment”) follows a standardized format that allows alternative task environments to be incorporated without any changes to the training pipeline.
Here, we’ll take a walk through the two tasks in the project template (TBFF and RandomTarget) and inspect the behavior of networks trained in these environments.
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_overview_of_the_available_tasks")
Section 3: Understanding the Three-Bit Flip-Flop task (3BFF)#
We’re going to start out with the task that launched a thousand Nature papers, the 3-Bit Flip-Flop. Sussillo & Barak 2013 used the three-bit flip-flop in their seminal attempts to understand how dynamics can give rise to computation!
The code snippet below instantiates a “TaskEnv” object, which contains the logic for the NBFF task.
❓❓❓
The default parameters are shown in ./interpretability/task_modeling/configs/env_task/NBFF.yaml, but try changing the parameters below to see how that affects trials generated from the environment. Note that this task is modular in the number of bits as well, so it provides an easy way to scale the dimensionality of a very simple dynamical system.
❓❓❓
from ctd.task_modeling.task_env.task_env import NBitFlipFlop
n = 3 # The number of bits in the flip-flop (default: 3)
trial_length = 500 # The number of time steps in each trial (default: 500)
switch_prob = 0.015 # The probability of an input pulse (default: 0.015 pulses/channel / time step)
noise = 0.15 # The standard deviation of the Gaussian noise added to the input (default: 0.15)
# This line creates the NBitFlipFlop environment. See ctd.task_modeling.task_env.task_env.NBitFlipFlop for more information.
env_3bff = NBitFlipFlop(
n = n,
n_timesteps=trial_length,
switch_prob=switch_prob,
noise=noise
)
# Renders a random trial from the environment
env_3bff.render()
Above, we are plotting the inputs and outputs of the 3BFF task. One trial is 500 time steps, each with a 1% probability of getting an “up” or “down” pulse on each of its 3 input channels. When the task receives an “up” pulse, the state corresponding to that input channel moves from zero to one (if possible), and if a state at one receives a “down” pulse, it goes to zero. In this way, this system acts as 3 bits of memory, encoding 8 potential system states (2^3 states). We add noise to the inputs of the system so that it better reflects realistic computations that a neural circuit might perform.
Try changing the parameters of your 3BFF environment to see how the behavior changes!
Another way to visualize this is to view the three states in 3D. Below, you can see that the 8 potential states appear as the vertices of a cube. Each trial is plotted as a column.
env_3bff.render_3d(n_trials=6)
Now that we can see the basic logic of the task, let’s do a basic overview of what task training is!
For task-training, we are simply training a model (e.g., an RNN) to produce a set of outputs given a set of inputs. This input/output relationship defines the task that the model is performing. In the case of 3BFF, an input pulse should cause the model’s output to change in a way that reflects the switching of a bit.
3BFF Training Objective:
3BFF models are trained to minimize the MSE between the desired output and the output of the model, with some other components that pressure the solution to be smooth. If you’re interested in the specifics, the implementation of the loss function can be found as the NBFFLoss object in ctd/task_modeling/task_env/loss_func.py.
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_understanding_3bff")
Section 4: Training a model to perform 3BFF#
For this tutorial, we are using PyTorch Lightning to abstract much of the engineering away, allowing you to focus your full attention on the scientific questions you want to tackle!
This segment takes around 8 minutes to train, so I’d recommend planning your runs accordingly!
⏳⏳⏳
The cell below will create a recurrent neural network (RNN) model and use the 3BFF environment to generate samples on which the model will be trained!
Unfortunately, it generates a lot of output, so if you don’t care to see the model progress, set enable_progress_bar to False below.
from ctd.task_modeling.model.rnn import GRU_RNN
from ctd.task_modeling.datamodule.task_datamodule import TaskDataModule
from ctd.task_modeling.task_wrapper.task_wrapper import TaskTrainedWrapper
from pytorch_lightning import Trainer
enable_progress_bar = True
# Step 1: Instantiate the model
rnn = GRU_RNN(latent_size = 128) # Look in ctd/task_modeling/models for alternative choices!
# Step 2: Instantiate the task environment
task_env = env_3bff
# Step 3: Instantiate the task datamodule
task_datamodule = TaskDataModule(task_env, n_samples = 1000, batch_size = 1000, num_workers=2)
# Step 4: Instantiate the task wrapper
task_wrapper = TaskTrainedWrapper(learning_rate=1e-3, weight_decay = 1e-8)
# Step 5: Initialize the model with the input and output sizes (3 inputs, 3 outputs, in this case)
rnn.init_model(
input_size = task_env.observation_space.shape[0],
output_size = task_env.action_space.shape[0]
)
# Step 6: Set the environment and model in the task wrapper
task_wrapper.set_environment(task_env)
task_wrapper.set_model(rnn)
# Step 7: Define the PyTorch Lightning Trainer object
trainer = Trainer(max_epochs=100, enable_progress_bar=enable_progress_bar)
# Step 8: Fit the model
trainer.fit(task_wrapper, task_datamodule)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[18], line 34
31 trainer = Trainer(max_epochs=100, enable_progress_bar=enable_progress_bar)
33 # Step 8: Fit the model
---> 34 trainer.fit(task_wrapper, task_datamodule)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:544, in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
542 self.state.status = TrainerStatus.RUNNING
543 self.training = True
--> 544 call._call_and_handle_interrupt(
545 self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
546 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py:44, in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
42 if trainer.strategy.launcher is not None:
43 return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
---> 44 return trainer_fn(*args, **kwargs)
46 except _TunerExitException:
47 _call_teardown_hook(trainer)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:580, in Trainer._fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
573 assert self.state.fn is not None
574 ckpt_path = self._checkpoint_connector._select_ckpt_path(
575 self.state.fn,
576 ckpt_path,
577 model_provided=True,
578 model_connected=self.lightning_module is not None,
579 )
--> 580 self._run(model, ckpt_path=ckpt_path)
582 assert self.state.stopped
583 self.training = False
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:950, in Trainer._run(self, model, ckpt_path)
947 self.strategy.setup_environment()
948 self.__setup_profiler()
--> 950 call._call_setup_hook(self) # allow user to setup lightning_module in accelerator environment
952 # check if we should delay restoring checkpoint till later
953 if not self.strategy.restore_checkpoint_after_setup:
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py:86, in _call_setup_hook(trainer)
84 # Trigger lazy creation of experiment in loggers so loggers have their metadata available
85 for logger in trainer.loggers:
---> 86 if hasattr(logger, "experiment"):
87 _ = logger.experiment
89 trainer.strategy.barrier("pre_setup")
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/lightning_fabric/loggers/logger.py:118, in rank_zero_experiment.<locals>.experiment(self)
116 if rank_zero_only.rank > 0:
117 return _DummyExperiment()
--> 118 return fn(self)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/lightning_fabric/loggers/tensorboard.py:187, in TensorBoardLogger.experiment(self)
184 self._fs.makedirs(self.root_dir, exist_ok=True)
186 if _TENSORBOARD_AVAILABLE:
--> 187 from torch.utils.tensorboard import SummaryWriter
188 else:
189 from tensorboardX import SummaryWriter # type: ignore[no-redef]
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py:12
9 del Version
10 del tensorboard
---> 12 from .writer import FileWriter, SummaryWriter # noqa: F401
13 from tensorboard.summary.writer.record_writer import RecordWriter # noqa: F401
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/torch/utils/tensorboard/writer.py:10
7 import torch
9 from tensorboard.compat import tf
---> 10 from tensorboard.compat.proto import event_pb2
11 from tensorboard.compat.proto.event_pb2 import Event, SessionLog
12 from tensorboard.plugins.projector.projector_config_pb2 import ProjectorConfig
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/event_pb2.py:17
12 # @@protoc_insertion_point(imports)
14 _sym_db = _symbol_database.Default()
---> 17 from tensorboard.compat.proto import summary_pb2 as tensorboard_dot_compat_dot_proto_dot_summary__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/event.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_summary__pb2.DESCRIPTOR,])
29 _WORKERHEALTH = _descriptor.EnumDescriptor(
30 name='WorkerHealth',
31 full_name='tensorboard.WorkerHealth',
(...)
55 serialized_end=1319,
56 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/summary_pb2.py:17
12 # @@protoc_insertion_point(imports)
14 _sym_db = _symbol_database.Default()
---> 17 from tensorboard.compat.proto import tensor_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/summary.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_tensor__pb2.DESCRIPTOR,])
29 _DATACLASS = _descriptor.EnumDescriptor(
30 name='DataClass',
31 full_name='tensorboard.DataClass',
(...)
55 serialized_end=1228,
56 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/tensor_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorboard.compat.proto import resource_handle_pb2 as tensorboard_dot_compat_dot_proto_dot_resource__handle__pb2
17 from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
18 from tensorboard.compat.proto import types_pb2 as tensorboard_dot_compat_dot_proto_dot_types__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/resource_handle_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
17 from tensorboard.compat.proto import types_pb2 as tensorboard_dot_compat_dot_proto_dot_types__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/resource_handle.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2.DESCRIPTOR,tensorboard_dot_compat_dot_proto_dot_types__pb2.DESCRIPTOR,])
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/tensor_shape_pb2.py:36
13 _sym_db = _symbol_database.Default()
18 DESCRIPTOR = _descriptor.FileDescriptor(
19 name='tensorboard/compat/proto/tensor_shape.proto',
20 package='tensorboard',
(...)
23 serialized_pb=_b('\n+tensorboard/compat/proto/tensor_shape.proto\x12\x0btensorboard\"{\n\x10TensorShapeProto\x12.\n\x03\x64im\x18\x02 \x03(\x0b\x32!.tensorboard.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB\x87\x01\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto\xf8\x01\x01\x62\x06proto3')
24 )
29 _TENSORSHAPEPROTO_DIM = _descriptor.Descriptor(
30 name='Dim',
31 full_name='tensorboard.TensorShapeProto.Dim',
32 filename=None,
33 file=DESCRIPTOR,
34 containing_type=None,
35 fields=[
---> 36 _descriptor.FieldDescriptor(
37 name='size', full_name='tensorboard.TensorShapeProto.Dim.size', index=0,
38 number=1, type=3, cpp_type=2, label=1,
39 has_default_value=False, default_value=0,
40 message_type=None, enum_type=None, containing_type=None,
41 is_extension=False, extension_scope=None,
42 serialized_options=None, file=DESCRIPTOR),
43 _descriptor.FieldDescriptor(
44 name='name', full_name='tensorboard.TensorShapeProto.Dim.name', index=1,
45 number=2, type=9, cpp_type=9, label=1,
46 has_default_value=False, default_value=_b("").decode('utf-8'),
47 message_type=None, enum_type=None, containing_type=None,
48 is_extension=False, extension_scope=None,
49 serialized_options=None, file=DESCRIPTOR),
50 ],
51 extensions=[
52 ],
53 nested_types=[],
54 enum_types=[
55 ],
56 serialized_options=None,
57 is_extendable=False,
58 syntax='proto3',
59 extension_ranges=[],
60 oneofs=[
61 ],
62 serialized_start=150,
63 serialized_end=183,
64 )
66 _TENSORSHAPEPROTO = _descriptor.Descriptor(
67 name='TensorShapeProto',
68 full_name='tensorboard.TensorShapeProto',
(...)
100 serialized_end=183,
101 )
103 _TENSORSHAPEPROTO_DIM.containing_type = _TENSORSHAPEPROTO
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/google/protobuf/descriptor.py:675, in FieldDescriptor.__new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key)
652 def __new__(
653 cls,
654 name,
(...)
673 create_key=None,
674 ): # pylint: disable=redefined-builtin
--> 675 _message.Message._CheckCalledFromGeneratedFile()
676 if is_extension:
677 return _message.default_pool.FindExtensionByName(full_name)
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
Now, we use pickle to save the trained model and datamodule for future analyses!
❓❓❓
Once you get this model trained, feel free to try changing the hyperparameters to see if you can get the model to train faster!
❓❓❓
import pickle
# save model as .pkl
save_dir = pathlib.Path(HOME_DIR) / "models_GRU_128"
save_dir.mkdir(exist_ok=True)
with open(save_dir / "model.pkl", "wb") as f:
pickle.dump(task_wrapper, f)
# save datamodule as .pkl
with open(save_dir / "datamodule_sim.pkl", "wb") as f:
pickle.dump(task_datamodule, f)
So that we can start comparing our models, we’re going to train a second GRU_RNN to perform the 3BFF task, except this time, we’ll use an alternative model called a Neural ODE!
Notice that we’re using the same datamodule as for the first model, meaning that we can directly compare the two models trial-by-trial.
Again, this will take around 10 minutes to train!
⏳⏳⏳
from ctd.task_modeling.model.node import NODE
enable_progress_bar = True
rnn = NODE(latent_size = 3, num_layers = 3, layer_hidden_size=64) # Look in ctd/task_modeling/models for alternative choices!
task_wrapper = TaskTrainedWrapper(learning_rate=1e-3, weight_decay = 1e-10)
rnn.init_model(
input_size = task_env.observation_space.shape[0],
output_size = task_env.action_space.shape[0]
)
task_wrapper.set_environment(task_env)
task_wrapper.set_model(rnn)
trainer = Trainer(max_epochs=100, enable_progress_bar=enable_progress_bar)
trainer.fit(task_wrapper, task_datamodule)
save_dir = pathlib.Path(HOME_DIR) / "models_NODE_3"
save_dir.mkdir(exist_ok=True)
with open(save_dir / "model.pkl", "wb") as f:
pickle.dump(task_wrapper, f)
# save datamodule as .pkl
with open(save_dir / "datamodule_sim.pkl", "wb") as f:
pickle.dump(task_datamodule, f)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[20], line 13
10 task_wrapper.set_model(rnn)
11 trainer = Trainer(max_epochs=100, enable_progress_bar=enable_progress_bar)
---> 13 trainer.fit(task_wrapper, task_datamodule)
15 save_dir = pathlib.Path(HOME_DIR) / "models_NODE_3"
16 save_dir.mkdir(exist_ok=True)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:544, in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
542 self.state.status = TrainerStatus.RUNNING
543 self.training = True
--> 544 call._call_and_handle_interrupt(
545 self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
546 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py:44, in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
42 if trainer.strategy.launcher is not None:
43 return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
---> 44 return trainer_fn(*args, **kwargs)
46 except _TunerExitException:
47 _call_teardown_hook(trainer)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:580, in Trainer._fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
573 assert self.state.fn is not None
574 ckpt_path = self._checkpoint_connector._select_ckpt_path(
575 self.state.fn,
576 ckpt_path,
577 model_provided=True,
578 model_connected=self.lightning_module is not None,
579 )
--> 580 self._run(model, ckpt_path=ckpt_path)
582 assert self.state.stopped
583 self.training = False
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:950, in Trainer._run(self, model, ckpt_path)
947 self.strategy.setup_environment()
948 self.__setup_profiler()
--> 950 call._call_setup_hook(self) # allow user to setup lightning_module in accelerator environment
952 # check if we should delay restoring checkpoint till later
953 if not self.strategy.restore_checkpoint_after_setup:
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py:86, in _call_setup_hook(trainer)
84 # Trigger lazy creation of experiment in loggers so loggers have their metadata available
85 for logger in trainer.loggers:
---> 86 if hasattr(logger, "experiment"):
87 _ = logger.experiment
89 trainer.strategy.barrier("pre_setup")
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/lightning_fabric/loggers/logger.py:118, in rank_zero_experiment.<locals>.experiment(self)
116 if rank_zero_only.rank > 0:
117 return _DummyExperiment()
--> 118 return fn(self)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/lightning_fabric/loggers/tensorboard.py:187, in TensorBoardLogger.experiment(self)
184 self._fs.makedirs(self.root_dir, exist_ok=True)
186 if _TENSORBOARD_AVAILABLE:
--> 187 from torch.utils.tensorboard import SummaryWriter
188 else:
189 from tensorboardX import SummaryWriter # type: ignore[no-redef]
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py:12
9 del Version
10 del tensorboard
---> 12 from .writer import FileWriter, SummaryWriter # noqa: F401
13 from tensorboard.summary.writer.record_writer import RecordWriter # noqa: F401
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/torch/utils/tensorboard/writer.py:10
7 import torch
9 from tensorboard.compat import tf
---> 10 from tensorboard.compat.proto import event_pb2
11 from tensorboard.compat.proto.event_pb2 import Event, SessionLog
12 from tensorboard.plugins.projector.projector_config_pb2 import ProjectorConfig
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/event_pb2.py:17
12 # @@protoc_insertion_point(imports)
14 _sym_db = _symbol_database.Default()
---> 17 from tensorboard.compat.proto import summary_pb2 as tensorboard_dot_compat_dot_proto_dot_summary__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/event.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_summary__pb2.DESCRIPTOR,])
29 _WORKERHEALTH = _descriptor.EnumDescriptor(
30 name='WorkerHealth',
31 full_name='tensorboard.WorkerHealth',
(...)
55 serialized_end=1319,
56 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/summary_pb2.py:17
12 # @@protoc_insertion_point(imports)
14 _sym_db = _symbol_database.Default()
---> 17 from tensorboard.compat.proto import tensor_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/summary.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_tensor__pb2.DESCRIPTOR,])
29 _DATACLASS = _descriptor.EnumDescriptor(
30 name='DataClass',
31 full_name='tensorboard.DataClass',
(...)
55 serialized_end=1228,
56 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/tensor_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorboard.compat.proto import resource_handle_pb2 as tensorboard_dot_compat_dot_proto_dot_resource__handle__pb2
17 from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
18 from tensorboard.compat.proto import types_pb2 as tensorboard_dot_compat_dot_proto_dot_types__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/resource_handle_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
17 from tensorboard.compat.proto import types_pb2 as tensorboard_dot_compat_dot_proto_dot_types__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/resource_handle.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2.DESCRIPTOR,tensorboard_dot_compat_dot_proto_dot_types__pb2.DESCRIPTOR,])
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/tensor_shape_pb2.py:36
13 _sym_db = _symbol_database.Default()
18 DESCRIPTOR = _descriptor.FileDescriptor(
19 name='tensorboard/compat/proto/tensor_shape.proto',
20 package='tensorboard',
(...)
23 serialized_pb=_b('\n+tensorboard/compat/proto/tensor_shape.proto\x12\x0btensorboard\"{\n\x10TensorShapeProto\x12.\n\x03\x64im\x18\x02 \x03(\x0b\x32!.tensorboard.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB\x87\x01\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto\xf8\x01\x01\x62\x06proto3')
24 )
29 _TENSORSHAPEPROTO_DIM = _descriptor.Descriptor(
30 name='Dim',
31 full_name='tensorboard.TensorShapeProto.Dim',
32 filename=None,
33 file=DESCRIPTOR,
34 containing_type=None,
35 fields=[
---> 36 _descriptor.FieldDescriptor(
37 name='size', full_name='tensorboard.TensorShapeProto.Dim.size', index=0,
38 number=1, type=3, cpp_type=2, label=1,
39 has_default_value=False, default_value=0,
40 message_type=None, enum_type=None, containing_type=None,
41 is_extension=False, extension_scope=None,
42 serialized_options=None, file=DESCRIPTOR),
43 _descriptor.FieldDescriptor(
44 name='name', full_name='tensorboard.TensorShapeProto.Dim.name', index=1,
45 number=2, type=9, cpp_type=9, label=1,
46 has_default_value=False, default_value=_b("").decode('utf-8'),
47 message_type=None, enum_type=None, containing_type=None,
48 is_extension=False, extension_scope=None,
49 serialized_options=None, file=DESCRIPTOR),
50 ],
51 extensions=[
52 ],
53 nested_types=[],
54 enum_types=[
55 ],
56 serialized_options=None,
57 is_extendable=False,
58 syntax='proto3',
59 extension_ranges=[],
60 oneofs=[
61 ],
62 serialized_start=150,
63 serialized_end=183,
64 )
66 _TENSORSHAPEPROTO = _descriptor.Descriptor(
67 name='TensorShapeProto',
68 full_name='tensorboard.TensorShapeProto',
(...)
100 serialized_end=183,
101 )
103 _TENSORSHAPEPROTO_DIM.containing_type = _TENSORSHAPEPROTO
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/google/protobuf/descriptor.py:675, in FieldDescriptor.__new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key)
652 def __new__(
653 cls,
654 name,
(...)
673 create_key=None,
674 ): # pylint: disable=redefined-builtin
--> 675 _message.Message._CheckCalledFromGeneratedFile()
676 if is_extension:
677 return _message.default_pool.FindExtensionByName(full_name)
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_training_a_model_to_perform_3bff")
Section 5: Inspecting the performance of trained models#
Now that the models have been trained, let’s see if we can determine how similar their computational strategies are to each other!
To make your life easier, we’ve provided an “analysis” object that abstracts away much of the data handling, allowing you to work more easily with the data from the models.
The analysis object also offers visualization tools that can help to see how well the trained model learned to perform the task!
For example, plot_trial_io is a function that plots (for a specified number of trials):
Latent activity
Controlled output
Target output
Noisy inputs to model
❓❓❓
Try changing trials that are plotted. Do the models capture all of the states equally well?
❓❓❓
Part 1: Visualizing latent activity#
# import typing
# # Monkey-patch Final to behave like Any
# typing.Final = typing.Any
from ctd.comparison.analysis.tt.tt import Analysis_TT
fpath_GRU_128 = HOME_DIR + "models_GRU_128/"
# Create the analysis object:
analysis_GRU_128 = Analysis_TT(
run_name = "GRU_128_3bff",
filepath = fpath_GRU_128)
analysis_GRU_128.plot_trial_io(num_trials = 2)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[22], line 5
1 # import typing
2 # # Monkey-patch Final to behave like Any
3 # typing.Final = typing.Any
----> 5 from ctd.comparison.analysis.tt.tt import Analysis_TT
7 fpath_GRU_128 = HOME_DIR + "models_GRU_128/"
8 # Create the analysis object:
File ~/work/instructor-neuroai-course-content/instructor-neuroai-course-content/projects/project-notebooks/ComputationThruDynamicsBenchmark/DSA/ComputationThruDynamicsBenchmark/ctd/comparison/analysis/tt/tt.py:9
7 import numpy as np
8 import torch
----> 9 from DSA.stats import dsa_bw_data_splits, dsa_to_id
10 from sklearn.decomposition import PCA
12 from ctd.comparison.analysis.analysis import Analysis
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/DSA/__init__.py:3
1 __version__ = "2.0.0"
----> 3 from DSA.dsa import DSA, ControllabilitySimilarityTransformDistConfig, GeneralizedDSA, InputDSA, SimilarityTransformDistConfig
4 from DSA.dsa import DefaultDMDConfig as DMDConfig
5 from DSA.dsa import pyKoopmanDMDConfig, SubspaceDMDcConfig, DMDcConfig
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/DSA/dsa.py:5
3 from DSA.dmdc import DMDc as DefaultDMDc
4 from DSA.subspace_dmdc import SubspaceDMDc
----> 5 from DSA.simdist import SimilarityTransformDist
6 from typing import Literal
7 import torch
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/DSA/simdist.py:9
6 import torch.nn.utils.parametrize as parametrize
7 import warnings
----> 9 from ot import dist, emd, emd2, sinkhorn2
11 try:
12 from .dmd import DMD
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/ot/__init__.py:20
1 """
2 .. warning::
3 The list of automatically imported sub-modules is as follows:
(...)
11 - :any:`ot.plot` : depends on :code:`matplotlib`
12 """
14 # Author: Remi Flamary <remi.flamary@unice.fr>
15 # Nicolas Courty <ncourty@irisa.fr>
16 #
17 # License: MIT License
18
19 # All submodules and packages
---> 20 from . import lp
21 from . import bregman
22 from . import optim
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/ot/lp/__init__.py:11
2 """
3 Solvers for the original linear program OT problem.
4
5 """
7 # Author: Remi Flamary <remi.flamary@unice.fr>
8 #
9 # License: MIT License
---> 11 from .dmmot import dmmot_monge_1dgrid_loss, dmmot_monge_1dgrid_optimize
12 from ._network_simplex import emd, emd2
13 from ._barycenter_solvers import (
14 barycenter,
15 free_support_barycenter,
(...)
19 NorthWestMMGluing,
20 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/ot/lp/dmmot.py:12
6 # Author: Ronak Mehta <ronakrm@cs.wisc.edu>
7 # Xizheng Yu <xyu354@wisc.edu>
8 #
9 # License: MIT License
11 import numpy as np
---> 12 from ..backend import get_backend
15 def dist_monge_max_min(i):
16 r"""
17 A tensor :math:c is Monge if for all valid :math:i_1, \ldots i_d and
18 :math:j_1, \ldots, j_d,
(...)
54 Workshop on Discrete Algorithms.
55 """
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/ot/backend.py:148
146 if not os.environ.get(DISABLE_TF_KEY, False):
147 try:
--> 148 import tensorflow as tf
149 import tensorflow.experimental.numpy as tnp
151 tf_type = tf.Tensor
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/__init__.py:37
34 import sys as _sys
35 import typing as _typing
---> 37 from tensorflow.python.tools import module_util as _module_util
38 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
40 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import.
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/python/__init__.py:37
29 # We aim to keep this file minimal and ideally remove completely.
30 # If you are adding a new file with @tf_export decorators,
31 # import it in modules_with_exports.py instead.
32
33 # go/tf-wildcard-import
34 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
36 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
---> 37 from tensorflow.python.eager import context
39 # pylint: enable=wildcard-import
40
41 # Bring in subpackages.
42 from tensorflow.python import data
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/python/eager/context.py:29
26 import numpy as np
27 import six
---> 29 from tensorflow.core.framework import function_pb2
30 from tensorflow.core.protobuf import config_pb2
31 from tensorflow.core.protobuf import coordination_config_pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/function_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
17 from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
18 from tensorflow.core.framework import op_def_pb2 as tensorflow_dot_core_dot_framework_dot_op__def__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/attr_value_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
17 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
18 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/tensor_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
17 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
18 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/resource_handle_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
17 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorflow/core/framework/resource_handle.proto',
22 package='tensorflow',
(...)
26 ,
27 dependencies=[tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2.DESCRIPTOR,tensorflow_dot_core_dot_framework_dot_types__pb2.DESCRIPTOR,])
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/tensor_shape_pb2.py:36
13 _sym_db = _symbol_database.Default()
18 DESCRIPTOR = _descriptor.FileDescriptor(
19 name='tensorflow/core/framework/tensor_shape.proto',
20 package='tensorflow',
(...)
23 serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"z\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB\x87\x01\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto\xf8\x01\x01\x62\x06proto3')
24 )
29 _TENSORSHAPEPROTO_DIM = _descriptor.Descriptor(
30 name='Dim',
31 full_name='tensorflow.TensorShapeProto.Dim',
32 filename=None,
33 file=DESCRIPTOR,
34 containing_type=None,
35 fields=[
---> 36 _descriptor.FieldDescriptor(
37 name='size', full_name='tensorflow.TensorShapeProto.Dim.size', index=0,
38 number=1, type=3, cpp_type=2, label=1,
39 has_default_value=False, default_value=0,
40 message_type=None, enum_type=None, containing_type=None,
41 is_extension=False, extension_scope=None,
42 serialized_options=None, file=DESCRIPTOR),
43 _descriptor.FieldDescriptor(
44 name='name', full_name='tensorflow.TensorShapeProto.Dim.name', index=1,
45 number=2, type=9, cpp_type=9, label=1,
46 has_default_value=False, default_value=_b("").decode('utf-8'),
47 message_type=None, enum_type=None, containing_type=None,
48 is_extension=False, extension_scope=None,
49 serialized_options=None, file=DESCRIPTOR),
50 ],
51 extensions=[
52 ],
53 nested_types=[],
54 enum_types=[
55 ],
56 serialized_options=None,
57 is_extendable=False,
58 syntax='proto3',
59 extension_ranges=[],
60 oneofs=[
61 ],
62 serialized_start=149,
63 serialized_end=182,
64 )
66 _TENSORSHAPEPROTO = _descriptor.Descriptor(
67 name='TensorShapeProto',
68 full_name='tensorflow.TensorShapeProto',
(...)
100 serialized_end=182,
101 )
103 _TENSORSHAPEPROTO_DIM.containing_type = _TENSORSHAPEPROTO
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/google/protobuf/descriptor.py:675, in FieldDescriptor.__new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key)
652 def __new__(
653 cls,
654 name,
(...)
673 create_key=None,
674 ): # pylint: disable=redefined-builtin
--> 675 _message.Message._CheckCalledFromGeneratedFile()
676 if is_extension:
677 return _message.default_pool.FindExtensionByName(full_name)
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
fpath_NODE = HOME_DIR + "models_NODE_3/"
# Create the analysis object:
analysis_NODE = Analysis_TT(
run_name = "NODE_3_3bff",
filepath = fpath_NODE)
analysis_NODE.plot_trial_io(num_trials = 2)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[23], line 3
1 fpath_NODE = HOME_DIR + "models_NODE_3/"
2 # Create the analysis object:
----> 3 analysis_NODE = Analysis_TT(
4 run_name = "NODE_3_3bff",
5 filepath = fpath_NODE)
7 analysis_NODE.plot_trial_io(num_trials = 2)
NameError: name 'Analysis_TT' is not defined
There are also useful data visualization functions, such as visualizing a scree plot of the latent activity.
A scree plot shows the % of variance in the highest principle component dimensions. From this plot, we can see that the GRU has the majority of its variance in the first 3 PCs, but significant variance remains in the lower PCs!
analysis_GRU_128.plot_scree()
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[24], line 1
----> 1 analysis_GRU_128.plot_scree()
NameError: name 'analysis_GRU_128' is not defined
Importantly, the analysis object also provides functions that give access to the raw latent activity, predicted outputs, etc. of the trained models! All of these functions accept a “phase” variable that designates whether to return the training and/or validation datasets. These functions are:
get_latents(): Returns latent activity of the trained modelget_inputs(): Returns the inputs to the model (for 3BFF, the input pulses)get_model_output(): Returns a dict that contains all model outputs:controlled - the variable that the model is controlling
latents - the latent activity
actions - the output from the model (for RandomTarget only)
states - the state of the environment (for RandomTarget only)
joints - Joint angles (for RandomTarget only)
print(f"All data shape: {analysis_GRU_128.get_latents().shape}")
print(f"Train data shape: {analysis_GRU_128.get_latents(phase = 'train').shape}")
print(f"Validation data shape: {analysis_GRU_128.get_latents(phase = 'val').shape}")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[25], line 1
----> 1 print(f"All data shape: {analysis_GRU_128.get_latents().shape}")
2 print(f"Train data shape: {analysis_GRU_128.get_latents(phase = 'train').shape}")
3 print(f"Validation data shape: {analysis_GRU_128.get_latents(phase = 'val').shape}")
NameError: name 'analysis_GRU_128' is not defined
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_visualizing_latent_activity")
Part 2: Using affine transformations to compare latent activity#
Now that we have the latent activity for the 64D and the 128D GRU models trained on 3BFf, we can investigate how similar their latent activity is.
One problem: The models may be arbitrarily rotated, scaled, and translated relative to each other!
This means that we need to find the best “fit” between the two models that doesn’t fail when they are equivalent under an “affine” transformation (meaning a linear transformation and/or translation).
Luckily, we have a tool that can solve this problem for us! Linear regression.
In this code, we are:
Getting the latent activity from each model
Performing PCA on the latent activity (to get the dimensions ordered by their variance)
Fit a linear regression from one set of latent activity to the other.
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
from sklearn.decomposition import PCA
source = analysis_GRU_128
target = analysis_NODE
# Get the latent activity from the validation phase for each model:
latents_source = source.get_latents(phase='train').detach().numpy()
latents_targ = target.get_latents(phase='train').detach().numpy()
latents_source_val = source.get_latents(phase='val').detach().numpy()
latents_targ_val = target.get_latents(phase='val').detach().numpy()
n_trials, n_timesteps, n_latent_source = latents_source.shape
n_trials, n_timesteps, n_latent_targ = latents_targ.shape
n_trials_val, n_timesteps_val, n_latent_source_val = latents_source_val.shape
n_trials_val, n_timesteps_val, n_latent_targ_val = latents_targ_val.shape
print(f"Latent shape for source model: {latents_source.shape}"
f"\nLatent shape for target model: {latents_targ.shape}")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[27], line 5
2 from sklearn.metrics import r2_score
3 from sklearn.decomposition import PCA
----> 5 source = analysis_GRU_128
6 target = analysis_NODE
8 # Get the latent activity from the validation phase for each model:
NameError: name 'analysis_GRU_128' is not defined
# Perform PCA on both latent spaces to find axes of highest variance
pca_source = PCA()
pca_targ = PCA()
lats_source_pca = pca_source.fit_transform(latents_source.reshape(-1, n_latent_source)).reshape((n_trials, n_timesteps, -1))
lats_source_pca_val = pca_source.transform(latents_source_val.reshape(-1, n_latent_source)).reshape((n_trials, n_timesteps, -1))
lats_targ_pca = pca_targ.fit_transform(latents_targ.reshape(-1, n_latent_targ)).reshape((n_trials, n_timesteps, -1))
lats_targ_pca_val = pca_targ.transform(latents_targ_val.reshape(-1, n_latent_targ_val)).reshape((n_trials_val, n_timesteps_val, -1))
# Fit a linear regression model to predict the target latents from the source latents
reg = LinearRegression().fit(lats_source_pca.reshape(-1, n_latent_source), lats_targ_pca.reshape(-1, n_latent_targ))
# Get the R2 of the fit
preds = reg.predict(lats_source_pca_val.reshape(-1, n_latent_source_val))
r2s = r2_score(lats_targ_pca_val.reshape((-1, n_latent_targ_val)), preds, multioutput = "raw_values")
r2_var = r2_score(lats_targ_pca_val.reshape((-1, n_latent_targ_val)), preds, multioutput = "variance_weighted")
print(f"R2 of linear regression fit: {r2s}")
print(f"Variance-weighted R2 of linear regression fit: {r2_var}")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[28], line 4
2 pca_source = PCA()
3 pca_targ = PCA()
----> 4 lats_source_pca = pca_source.fit_transform(latents_source.reshape(-1, n_latent_source)).reshape((n_trials, n_timesteps, -1))
5 lats_source_pca_val = pca_source.transform(latents_source_val.reshape(-1, n_latent_source)).reshape((n_trials, n_timesteps, -1))
7 lats_targ_pca = pca_targ.fit_transform(latents_targ.reshape(-1, n_latent_targ)).reshape((n_trials, n_timesteps, -1))
NameError: name 'latents_source' is not defined
So, the variance weighted R2 from the source to the target is ~0.93.
Importantly, we had to pick a “direction” to compute this R2 value. What happens if we switch the source and targets?
❓❓❓
Try reversing the direction (the source and targets) and see how well the model fits!
❓❓❓
One final tool that is provided to you is the comparison object, which makes many of these direct comparisons within the object itself. Here is one example visualization that shows how similar the latent activities of two example trials are for these two models!
This function has the affine transformation “built-in,” so you don’t need this to show what your R2 value above looks like in the first 3 PCs!
from ctd.comparison.comparison import Comparison
comp = Comparison()
comp.load_analysis(analysis_GRU_128, reference_analysis=True)
comp.load_analysis(analysis_NODE)
comp.plot_trials_3d_reference(num_trials=2)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[29], line 1
----> 1 from ctd.comparison.comparison import Comparison
2 comp = Comparison()
3 comp.load_analysis(analysis_GRU_128, reference_analysis=True)
File ~/work/instructor-neuroai-course-content/instructor-neuroai-course-content/projects/project-notebooks/ComputationThruDynamicsBenchmark/DSA/ComputationThruDynamicsBenchmark/ctd/comparison/comparison.py:4
2 import numpy as np
3 import torch
----> 4 from DSA import DSA
5 from scipy.spatial import procrustes
6 from sklearn.cross_decomposition import CCA
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/DSA/__init__.py:3
1 __version__ = "2.0.0"
----> 3 from DSA.dsa import DSA, ControllabilitySimilarityTransformDistConfig, GeneralizedDSA, InputDSA, SimilarityTransformDistConfig
4 from DSA.dsa import DefaultDMDConfig as DMDConfig
5 from DSA.dsa import pyKoopmanDMDConfig, SubspaceDMDcConfig, DMDcConfig
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/DSA/dsa.py:5
3 from DSA.dmdc import DMDc as DefaultDMDc
4 from DSA.subspace_dmdc import SubspaceDMDc
----> 5 from DSA.simdist import SimilarityTransformDist
6 from typing import Literal
7 import torch
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/DSA/simdist.py:9
6 import torch.nn.utils.parametrize as parametrize
7 import warnings
----> 9 from ot import dist, emd, emd2, sinkhorn2
11 try:
12 from .dmd import DMD
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/ot/__init__.py:20
1 """
2 .. warning::
3 The list of automatically imported sub-modules is as follows:
(...)
11 - :any:`ot.plot` : depends on :code:`matplotlib`
12 """
14 # Author: Remi Flamary <remi.flamary@unice.fr>
15 # Nicolas Courty <ncourty@irisa.fr>
16 #
17 # License: MIT License
18
19 # All submodules and packages
---> 20 from . import lp
21 from . import bregman
22 from . import optim
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/ot/lp/__init__.py:11
2 """
3 Solvers for the original linear program OT problem.
4
5 """
7 # Author: Remi Flamary <remi.flamary@unice.fr>
8 #
9 # License: MIT License
---> 11 from .dmmot import dmmot_monge_1dgrid_loss, dmmot_monge_1dgrid_optimize
12 from ._network_simplex import emd, emd2
13 from ._barycenter_solvers import (
14 barycenter,
15 free_support_barycenter,
(...)
19 NorthWestMMGluing,
20 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/ot/lp/dmmot.py:12
6 # Author: Ronak Mehta <ronakrm@cs.wisc.edu>
7 # Xizheng Yu <xyu354@wisc.edu>
8 #
9 # License: MIT License
11 import numpy as np
---> 12 from ..backend import get_backend
15 def dist_monge_max_min(i):
16 r"""
17 A tensor :math:c is Monge if for all valid :math:i_1, \ldots i_d and
18 :math:j_1, \ldots, j_d,
(...)
54 Workshop on Discrete Algorithms.
55 """
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/ot/backend.py:148
146 if not os.environ.get(DISABLE_TF_KEY, False):
147 try:
--> 148 import tensorflow as tf
149 import tensorflow.experimental.numpy as tnp
151 tf_type = tf.Tensor
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/__init__.py:37
34 import sys as _sys
35 import typing as _typing
---> 37 from tensorflow.python.tools import module_util as _module_util
38 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
40 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import.
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/python/__init__.py:37
29 # We aim to keep this file minimal and ideally remove completely.
30 # If you are adding a new file with @tf_export decorators,
31 # import it in modules_with_exports.py instead.
32
33 # go/tf-wildcard-import
34 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
36 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
---> 37 from tensorflow.python.eager import context
39 # pylint: enable=wildcard-import
40
41 # Bring in subpackages.
42 from tensorflow.python import data
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/python/eager/context.py:29
26 import numpy as np
27 import six
---> 29 from tensorflow.core.framework import function_pb2
30 from tensorflow.core.protobuf import config_pb2
31 from tensorflow.core.protobuf import coordination_config_pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/function_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
17 from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
18 from tensorflow.core.framework import op_def_pb2 as tensorflow_dot_core_dot_framework_dot_op__def__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/attr_value_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
17 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
18 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/tensor_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
17 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
18 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/resource_handle_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
17 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorflow/core/framework/resource_handle.proto',
22 package='tensorflow',
(...)
26 ,
27 dependencies=[tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2.DESCRIPTOR,tensorflow_dot_core_dot_framework_dot_types__pb2.DESCRIPTOR,])
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorflow/core/framework/tensor_shape_pb2.py:36
13 _sym_db = _symbol_database.Default()
18 DESCRIPTOR = _descriptor.FileDescriptor(
19 name='tensorflow/core/framework/tensor_shape.proto',
20 package='tensorflow',
(...)
23 serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"z\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB\x87\x01\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto\xf8\x01\x01\x62\x06proto3')
24 )
29 _TENSORSHAPEPROTO_DIM = _descriptor.Descriptor(
30 name='Dim',
31 full_name='tensorflow.TensorShapeProto.Dim',
32 filename=None,
33 file=DESCRIPTOR,
34 containing_type=None,
35 fields=[
---> 36 _descriptor.FieldDescriptor(
37 name='size', full_name='tensorflow.TensorShapeProto.Dim.size', index=0,
38 number=1, type=3, cpp_type=2, label=1,
39 has_default_value=False, default_value=0,
40 message_type=None, enum_type=None, containing_type=None,
41 is_extension=False, extension_scope=None,
42 serialized_options=None, file=DESCRIPTOR),
43 _descriptor.FieldDescriptor(
44 name='name', full_name='tensorflow.TensorShapeProto.Dim.name', index=1,
45 number=2, type=9, cpp_type=9, label=1,
46 has_default_value=False, default_value=_b("").decode('utf-8'),
47 message_type=None, enum_type=None, containing_type=None,
48 is_extension=False, extension_scope=None,
49 serialized_options=None, file=DESCRIPTOR),
50 ],
51 extensions=[
52 ],
53 nested_types=[],
54 enum_types=[
55 ],
56 serialized_options=None,
57 is_extendable=False,
58 syntax='proto3',
59 extension_ranges=[],
60 oneofs=[
61 ],
62 serialized_start=149,
63 serialized_end=182,
64 )
66 _TENSORSHAPEPROTO = _descriptor.Descriptor(
67 name='TensorShapeProto',
68 full_name='tensorflow.TensorShapeProto',
(...)
100 serialized_end=182,
101 )
103 _TENSORSHAPEPROTO_DIM.containing_type = _TENSORSHAPEPROTO
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/google/protobuf/descriptor.py:675, in FieldDescriptor.__new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key)
652 def __new__(
653 cls,
654 name,
(...)
673 create_key=None,
674 ): # pylint: disable=redefined-builtin
--> 675 _message.Message._CheckCalledFromGeneratedFile()
676 if is_extension:
677 return _message.default_pool.FindExtensionByName(full_name)
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_using_affine_transformations_to_compare_latent_activity")
Part 3: Fixed-point finding#
Finally, we can use fixed-point finding to inspect the linearized dynamics of the trained model.
What are fixed-points?
Fixed points are points in the dynamics for which the flow field is zero, meaning that points at that location do not move.
The fixed point structure for the 3BFF task was first shown in the original Sussillo and Barack paper.
We can see that the fixed-points are at the vertices of the cube above, drawing the activity towards them and keeping it there until an input pushes it out!
We use a modified version of a fixed point finder released by Golub et al. 2018 to search the flow field for these zero points.
❓❓❓
Try changing some of these parameters:
How quickly are the fixed-points found in the model?
How many initializations are needed to find the fixed points?
Do the stability properties tell us anything about the underlying computation?
❓❓❓
Importantly from Driscol et al. 2022, we know that changes in the inputs can have large effects on the fixed point architecture, so we’re going to set the inputs to zero in this optimization.
import torch
import contextlib
import io
# with contextlib.redirect_stdout(io.StringIO()): #to suppress output
fps = analysis_GRU_128.plot_fps(
inputs= torch.zeros(3),
n_inits=1024,
learning_rate=1e-3,
noise_scale=0.0,
max_iters=20000,
seed=0,
compute_jacobians=True,
q_thresh=1e-5,
)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[31], line 6
3 import io
5 # with contextlib.redirect_stdout(io.StringIO()): #to suppress output
----> 6 fps = analysis_GRU_128.plot_fps(
7 inputs= torch.zeros(3),
8 n_inits=1024,
9 learning_rate=1e-3,
10 noise_scale=0.0,
11 max_iters=20000,
12 seed=0,
13 compute_jacobians=True,
14 q_thresh=1e-5,
15 )
NameError: name 'analysis_GRU_128' is not defined
import matplotlib.pyplot as plt
q_thesh = 1e-6
q_vals = fps.qstar
x_star = fps.xstar[q_vals < q_thesh]
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x_star[:, 0], x_star[:, 1], x_star[:, 2], c='r', marker='o')
fig.show()
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[32], line 3
1 import matplotlib.pyplot as plt
2 q_thesh = 1e-6
----> 3 q_vals = fps.qstar
4 x_star = fps.xstar[q_vals < q_thesh]
5 fig = plt.figure(figsize=(10, 10))
NameError: name 'fps' is not defined
❓❓❓
What can you find out about the FPs of the trained models? Can you modify the FP finding to get more interpretable results?
What can we learn about the computational solution built in this 3BFF network from these fixed-point architectures?
❓❓❓
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_fixed_point_finding")
Section 6: Introducing the Random Target task#
Now that we’ve developed intuition on a simple, well-understood task, let’s move up the ladder of complexity!
The second task is a random-target reaching task performed by an RNN controlling a 2-joint musculoskeletal model of an arm actuated by 6 Mujoco muscles. This environment was built using MotorNet, a package developed by Oli Codol et al. that provides environments for training RNNs to control biomechanical models!
Here is a short clip of what this task looks like when performed by a well-trained model:
Behaviorally, the task has the following structure:
A random initial hand position is sampled from a range of reachable locations; the model is instructed to maintain that hand position.
A random target position is chosen from the range of reachable locations and fed to the model.
After a random delay period, a go-cue is fed to the model, which prompts the model to generate muscle activations that drive the hand to the target location.
On 20% of trials, the go-cue is never supplied (“catch” trials)
On 50% of trials, a randomly directed bump perturbation (5-10 N, 150-300 ms duration) is applied to the hand.
50% of these bumps occur in a small window after the go-cue
50% of these bumps occur at a random time in the trial
The model is trained to:
Minimize the MSE between the hand position and the desired hand position
Minimize the squared muscle activation
with each loss term being weighted by a scalar.
from ctd.task_modeling.task_env.task_env import RandomTarget
from motornet.effector import RigidTendonArm26
from motornet.muscle import MujocoHillMuscle
# Create the analysis object:
rt_task_env = RandomTarget(effector = RigidTendonArm26(muscle = MujocoHillMuscle()))
⏳⏳⏳
Now, to train the model! We use the same procedure as the 3BFF above; however, this model will take a bit longer to train, as of the serial nature of this task, the parallelization allowed by GPUs doesn’t help speed up our training!
⏳⏳⏳
from ctd.task_modeling.model.rnn import GRU_RNN
from ctd.task_modeling.datamodule.task_datamodule import TaskDataModule
from ctd.task_modeling.task_wrapper.task_wrapper import TaskTrainedWrapper
from pytorch_lightning import Trainer
# Step 1: Instantiate the model
rnn = GRU_RNN(latent_size = 128) # Look in ctd/task_modeling/models for alternative choices!
# Step 2: Instantiate the task environment
task_env = rt_task_env
# Step 3: Instantiate the task datamodule
task_datamodule = TaskDataModule(task_env, n_samples = 1000, batch_size = 256)
# Step 4: Instantiate the task wrapper
task_wrapper = TaskTrainedWrapper(learning_rate=1e-3, weight_decay = 1e-8)
# Step 5: Initialize the model with the input and output sizes
rnn.init_model(
input_size = task_env.observation_space.shape[0] + task_env.context_inputs.shape[0],
output_size = task_env.action_space.shape[0]
)
# Step 6: Set the environment and model in the task wrapper
task_wrapper.set_environment(task_env)
task_wrapper.set_model(rnn)
# Step 7: Define the PyTorch Lightning Trainer object (put `enable_progress_bar=True` to observe training progress)
trainer = Trainer(accelerator= "cpu",max_epochs=100,enable_progress_bar=True)
# Step 8: Fit the model
trainer.fit(task_wrapper, task_datamodule)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[35], line 32
29 trainer = Trainer(accelerator= "cpu",max_epochs=100,enable_progress_bar=True)
31 # Step 8: Fit the model
---> 32 trainer.fit(task_wrapper, task_datamodule)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:544, in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
542 self.state.status = TrainerStatus.RUNNING
543 self.training = True
--> 544 call._call_and_handle_interrupt(
545 self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
546 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py:44, in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
42 if trainer.strategy.launcher is not None:
43 return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
---> 44 return trainer_fn(*args, **kwargs)
46 except _TunerExitException:
47 _call_teardown_hook(trainer)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:580, in Trainer._fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
573 assert self.state.fn is not None
574 ckpt_path = self._checkpoint_connector._select_ckpt_path(
575 self.state.fn,
576 ckpt_path,
577 model_provided=True,
578 model_connected=self.lightning_module is not None,
579 )
--> 580 self._run(model, ckpt_path=ckpt_path)
582 assert self.state.stopped
583 self.training = False
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py:950, in Trainer._run(self, model, ckpt_path)
947 self.strategy.setup_environment()
948 self.__setup_profiler()
--> 950 call._call_setup_hook(self) # allow user to setup lightning_module in accelerator environment
952 # check if we should delay restoring checkpoint till later
953 if not self.strategy.restore_checkpoint_after_setup:
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/pytorch_lightning/trainer/call.py:86, in _call_setup_hook(trainer)
84 # Trigger lazy creation of experiment in loggers so loggers have their metadata available
85 for logger in trainer.loggers:
---> 86 if hasattr(logger, "experiment"):
87 _ = logger.experiment
89 trainer.strategy.barrier("pre_setup")
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/lightning_fabric/loggers/logger.py:118, in rank_zero_experiment.<locals>.experiment(self)
116 if rank_zero_only.rank > 0:
117 return _DummyExperiment()
--> 118 return fn(self)
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/lightning_fabric/loggers/tensorboard.py:187, in TensorBoardLogger.experiment(self)
184 self._fs.makedirs(self.root_dir, exist_ok=True)
186 if _TENSORBOARD_AVAILABLE:
--> 187 from torch.utils.tensorboard import SummaryWriter
188 else:
189 from tensorboardX import SummaryWriter # type: ignore[no-redef]
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py:12
9 del Version
10 del tensorboard
---> 12 from .writer import FileWriter, SummaryWriter # noqa: F401
13 from tensorboard.summary.writer.record_writer import RecordWriter # noqa: F401
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/torch/utils/tensorboard/writer.py:10
7 import torch
9 from tensorboard.compat import tf
---> 10 from tensorboard.compat.proto import event_pb2
11 from tensorboard.compat.proto.event_pb2 import Event, SessionLog
12 from tensorboard.plugins.projector.projector_config_pb2 import ProjectorConfig
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/event_pb2.py:17
12 # @@protoc_insertion_point(imports)
14 _sym_db = _symbol_database.Default()
---> 17 from tensorboard.compat.proto import summary_pb2 as tensorboard_dot_compat_dot_proto_dot_summary__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/event.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_summary__pb2.DESCRIPTOR,])
29 _WORKERHEALTH = _descriptor.EnumDescriptor(
30 name='WorkerHealth',
31 full_name='tensorboard.WorkerHealth',
(...)
55 serialized_end=1319,
56 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/summary_pb2.py:17
12 # @@protoc_insertion_point(imports)
14 _sym_db = _symbol_database.Default()
---> 17 from tensorboard.compat.proto import tensor_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/summary.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_tensor__pb2.DESCRIPTOR,])
29 _DATACLASS = _descriptor.EnumDescriptor(
30 name='DataClass',
31 full_name='tensorboard.DataClass',
(...)
55 serialized_end=1228,
56 )
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/tensor_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorboard.compat.proto import resource_handle_pb2 as tensorboard_dot_compat_dot_proto_dot_resource__handle__pb2
17 from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
18 from tensorboard.compat.proto import types_pb2 as tensorboard_dot_compat_dot_proto_dot_types__pb2
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/resource_handle_pb2.py:16
11 # @@protoc_insertion_point(imports)
13 _sym_db = _symbol_database.Default()
---> 16 from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
17 from tensorboard.compat.proto import types_pb2 as tensorboard_dot_compat_dot_proto_dot_types__pb2
20 DESCRIPTOR = _descriptor.FileDescriptor(
21 name='tensorboard/compat/proto/resource_handle.proto',
22 package='tensorboard',
(...)
26 ,
27 dependencies=[tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2.DESCRIPTOR,tensorboard_dot_compat_dot_proto_dot_types__pb2.DESCRIPTOR,])
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/tensorboard/compat/proto/tensor_shape_pb2.py:36
13 _sym_db = _symbol_database.Default()
18 DESCRIPTOR = _descriptor.FileDescriptor(
19 name='tensorboard/compat/proto/tensor_shape.proto',
20 package='tensorboard',
(...)
23 serialized_pb=_b('\n+tensorboard/compat/proto/tensor_shape.proto\x12\x0btensorboard\"{\n\x10TensorShapeProto\x12.\n\x03\x64im\x18\x02 \x03(\x0b\x32!.tensorboard.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB\x87\x01\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01ZSgithub.com/tensorflow/tensorflow/tensorflow/go/core/framework/tensor_shape_go_proto\xf8\x01\x01\x62\x06proto3')
24 )
29 _TENSORSHAPEPROTO_DIM = _descriptor.Descriptor(
30 name='Dim',
31 full_name='tensorboard.TensorShapeProto.Dim',
32 filename=None,
33 file=DESCRIPTOR,
34 containing_type=None,
35 fields=[
---> 36 _descriptor.FieldDescriptor(
37 name='size', full_name='tensorboard.TensorShapeProto.Dim.size', index=0,
38 number=1, type=3, cpp_type=2, label=1,
39 has_default_value=False, default_value=0,
40 message_type=None, enum_type=None, containing_type=None,
41 is_extension=False, extension_scope=None,
42 serialized_options=None, file=DESCRIPTOR),
43 _descriptor.FieldDescriptor(
44 name='name', full_name='tensorboard.TensorShapeProto.Dim.name', index=1,
45 number=2, type=9, cpp_type=9, label=1,
46 has_default_value=False, default_value=_b("").decode('utf-8'),
47 message_type=None, enum_type=None, containing_type=None,
48 is_extension=False, extension_scope=None,
49 serialized_options=None, file=DESCRIPTOR),
50 ],
51 extensions=[
52 ],
53 nested_types=[],
54 enum_types=[
55 ],
56 serialized_options=None,
57 is_extendable=False,
58 syntax='proto3',
59 extension_ranges=[],
60 oneofs=[
61 ],
62 serialized_start=150,
63 serialized_end=183,
64 )
66 _TENSORSHAPEPROTO = _descriptor.Descriptor(
67 name='TensorShapeProto',
68 full_name='tensorboard.TensorShapeProto',
(...)
100 serialized_end=183,
101 )
103 _TENSORSHAPEPROTO_DIM.containing_type = _TENSORSHAPEPROTO
File /opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/google/protobuf/descriptor.py:675, in FieldDescriptor.__new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key)
652 def __new__(
653 cls,
654 name,
(...)
673 create_key=None,
674 ): # pylint: disable=redefined-builtin
--> 675 _message.Message._CheckCalledFromGeneratedFile()
676 if is_extension:
677 return _message.default_pool.FindExtensionByName(full_name)
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
Importantly, this task is distinct from the previous two tasks because the outputs of the model affect the subsequent inputs!
Visualizing the latent dynamics of models trained on MotorNet tasks, we can see that there are complex features in the state space, but we’ll leave that to you to figure out what they mean!
In the later questions, we will ask you to modify the environments in MotorNet to test how well your models can generalize to new tasks!
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_introducing_the_random_target_task")
Conclusion#
That’s it!
To recap, in this tutorial, we learned:
The basics of two tasks, the Three-Bit Flip-Flop and the Random Target task.
How to train recurrent neural network models on these tasks
Methods of visualizing and quantifying differences between these task-trained models.
As you begin to extend beyond this tutorial, you will likely need to make your own environments, or modify existing environments to test the ability of models to generalize. We’ve tried to document the code-base to make this as easy as possible, but feel free to reach out if you have any questions!
Submit your feedback#
Show code cell source
# @title Submit your feedback
content_review(f"{feedback_prefix}_conclusion")