MiniTorch requires Python 3.8 or higher. To check your version of Python, run:
>>> python --versionWe recommend creating a global MiniTorch workspace directory that you will use for all modules:
>>> mkdir workspace; cd workspaceWe highly recommend setting up a virtual environment. The virtual environment lets you install packages that are only used for your assignments and do not impact the rest of the system.
Option 1: Anaconda (Recommended)
>>> conda create --name minitorch python # Run only once
>>> conda activate minitorch
>>> conda install llvmlite # For optimizationOption 2: Venv
>>> python -m venv venv # Run only once
>>> source venv/bin/activateThe first line should be run only once, whereas the second needs to be run whenever you open a new terminal to get started for the class. You can tell if it works by checking if your terminal starts with (minitorch) or (venv).
Each assignment is distributed through a Git repo. Once you accept the assignment from GitHub Classroom, a personal repository under Cornell-Tech-ML will be created for you. You can then clone this repository to start working on your assignment.
>>> git clone {{ASSIGNMENT}}
>>> cd {{ASSIGNMENT}}Module 2 requires files from Module 0 and Module 1. Sync them using:
>>> python sync_previous_module.py <path-to-module-1> <path-to-current-module>Example:
>>> python sync_previous_module.py ../Module-1 .Replace <path-to-module-1> with the path to your Module 1 directory and <path-to-current-module> with . for the current directory.
This will copy the following required files:
minitorch/operators.pyminitorch/module.pyminitorch/autodiff.pyminitorch/scalar.pytests/test_module.pytests/test_operators.pytests/test_autodiff.pytests/test_scalar.pyproject/run_manual.pyproject/run_scalar.py
Install all packages in your virtual environment:
>>> python -m pip install -e ".[dev,extra]"Make sure everything is installed by running:
>>> python -c "import minitorch; print('Success!')"Verify that the tensor functionality is available:
>>> python -c "from minitorch import tensor; print('Module 2 ready!')"You're ready to start Module 2!