Skip to content
Merged
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
56 changes: 3 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

[![CI](https://github.com/minitorch/minitorch/workflows/CI/badge.svg)](https://github.com/minitorch/minitorch/actions)

* Docs: https://minitorch.github.io/
* Docs: https://minitorch.github.io

* Overview: https://minitorch.github.io/module4.html
* Overview: https://minitorch.github.io/module4/module4/

Module 4 extends MiniTorch with convolutional neural network operations to build an image recognition system. You'll implement a version of LeNet on MNIST for digit recognition and 1D convolution for NLP sentiment classification:

Expand Down Expand Up @@ -82,58 +82,8 @@ pre-commit run --all-files
- Train a model on Digit classification (MNIST), add logs as `mnist.txt` showing train loss and validation accuracy
- Implement Conv1D, Conv2D, and Network classes for both training files

## Testing

**Module 4 Tasks:**
```bash
pytest -m task4_1 # 1D convolution
pytest -m task4_2 # 2D convolution
pytest -m task4_3 # Pooling operations
pytest -m task4_4 # Advanced NN functions
```

**CNN Training:**
```bash
python project/run_mnist_multiclass.py # MNIST digit classification
python project/run_sentiment.py # SST2 sentiment analysis
```

**Style Checks:**
```bash
pre-commit run --all-files
ruff check . && pyright
```

## CNN Applications

**MNIST digit classification with CNNs:**
- Convolutional feature extraction
- Spatial pooling for dimension reduction
- Performance comparison with fully-connected networks

**Expected improvements over fully-connected:**
- Fewer parameters through weight sharing
- Translation invariance for image recognition
- Hierarchical feature learning

## Module Requirements

This module requires files from previous assignments, so make sure to pull them over to your new repo. We recommend getting familiar with `tensor.py`, since you might find some of those functions useful for implementing this module.

Get the required files by running:

```bash
python sync_previous_module.py <path-to-module-3> <path-to-current-module>
```

**Required files from Module 3:**
- All tensor system files and fast operations
- Module framework and autodifferentiation
- Training scripts and datasets

## Resources

- **[Installation Guide](installation.md)**: Setup instructions with MNIST
- **[Testing Guide](testing.md)**: CNN testing strategies
- **MiniTorch Docs**: https://minitorch.github.io/
- **Module 4 Overview**: https://minitorch.github.io/module4.html
- **[Testing Guide](testing.md)**: CNN testing strategies
13 changes: 9 additions & 4 deletions installation.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# MiniTorch Module 4 Installation

MiniTorch requires Python 3.8 or higher. To check your version of Python, run:
MiniTorch requires Python 3.11. To check your version of Python, run:

```bash
>>> python --version
```

If you don't have Python 3.11, install it before proceeding:
- **Mac**: `brew install python@3.11`
- **Ubuntu/Debian**: `sudo apt install python3.11`
- **Windows**: Download from python.org

We recommend creating a global MiniTorch workspace directory that you will use
for all modules:

Expand All @@ -19,14 +24,14 @@ We highly recommend setting up a *virtual environment*. The virtual environment

**Option 1: Anaconda (Recommended)**
```bash
>>> conda create --name minitorch python # Run only once
>>> conda create --name minitorch python=3.11 # Run only once
>>> conda activate minitorch
>>> conda install llvmlite # For optimization
>>> conda install llvmlite # For optimization
```

**Option 2: Venv**
```bash
>>> python -m venv venv # Run only once
>>> python3.11 -m venv venv # Run only once (requires Python 3.11)
>>> source venv/bin/activate
```

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ build-backend = "hatchling.build"
name = "minitorch"
version = "0.5"
description = "A minimal deep learning library for educational purposes"
requires-python = ">=3.8"
requires-python = ">=3.8,<3.12"
dependencies = [
"colorama==0.4.6",
"hypothesis==6.138.2",
"numba>=0.61.2",
"numba>=0.61.2",
"numpy<2.0",
"pytest==8.4.1",
"pytest-env==1.1.5",
Expand Down
Loading