Skip to content

Add Rust port of V-JEPA 2 model using mlx-rs #7

Add Rust port of V-JEPA 2 model using mlx-rs

Add Rust port of V-JEPA 2 model using mlx-rs #7

Workflow file for this run

name: Model Comparison Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache model weights
uses: actions/cache@v3
with:
path: weights
key: ${{ runner.os }}-model-weights-vitl-v1
restore-keys: |
${{ runner.os }}-model-weights-
- name: Cache MLX build
uses: actions/cache@v3
with:
path: ../mlx
key: ${{ runner.os }}-mlx-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-mlx-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build libblas-dev liblapack-dev liblapacke-dev libopenblas-dev gfortran
- name: Build and install MLX from source
run: |
cd ..
if [ ! -d "mlx" ]; then
git clone https://github.com/ml-explore/mlx.git
fi
cd mlx
pip install .
cd ../vjepa2-mlx
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
pip install -e .
- name: Clone and install vjepa2 repository
run: |
cd ..
if [ ! -d "vjepa2" ]; then
git clone https://github.com/facebookresearch/vjepa2.git
fi
cd vjepa2
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip install -e .
- name: Run model comparison tests
run: |
pytest tests/test_model_comparison.py -v -s --tb=short
- name: Run component output tests
run: |
pytest tests/test_component_outputs.py -v -s --tb=short
rust-build-macos:
name: Rust Build (macOS only - Apple Silicon required)
runs-on: macos-14 # macOS with Apple Silicon (M1)
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[test-rust]') }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Check Rust code compiles
run: |
cd vjepa2-rs
cargo check --verbose
- name: Run Rust tests (if available)
run: |
cd vjepa2-rs
cargo test --lib --verbose
continue-on-error: true # Tests may not be fully implemented yet