Skip to content
Open
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
4 changes: 2 additions & 2 deletions .claude/agents/compat-tester.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ tests with candle as the torch backend.
- **Config**: `compat/transformers/models.yaml` (model tiers), `compat/transformers/xfail.yaml` (known failures)
- **Patches**: `compat/transformers/conftest.py` (version spoof, module stubs, etc.)
- **Source code**: `src/candle/`
- **Conda env**: `mindnlp` (`source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp ...`)
- **Conda env**: `candle` (`source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle ...`)

## Workflow

### Step 1: Run Tests

```bash
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
env USE_CANDLE=1 python compat/transformers/run.py --model MODEL \
--json-report /tmp/compat-report.json -v --tb=short
```
Expand Down
6 changes: 3 additions & 3 deletions .claude/agents/pytorch-tester.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ test suite with candle as the torch backend.
- **Config**: `compat/pytorch/tests.yaml` (test tiers), `compat/pytorch/xfail.yaml` (known failures)
- **Patches**: `compat/pytorch/conftest.py` (version spoof, module stubs, etc.)
- **Source code**: `src/candle/`
- **Conda env**: `mindnlp` (`source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp ...`)
- **Conda env**: `candle` (`source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle ...`)

## Workflow

### Step 1: Run Tests

```bash
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
env USE_CANDLE=1 python compat/pytorch/run.py --tier TIER \
--json-report /tmp/pt-report.json -v --tb=short
```

Or for a single file:

```bash
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
env USE_CANDLE=1 python compat/pytorch/run.py --file FILE \
--json-report /tmp/pt-report.json -v --tb=short
```
Expand Down
12 changes: 6 additions & 6 deletions .claude/agents/test-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ You are a specialized test execution and bug-fixing agent for the Candle project

Candle is a PyTorch-compatible ML framework (`import candle as torch`) with custom dispatch system, autograd engine, and multi-backend support (CPU, MPS, CUDA, NPU).

- **Test Command**: `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp python -m pytest tests/<device>/ -v --tb=short`
- **Test Command**: `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle python -m pytest tests/<device>/ -v --tb=short`
- **Test Directories**: `tests/cpu/`, `tests/mps/`, `tests/contract/`, `tests/npu/`, `tests/cuda/`
- **Source Code**: `src/candle/`
- **Conda Environment**: `mindnlp` (via `conda run -n mindnlp`)
- **Conda Environment**: `candle` (via `conda run -n candle`)

## Your Responsibilities

Expand All @@ -31,15 +31,15 @@ git pull upstream main

```bash
# CPU tests
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -m pytest tests/cpu/ tests/contract/ -v --tb=short

# MPS tests (macOS Apple Silicon only)
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -m pytest tests/mps/ -v --tb=short

# Specific test file
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -m pytest tests/cpu/test_ops_cpu.py -v --tb=short
```

Expand Down Expand Up @@ -70,7 +70,7 @@ Apply targeted fixes:

Re-run the same tests plus the full suite to check for regressions:
```bash
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -m pytest tests/cpu/ tests/contract/ -v --tb=short
```

Expand Down
2 changes: 1 addition & 1 deletion .claude/commands/compat.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Run transformers compatibility tests against candle and report results.

```bash
source ~/miniconda3/etc/profile.d/conda.sh && \
conda run -n mindnlp env USE_CANDLE=1 \
conda run -n candle env USE_CANDLE=1 \
python compat/transformers/run.py $PARSED_ARGS \
--json-report /tmp/compat-report.json \
-v --tb=short
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/ai-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ body:
description: Must be runnable as-is. Use `import candle as torch`.
render: shell
placeholder: |
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -c "import candle as torch; ..."
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<!-- Paste the exact commands you ran. Do not edit or abbreviate. -->

```bash
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp python -m pytest ...
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle python -m pytest ...
pylint src/candle/ --rcfile=.github/pylint.conf
```

Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE/human.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
## Test plan

- [ ] Not run — explain why below
- [ ] `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp python -m pytest tests/cpu/ tests/contract/ -v --tb=short`
- [ ] `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp python -m pytest tests/mps/ -v --tb=short` (if MPS-related)
- [ ] `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle python -m pytest tests/cpu/ tests/contract/ -v --tb=short`
- [ ] `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle python -m pytest tests/mps/ -v --tb=short` (if MPS-related)
- [ ] `pylint src/candle/ --rcfile=.github/pylint.conf`

## Checklist
Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
## Test plan

- [ ] Not run — explain why below
- [ ] `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp python -m pytest tests/cpu/ tests/contract/ -v --tb=short`
- [ ] `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp python -m pytest tests/mps/ -v --tb=short` (if MPS-related)
- [ ] `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle python -m pytest tests/cpu/ tests/contract/ -v --tb=short`
- [ ] `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle python -m pytest tests/mps/ -v --tb=short` (if MPS-related)
- [ ] `pylint src/candle/ --rcfile=.github/pylint.conf`

## Checklist
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/trigger_openi_upstream_ccache.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# single smoke rerun 1774847023
12 changes: 6 additions & 6 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ candle/

## Environment

- **Conda**: `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp ...`
- **Conda**: `source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle ...`
- **Platform**: macOS Apple Silicon (Darwin), local MPS hardware available
- **Python**: 3.11

Expand Down Expand Up @@ -184,11 +184,11 @@ Do NOT open a PR if pylint fails. Fix all issues first.

```bash
# CPU + contract tests (always required for src/candle/ changes)
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -m pytest tests/cpu/ tests/contract/ -v --tb=short

# MPS tests (required on macOS Apple Silicon when src/candle/ changes)
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -m pytest tests/mps/ -v --tb=short
```

Expand Down Expand Up @@ -242,11 +242,11 @@ CI is a safety net, NOT a substitute for local testing. Do NOT push untested cod

```bash
# CPU tests
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -m pytest tests/cpu/ tests/contract/ -v --tb=short

# MPS tests (macOS Apple Silicon only)
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \
source ~/miniconda3/etc/profile.d/conda.sh && conda run -n candle \
python -m pytest tests/mps/ -v --tb=short
```

Expand Down Expand Up @@ -288,7 +288,7 @@ source ~/miniconda3/etc/profile.d/conda.sh && conda run -n mindnlp \

## Troubleshooting

- **Tests not running**: Ensure conda env is activated (`conda run -n mindnlp`)
- **Tests not running**: Ensure conda env is activated (`conda run -n candle`)
- **MPS tests skipped locally**: Verify `pyobjc-framework-Metal` is installed
- **MPS tests skipped on CI**: Check that `requirements-test-mps.txt` includes `pyobjc-framework-Metal`
- **Git push fails**: Check push access, uncommitted changes, branch existence on remote
Expand Down
24 changes: 12 additions & 12 deletions docs/plans/2026-03-08-mindtorch-to-candle-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

**Goal:** Migrate the mindtorch_v2 codebase from the mindnlp repository to the standalone candle repository, renaming all references from `mindtorch_v2` to `candle`, and setting up CI/CD, tests, and packaging.
**Goal:** Migrate the mindtorch_v2 codebase from the legacy source repository to the standalone candle repository, renaming all references from `mindtorch_v2` to `candle`, and setting up CI/CD, tests, and packaging.

**Architecture:** The candle repository will be a standalone Python package with `src/candle/` layout. All internal references to `mindtorch_v2` will be replaced with `candle`. GitHub Actions will provide pylint checks, unit testing, and wheel releases. The torch proxy system will be preserved for transparent PyTorch compatibility.

Expand All @@ -12,8 +12,8 @@

## Source Analysis

- **Source code:** `/Users/lvyufeng/Projects/mindnlp/src/mindtorch_v2/` (384 files)
- **Tests:** `/Users/lvyufeng/Projects/mindnlp/tests/mindtorch_v2/` (306 files)
- **Source code:** `/path/to/legacy-repo/src/mindtorch_v2/` (384 files)
- **Tests:** `/path/to/legacy-repo/tests/mindtorch_v2/` (306 files)
- **Target:** `/Users/lvyufeng/Projects/candle/` (empty repo, MIT license)
- **References to rename:** 192 files, ~584 occurrences of `mindtorch_v2`
- **Also rename:** `MINDTORCH_TEST_FORCE_CPU_ONLY` → `CANDLE_TEST_FORCE_CPU_ONLY`
Expand All @@ -23,12 +23,12 @@
### Task 1: Copy Source Code to Candle Repository

**Files:**
- Copy: `mindnlp/src/mindtorch_v2/**` → `candle/src/candle/**`
- Copy: `legacy-repo/src/mindtorch_v2/**` → `candle/src/candle/**`

**Step 1: Copy the source tree**

```bash
cp -r /Users/lvyufeng/Projects/mindnlp/src/mindtorch_v2/ /Users/lvyufeng/Projects/candle/src/candle/
cp -r /path/to/legacy-repo/src/mindtorch_v2/ /Users/lvyufeng/Projects/candle/src/candle/
```

**Step 2: Remove `__pycache__` directories**
Expand Down Expand Up @@ -58,12 +58,12 @@ git commit -m "feat: copy mindtorch_v2 source code as candle base"
### Task 2: Copy Tests to Candle Repository

**Files:**
- Copy: `mindnlp/tests/mindtorch_v2/**` → `candle/tests/`
- Copy: `legacy-repo/tests/mindtorch_v2/**` → `candle/tests/`

**Step 1: Copy the test tree**

```bash
cp -r /Users/lvyufeng/Projects/mindnlp/tests/mindtorch_v2/ /Users/lvyufeng/Projects/candle/tests/
cp -r /path/to/legacy-repo/tests/mindtorch_v2/ /Users/lvyufeng/Projects/candle/tests/
```

**Step 2: Remove `__pycache__` directories**
Expand Down Expand Up @@ -323,11 +323,11 @@ git commit -m "feat: add pytest configuration"
**Files:**
- Create: `candle/.github/pylint.conf`

**Step 1: Copy pylint.conf from mindnlp**
**Step 1: Copy pylint.conf from the legacy repository**

```bash
mkdir -p /Users/lvyufeng/Projects/candle/.github
cp /Users/lvyufeng/Projects/mindnlp/.github/pylint.conf /Users/lvyufeng/Projects/candle/.github/pylint.conf
cp /path/to/legacy-repo/.github/pylint.conf /Users/lvyufeng/Projects/candle/.github/pylint.conf
```

**Step 2: Commit**
Expand Down Expand Up @@ -498,7 +498,7 @@ git commit -m "feat: add GitHub Actions release workflow"

**Step 1: Create run_test.py**

Adapt from `mindnlp/tests/run_test_v2.py`, replacing all `mindtorch_v2` references with `candle`:
Adapt from `legacy-repo/tests/run_test_v2.py`, replacing all `mindtorch_v2` references with `candle`:

- Line 34: `from candle._torch_proxy import install` (if torch_proxy exists)
- Line 39: docstrings referencing `candle` instead of `mindtorch_v2`
Expand Down Expand Up @@ -591,14 +591,14 @@ git commit -m "chore: final cleanup and verification"

## Summary of Changes

| Component | Source (mindnlp) | Target (candle) |
| Component | Source (legacy repo) | Target (candle) |
|-----------|-----------------|-----------------|
| Source code | `src/mindtorch_v2/` | `src/candle/` |
| Tests | `tests/mindtorch_v2/` | `tests/` |
| Package name | `mindtorch_v2` | `candle` |
| CI workflow | `.github/workflows/ci_pipeline.yaml` | `.github/workflows/ci.yaml` |
| Release workflow | `.github/workflows/make_wheel_releases.yml` | `.github/workflows/release.yaml` |
| Setup | `setup.py` (shared with mindnlp) | `pyproject.toml` (standalone) |
| Setup | `setup.py` (shared in the legacy repo) | `pyproject.toml` (standalone) |
| Pylint config | `.github/pylint.conf` | `.github/pylint.conf` |
| Test runner | `tests/run_test_v2.py` | `tests/run_test.py` |
| Env var | `MINDTORCH_TEST_FORCE_CPU_ONLY` | `CANDLE_TEST_FORCE_CPU_ONLY` |
Loading
Loading