Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cirron.com/llms.txt

Use this file to discover all available pages before exploring further.

cirron compile

Compile your ML models for production deployment with architecture-specific optimizations and validation.

Usage

cirron compile [options]

Options

OptionDescriptionDefault
--arch, -aTarget architecture (cpu, cuda, gpu)Auto-detected
--indexPath to index/manifest filenull
--validateRun pre-compilation validationfalse
--strictEnable strict error handlingfalse
-i, --interactiveStep-by-step compilation confirmationsfalse

Architecture Support

CPU Architecture

cirron compile --arch cpu
  • Optimized for CPU inference
  • Compatible with all frameworks
  • Lightweight deployment

CUDA Architecture (PyTorch)

cirron compile --arch cuda
  • GPU-accelerated inference for PyTorch
  • Requires CUDA-compatible hardware
  • Validates CUDA availability

GPU Architecture (TensorFlow)

cirron compile --arch gpu
  • GPU-accelerated inference for TensorFlow
  • Requires GPU-compatible hardware
  • Validates GPU availability

Framework Support

PyTorch

# CPU compilation
cirron compile --arch cpu

# CUDA compilation
cirron compile --arch cuda
Compilation process:
  • Loads model from src/model.py
  • Optimizes for target architecture
  • Saves compiled model to models/model_{arch}.pth
  • Generates model metadata

TensorFlow

# CPU compilation
cirron compile --arch cpu

# GPU compilation
cirron compile --arch gpu
Compilation process:
  • Loads model from src/model.py
  • Configures device placement
  • Saves compiled model to models/model_{arch}
  • Generates model metadata

Scikit-Learn

cirron compile --arch cpu
Compilation process:
  • Loads model from src/model.py
  • Serializes model using joblib
  • Saves compiled model to models/model_{arch}.joblib
  • Generates model metadata

Validation

Pre-compilation Validation

cirron compile --validate
Validates:
  • Required files (src/model.py, requirements.txt)
  • Python version compatibility
  • Architecture-specific requirements
  • Model creation and instantiation
  • Index file format (if provided)

Strict Mode

cirron compile --strict --validate
Enables strict error handling:
  • Fails fast on validation errors
  • Provides detailed error messages
  • Suggests recovery actions

Index Files

JSON Index

{
  "features": ["feature1", "feature2", "feature3"],
  "dataTypes": {
    "feature1": "float",
    "feature2": "int",
    "feature3": "string"
  }
}

YAML Index

features:
  - feature1
  - feature2
  - feature3
dataTypes:
  feature1: float
  feature2: int
  feature3: string
Usage:
cirron compile --index config/index.json
cirron compile --index config/index.yaml

Examples

Basic Compilation

# Auto-detect architecture
cirron compile

# Specify CPU architecture
cirron compile --arch cpu

Validated Compilation

# Run with validation
cirron compile --validate

# Strict mode with validation
cirron compile --strict --validate

GPU Compilation

# PyTorch with CUDA
cirron compile --arch cuda

# TensorFlow with GPU
cirron compile --arch gpu

With Index File

# Compile with custom index
cirron compile --index data/index.json

# Full validation with index
cirron compile --validate --index data/index.yaml

Output

Generated Artifacts

models/
├── model_cpu.pth          # PyTorch CPU model
├── model_cuda.pth         # PyTorch CUDA model
└── model_gpu              # TensorFlow GPU model

artifacts/
├── model_info.json        # Model metadata
└── index_config.json      # Index configuration (if provided)

Model Information

{
  "framework": "pytorch",
  "architecture": "cuda",
  "parameters": 1234567,
  "compilation_time": "2024-01-15T10:30:00Z"
}

Error Handling

Common Errors

Project Not Found

Error: No cirron.yaml found
Run cirron init to initialize a project

Validation Failed

Error: Validation failed:
  • Required file missing: src/model.py
  • Python 3.9+ required, found 3.7
  • CUDA not available for PyTorch

Compilation Failed

Error: Compilation failed
Check compilation logs for specific errors

Recovery Actions

  1. Missing Project Configuration
    cirron init my-project
    
  2. Validation Errors
    # Fix missing files
    touch src/model.py
    
    # Update Python version
    python3 --version
    
    # Check CUDA installation
    nvidia-smi
    
  3. Compilation Errors
    # Check model code
    python3 src/model.py
    
    # Verify dependencies
    pip install -r requirements.txt
    

Integration

CI/CD Pipeline

# GitHub Actions example
- name: Compile Model
  run: |
    cirron compile --validate --arch cpu
    cirron compile --validate --arch cuda

Docker Integration

# Multi-stage build
FROM python:3.9 as compile
COPY . /app
WORKDIR /app
RUN cirron compile --arch cpu

FROM python:3.9-slim
COPY --from=compile /app/models /app/models
COPY --from=compile /app/artifacts /app/artifacts

Troubleshooting

Performance Issues

  • Use appropriate architecture for your hardware
  • Enable GPU compilation for large models
  • Check memory requirements

Validation Issues

  • Ensure all required files exist
  • Verify Python version compatibility
  • Check framework-specific requirements

Compilation Failures

  • Review model code for errors
  • Check dependency conflicts
  • Verify hardware compatibility