Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
uv.lock
.venv
data
logs
__pycache__
File renamed without changes.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,33 @@ current implementation is slightly different. We leverage predefined ResNet Mod

#### Quick Start

copy the code
You can either install directly from the repository:

```bash
pip install git+https://github.com/yhgon/NoProp.git
```

Or download the repository and install it in editable mode:

```bash
git clone https://github.com/yhgon/NoProp.git
cd NoProp
pip install --editable .
```

run with default option for mnist dataset
```
python NoProp/src/nopropct_mnist.py
noprop-mnist
```

run with configure dataset and backbone model
```
python NoProp/src/noprop_simple.py --dataset cifar10 --backbone resnet50
noprop-simple --dataset cifar10 --backbone resnet50
```

run with configure dataset and backbone model default epoch is `400`
```
python NoProp/src/noprop_simple.py --dataset cifar100 --backbone resnet152
noprop-simple --dataset cifar100 --backbone resnet152
```

## log
Expand Down
18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "noprop"
dynamic = ["version"]
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["torch", "torchvision"]

[project.scripts]
noprop-simple = "noprop.simple:main"
noprop-mnist = "noprop.mnist:main"

[tool.hatch.version]
source = "vcs"
Empty file added src/noprop/__init__.py
Empty file.
5 changes: 4 additions & 1 deletion src/nopropct_mnist.py → src/noprop/mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ def train_and_eval(backbone: str):
del model, optim, tr, te, ds_train, ds_test
torch.cuda.empty_cache(); gc.collect()

if __name__ == '__main__':
def main():
for backbone in ['resnet18', 'resnet50', 'resnet152']:
train_and_eval(backbone)

if __name__ == '__main__':
main()
5 changes: 4 additions & 1 deletion src/noprop_simple.py → src/noprop/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def train_and_eval(backbone: str, time_emb_dim: int, embed_dim: int, dataset: st
del model, optimizer, ds_train, ds_test, tr_loader, te_loader
torch.cuda.empty_cache(); gc.collect()

if __name__ == '__main__':
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', choices=['mnist','cifar10','cifar100'], required=True)
parser.add_argument('--data-root', default='./data')
Expand All @@ -412,3 +412,6 @@ def train_and_eval(backbone: str, time_emb_dim: int, embed_dim: int, dataset: st
data_root = args.data_root,
epoches = args.epoches,
)

if __name__ == '__main__':
main()