Skip to content

Commit 904107d

Browse files
fix(ci): fix GHA build errors and tests
- Support CRAYON_FORCE_CUDA/ROCM in setup.py for CI wheel building - Corrected CPU tokenization test to load profile first - Added python3-dev dependency to CUDA/ROCm build containers
1 parent f95614e commit 904107d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/production.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
python -c "
5353
from crayon import CrayonVocab
5454
v = CrayonVocab(device='cpu')
55+
v.load_profile('lite') # LOAD PROFILE FIRST
5556
result = v.tokenize('Hello Cloud! Testing CRAYON on GitHub Actions.')
5657
print(f'✅ Tokenized to {len(result)} tokens')
5758
print(f' Tokens: {result[:10]}...')
@@ -91,7 +92,7 @@ jobs:
9192
- name: Install Python & Dependencies
9293
run: |
9394
apt-get update
94-
apt-get install -y python3 python3-pip python3-venv git
95+
apt-get install -y python3 python3-pip python3-venv python3-dev git
9596
python3 -m pip install --upgrade pip setuptools wheel
9697
9798
- name: Install PyTorch (CUDA)
@@ -135,7 +136,7 @@ jobs:
135136
- name: Install Python & Dependencies
136137
run: |
137138
apt-get update
138-
apt-get install -y python3 python3-pip python3-venv git
139+
apt-get install -y python3 python3-pip python3-venv python3-dev git
139140
python3 -m pip install --upgrade pip setuptools wheel
140141
141142
- name: Verify ROCm Installation

setup.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,26 @@ def log(msg: str, level: str = "INFO") -> None:
5151
try:
5252
import torch
5353
from torch.utils.cpp_extension import CUDAExtension, BuildExtension, CUDA_HOME
54-
TORCH_CUDA_AVAILABLE = torch.cuda.is_available() and (CUDA_HOME is not None)
54+
55+
# FOR PRODUCTION/CI: Build if CUDA_HOME exists and CRAYON_FORCE_CUDA is set,
56+
# even if no GPU is found on the build machine.
57+
FORCE_CUDA = os.environ.get("CRAYON_FORCE_CUDA", "0") == "1"
58+
TORCH_CUDA_AVAILABLE = (torch.cuda.is_available() or FORCE_CUDA) and (CUDA_HOME is not None)
59+
5560
except ImportError:
5661
TORCH_CUDA_AVAILABLE = False
5762
CUDAExtension = None
5863
BuildExtension = None
5964
CUDA_HOME = None
6065

6166
# Detect ROCm
67+
FORCE_ROCM = os.environ.get("CRAYON_FORCE_ROCM", "0") == "1"
6268
ROCM_HOME = os.environ.get("ROCM_HOME", "/opt/rocm")
6369
HIPCC_PATH = os.path.join(ROCM_HOME, "bin", "hipcc")
64-
HAS_ROCM = os.path.exists(HIPCC_PATH)
70+
HAS_ROCM = (os.path.exists(HIPCC_PATH) or FORCE_ROCM)
6571

6672
if HAS_ROCM:
67-
log(f"ROCm detected at {ROCM_HOME}")
73+
log(f"ROCm detected at {ROCM_HOME} (Forced={FORCE_ROCM})")
6874
log(f"hipcc found at {HIPCC_PATH}")
6975
else:
7076
log("ROCm not detected - skipping AMD backend")

0 commit comments

Comments
 (0)