Fitting simple torch models
Project description
Fitting PyTorch models
This repository follows a workshop to set up a Python package, build some neural networks with torch, and publish the models on HuggingFace.
There are two datasets that we simulate:
- Colored shapes (circle, rectangle, triangle, diamond) in a pixellated image
- One-dimensional sinusoids
Alongside these datasets, we fit the following model objectives:
- (Classification) Predict the shape and color in the image
- (Regression) Predict the next time steps of the sine function
Usage
Learn how to train neural networks from scratch.
- Run
answers/simulate-exercise.ipynbto get data. - Fill in the
# TO DOparts inexamples/modeling-exercise-*.ipynb. - Compare to solutions in
answers/modeling-exercise-*.ipynb. - You can explore different parameters on big models with
modeling.py.- Write a shell script that invokes
modeling.pyand pass toslurm.
- Write a shell script that invokes
The package defined under src/ provides:
- A class
Shapethat instantiates an image with 1 colored shape - A function
simulate_shapes()to make many images for an image classifier - A model class
MyCNNto fit a standard architecture
Caution: you may need GPU resources if your models or data are large.
Requirements
- Python 3.10+
Install
If you want to install the package only from the internet:
pip install zootopia3
If you want to set up an isolated environment and build locally:
python -m venv path-to/your-environment
source path-to/your-environment/bin/activate
pip install -e .
You run the pip command within this repo.
Test
You can run the test scripts in tests/ with the following:
python -m pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zootopia3-0.1.tar.gz.
File metadata
- Download URL: zootopia3-0.1.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
990ee03d1ab89995335d09ed2d68c9354e03a6319dcf69ce3961e86afcb38829
|
|
| MD5 |
8fd70614f18a98dd396d225a31668b01
|
|
| BLAKE2b-256 |
34c652e91866af98bfc1fbf521b87929963394cfb757070cd0d79ab9710d7b04
|
File details
Details for the file zootopia3-0.1-py3-none-any.whl.
File metadata
- Download URL: zootopia3-0.1-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc3d7504402e3df0945223245c42c09c013c1a0ac99c223b6069ebcecdf0bb99
|
|
| MD5 |
85d1a9114f67ea6a3841ce3b2a852326
|
|
| BLAKE2b-256 |
4832be2203d88754c8083453fc2185a09f6fb13e59eb87733644c7aa0fdd967b
|