Skip to content

Commit 343f179

Browse files
V4.3.0: Complete CUDA engine rewrite - production grade stability
1 parent 84a86a8 commit 343f179

File tree

4 files changed

+435
-231
lines changed

4 files changed

+435
-231
lines changed

Crayon_Colab_Notebook.py

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
XERV CRAYON V4.2.9 - Production Omni-Backend Tokenizer
2+
XERV CRAYON V4.3.0 - Production Omni-Backend Tokenizer
33
=======================================================
44
Copy this ENTIRE script into a Google Colab cell and run it.
55
@@ -13,10 +13,87 @@
1313
import time
1414

1515
print("=" * 70)
16-
print("XERV CRAYON V4.2.9 INSTALLATION")
16+
print("XERV CRAYON V4.3.0 INSTALLATION")
1717
print("=" * 70)
1818

19-
# ... (rest of the script is same until Verification)
19+
# 1. Environment Check
20+
print("[1/7] Checking environment...")
21+
try:
22+
import torch
23+
print(f" PyTorch: {torch.__version__}")
24+
if torch.cuda.is_available():
25+
print(f" CUDA: {torch.version.cuda} ({torch.cuda.get_device_name(0)})")
26+
print(" * Smart Build: Will compile ONLY for this GPU architecture")
27+
else:
28+
print(" CUDA: Not available (CPU only)")
29+
except ImportError:
30+
print(" PyTorch not found (will be installed)")
31+
32+
nvcc_check = subprocess.run(["which", "nvcc"], capture_output=True, text=True)
33+
if nvcc_check.returncode == 0:
34+
print(f" NVCC: {nvcc_check.stdout.strip()}")
35+
else:
36+
print(" NVCC: Not found")
37+
38+
39+
# 2. Build Dependencies
40+
print("\n[2/7] Installing build dependencies...")
41+
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "ninja", "packaging", "wheel", "setuptools>=68.0"])
42+
print(" Done (ninja, packaging, wheel)")
43+
44+
45+
# 3. Clean Old State
46+
print("\n[3/7] Cleaning previous installations...")
47+
os.system("pip uninstall -y xerv-crayon crayon 2>/dev/null")
48+
os.system("rm -rf /tmp/crayon* build dist src/*.egg-info 2>/dev/null")
49+
50+
51+
# 4. Clone Source
52+
print("\n[4/7] Cloning source code...")
53+
timestamp = int(time.time())
54+
clone_dir = f"/tmp/crayon_{timestamp}"
55+
cmd = f"git clone --depth 1 https://github.com/Electroiscoding/CRAYON.git {clone_dir}"
56+
if os.system(cmd) != 0:
57+
print(" FATAL: Git clone failed!")
58+
sys.exit(1)
59+
60+
# Verify source
61+
v_check = subprocess.run(["grep", "-m1", "__version__", f"{clone_dir}/src/crayon/__init__.py"],
62+
capture_output=True, text=True)
63+
print(f" {v_check.stdout.strip()}")
64+
65+
66+
# 5. Build & Install (Streaming Output)
67+
print("\n[5/7] Compiling and Installing (Streaming Logs)...")
68+
print("-" * 70)
69+
70+
build_env = os.environ.copy()
71+
build_env["MAX_JOBS"] = "1" # Force serial build to prevent OOM
72+
build_env["CUDA_HOME"] = "/usr/local/cuda"
73+
74+
# Stream output line-by-line
75+
cmd = [sys.executable, "-m", "pip", "install", "-v", "--no-build-isolation", clone_dir]
76+
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=build_env, text=True)
77+
78+
# Print output while running
79+
while True:
80+
line = process.stdout.readline()
81+
if not line and process.poll() is not None:
82+
break
83+
if line:
84+
print(line.rstrip())
85+
86+
rc = process.poll()
87+
print("-" * 70)
88+
89+
if rc != 0:
90+
print("\n" + "!" * 70)
91+
print("FATAL ERROR: Installation failed!")
92+
print(f"Exit Code: {rc}")
93+
print("!" * 70)
94+
sys.exit(1)
95+
96+
2097
# 6. Verification
2198
print("\n[6/7] Verifying installation...")
2299
# Reset module cache
@@ -45,7 +122,6 @@
45122
vocab.load_profile("lite")
46123
print(f"\nActive Device: {vocab.device.upper()}")
47124

48-
# USE CORRECT API
49125
info = vocab.get_info()
50126
print(f"Backend: {info['backend']}")
51127

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "xerv-crayon"
7-
version = "4.2.9"
7+
version = "4.3.0"
88
description = "Omni-Backend Tokenizer - CPU (AVX2/512), CUDA (NVIDIA), ROCm (AMD) with automatic hardware detection"
99
readme = "README.md"
1010
requires-python = ">=3.10"

src/crayon/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
from __future__ import annotations
4747

48-
__version__ = "4.2.9"
48+
__version__ = "4.3.0"
4949
__author__ = "Xerv Research Engineering Division"
5050

5151
# ============================================================================

0 commit comments

Comments
 (0)