# Install Environment (Conda) and Run Scripts This guide sets up a Conda environment and runs both scripts: - `assignment_image/code/c1.py` (train + save checkpoint) - `assignment_image/code/c1_test.py` (evaluate + error analysis) First need to enter this folder: ```bash cd assignment_llm_1/assignment_image ``` ## 1) Create and activate Conda environment ```bash conda create -n transformer_hw python=3.10 -y conda activate transformer_hw python -m pip install --upgrade pip ``` ## 2) Install dependencies If there is a `requirements.txt` file in this folder, run: ```bash pip install -r requirements.txt ``` ## 3) Run training script (`c1.py`) Move to the code directory and run: ```bash python code/c1.py ``` Expected outputs include: - `saved_model/vit_cifar10_best.pt` - `saved_model/vit_cifar10_last.pt` ## 4) Run evaluation script (`c1_test.py`) After training completes: ```bash python code/c1_test.py \ --checkpoint-path ./saved_model/vit_cifar10_best.pt \ --results-dir ./results ``` This baseline evaluation run saves: - `results/baseline_analysis.txt` - `results/misclassified_examples_test.png` ## 5) Run optional pre-trained ViT comparison To run transfer learning and compare baseline vs pre-trained ViT: ```bash python code/c1_test.py \ --checkpoint-path ./saved_model/vit_cifar10_best.pt \ --results-dir ./results \ --run-pretrained-experiment ``` Additional files saved in this mode: - `results/pretrained_vit_analysis.txt` - `results/misclassified_examples_pretrained_vit.png` - `results/comparison_report.txt` ## 6) Where data and outputs are saved - **Dataset download/cache**: `./data` (both `c1.py` and `c1_test.py` load CIFAR-10 from this folder by default) - **Model checkpoints from training**: `./saved_model` - **Evaluation artifacts/reports**: `./results` (or the path passed with `--results-dir`) - **Default checkpoint used by evaluation**: `./saved_model/vit_cifar10_best.pt` ### Quick path summary - Training command: `python code/c1.py` - Baseline evaluation: `python code/c1_test.py --checkpoint-path ./saved_model/vit_cifar10_best.pt --results-dir ./results` - Baseline + transfer comparison: `python code/c1_test.py --checkpoint-path ./saved_model/vit_cifar10_best.pt --results-dir ./results --run-pretrained-experiment`