-
Clone this gist somewhere using the URL, for example
git clone (the_url_of_this_gist) some_folderthen move to that folder. -
Install UV following their docs
-
run
uv syncto recreate the same virtual env -
run the following on a login node to download cifar10 in your $SCRATCH/data/cifar10
mkdir -p $SCRATCH/data/cifar10- `uv run python -c 'import pathlib, os, torchvision.datasets; torchvision.datasets.CIFAR10(pathlib.Path(os.environ["SCRATCH"]) / "data/cifar10", download=True)
-
Launch the job with
sbatch job.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| """ | |
| from __future__ import annotations | |
| import datetime | |
| import itertools | |
| # NOTE: Need to import cv2 to prevent a loading error for GLIBCXX with ffcv. | |
| import cv2 # noqa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import annotations | |
| import copy | |
| import functools | |
| import math | |
| from collections import OrderedDict | |
| from typing import Sequence | |
| import torch | |
| from torch import Tensor, nn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import annotations | |
| class Value: | |
| """ stores a single scalar value and its gradient """ | |
| def __init__(self, data, _parents: tuple[Value, ...]=(), _op=''): | |
| self.data = data | |
| self.grad = 0 | |
| # internal variables used for autograd graph construction | |
| self._backward = lambda: None |
OlderNewer