# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
apiVersion: batch/v1
kind: Job
metadata:
  name: model-download
spec:
  backoffLimit: 3
  completions: 1
  parallelism: 1
  template:
    metadata:
      labels:
        app: model-download
    spec:
      restartPolicy: Never
      tolerations: []
      containers:
        - name: model-download
          image: python:3.10-slim
          command: ["sh", "-c"]
          env:
            - name: HF_XET_HIGH_PERFORMANCE
              value: "1"
            # Optional: create with: kubectl create secret generic hf-token-secret --from-literal=HF_TOKEN=<token> -n <namespace>
            - name: HF_TOKEN
              valueFrom:
                secretKeyRef:
                  name: hf-token-secret
                  key: HF_TOKEN
                  optional: true
          args:
            - |
              set -eux
              pip install --no-cache-dir huggingface_hub==1.11.0
              hf download nvidia/DeepSeek-R1-FP4 --local-dir /model-cache/deepseek-r1-fp4
              hf download deepseek-ai/DeepSeek-R1 --local-dir /model-cache/deepseek-r1
          volumeMounts:
            - name: model-cache
              mountPath: /model-cache
      volumes:
      - name: model-cache
        persistentVolumeClaim:
          claimName: model-cache
