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
45 changes: 45 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# This source file is part of the ARPA-H CARE LLM project
#
# SPDX-FileCopyrightText: 2025 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#

name: Build and Test

on:
push:
branches:
- main
pull_request:
workflow_dispatch:
workflow_call:

jobs:
pylint:
name: PyLint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install Infrastructure
run: |
pip install -r requirements.txt
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
black_lint:
name: Black Code Formatter Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install Black
run: pip install black[jupyter]
- name: Check code formatting with Black
run: black . --exclude '\.ipynb$'
37 changes: 37 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# This source file is part of the ARPA-H CARE LLM project
#
# SPDX-FileCopyrightText: 2025 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#

name: Pull Request

on:
pull_request:
workflow_dispatch:

jobs:
reuse_action:
name: REUSE Compliance Check
uses: DaneshjouLab/.github/.github/workflows/reuse.yml@main
markdown_link_check:
name: Markdown Link Check
uses: DaneshjouLab/.github/.github/workflows/markdown-link-check.yml@main
yamllint:
name: YAML Lint Check
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2

- name: Install yamllint
run: pip install yamllint

- name: Run yamllint with custom config
run: yamllint -c .yamllint .github/workflows/*.yml
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Finetuning Pretrained Models for Compressed Dermatology Image Analysis

This project explores how compressed and degraded dermatology images (from the ISIC 2019 dataset) affect classification performance using pretrained vision models. It compares fine-tuning vs. linear probing across multiple JPEG quality levels.

## Project Goals

- Evaluate model robustness to image compression (JPEG 90/50/20)
- Compare pretrained models: ViT, DINOv2, and SimCLR
- Benchmark fine-tuning vs. linear probing
- Analyze FLOPs, GPU memory, and classification accuracy

## Models

- `ViT`: Vision Transformer from Hugging Face
- `DINOv2`: Self-supervised ViT from Meta
- `SimCLR`: Contrastive ResNet50 trained with linear classifier

## Metrics Tracked

- Accuracy, F1 Score, AUC
- FLOPs (GFLOPs)
- GPU memory usage
- Training and evaluation time

## Project Structure

```
CS231N/
├── configs/
│ └── example_config.yaml # Configs for job submissions
├── scripts/ # Lightweight utility or shell scripts
│ ├── download_unpack_isic2019.sh # Downloads and unpacks ISIC data
│ └── submit_from_config.sh # SLURM submission helper
├── jobs/ # SLURM-related job definitions
│ └── job_template.slurm
├── src/ # Source code, logically grouped
│ ├── __init__.py
│ ├── finetune/ # Fine-tuning workflows
│ │ └── baseline_finetuning.py
│ ├── evaluation/ # Evaluation + plotting
│ │ └── evaluate_isic_results.py
│ └── models/ # Model-related scripts
│ ├── model_comparison.py # Config file with constant strings
│ ├── model_comparison.py
│ └── model_comparison_2.py

├── results/ # Auto-generated results
│ ├── plots/ # Accuracy/f1/AUC plots
│ └── logs/ # Training logs or SLURM outputs
├── requirements.txt
├── .gitignore
├── .github
└── README.md
```

## Quick Start

1. Install requirements:
```bash
pip install -r requirements.txt
```

2. Run training:
```bash
python train_models.py
```

3. Run evaluation:
```bash
python evaluate_isic_results.py
```

## 📦 Dataset

- [ISIC 2019 (Hugging Face)](https://huggingface.co/datasets/MKZuziak/ISIC_2019_224)
195 changes: 0 additions & 195 deletions baseline_finetuning.py

This file was deleted.

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions requirements.txt.licence
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# MIT
File renamed without changes.
11 changes: 10 additions & 1 deletion submit_from_config.sh → scripts/submit_from_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ for placeholder in "${!config_map[@]}"; do
if [ -z "$value" ]; then
echo "Warning: Config key '${config_map[$placeholder]}' is empty or missing"
fi
sed -i '' "s|{{${placeholder}}}|${value}|g" "$JOB_FILE"

# Escape characters that might break sed (like slashes or ampersands)
value_escaped=$(printf '%s\n' "$value" | sed 's/[&/\]/\\&/g')

# Detect OS and use correct sed syntax
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s|{{${placeholder}}}|${value}|g" "$JOB_FILE"
else
sed -i "s|{{${placeholder}}}|${value}|g" "$JOB_FILE"
fi
done

# Submit the job
Expand Down
Empty file added src/__init__.py
Empty file.
Loading
Loading