services:
  train-1c-lora:
    image: ${TRAINING_IMAGE:-pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime}
    container_name: llm-train-1c-lora
    working_dir: /workspace
    shm_size: 16gb
    volumes:
      - ${HOST_WORKSPACE_DIR:-/workspace/LLM}:/workspace
      - ${HOST_MODELS_DIR:-/models}:/models
    command:
      - bash
      - -lc
      - |
        pip install -r requirements-training.txt &&
        python scripts/preflight_1c_training.py --config ${TRAINING_CONFIG:-/workspace/plugins/1c/training/configs/qwen3-coder-30b-a3b-lora.yaml} &&
        if [ "${PREFLIGHT_ONLY:-0}" = "1" ]; then exit 0; fi &&
        python scripts/train_1c_lora.py --config ${TRAINING_CONFIG:-/workspace/plugins/1c/training/configs/qwen3-coder-30b-a3b-lora.yaml}
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities:
                - gpu
