apiVersion: v1
kind: Pod
metadata:
  name: bert-large-fp32-training # {"$openapi":"MODEL_NAME"}
spec:
  serviceAccountName: bert-large-fp32-training # {"$openapi":"MODEL_NAME"}
  securityContext:
    runAsUser: 0 # {"$openapi":"USER_ID"}
    runAsGroup: 0 # {"$openapi":"GROUP_ID"}
    fsGroup: 0 # {"$openapi":"FS_ID"}
  initContainers:
  - name: create-output-dir
    image: docker.io/intel/language-modeling:tf-latest-bert-large-fp32-training # {"$openapi":"IMAGE"}
    imagePullPolicy: IfNotPresent
    workingDir: /workspace/bert-large-fp32-training # {"$openapi":"MODEL_DIR"}
    command:
    - mkdir
    args: 
    - -p
    - $(OUTPUT_DIR)
    envFrom:
    - configMapRef:
        name: bert-large-fp32-training # {"$openapi":"MODEL_NAME"}
    volumeMounts:
    - name: nfs-path
      mountPath: /nfs # {"$openapi":"NFS_PATH"}
  - name: create-checkpoint-dir
    image: docker.io/intel/language-modeling:tf-latest-bert-large-fp32-training # {"$openapi":"IMAGE"}
    imagePullPolicy: IfNotPresent
    workingDir: /workspace/bert-large-fp32-training # {"$openapi":"MODEL_DIR"}
    command:
    - mkdir
    args: 
    - -p
    - $(CHECKPOINT_DIR)
    envFrom:
    - configMapRef:
        name: bert-large-fp32-training # {"$openapi":"MODEL_NAME"}
    volumeMounts:
    - name: nfs-path
      mountPath: /nfs # {"$openapi":"NFS_PATH"}
  containers:
  - name: single-node
    image: docker.io/intel/language-modeling:tf-latest-bert-large-fp32-training # {"$openapi":"IMAGE"}
    workingDir: /workspace/bert-large-fp32-training # {"$openapi":"MODEL_DIR"}
    envFrom:
    - configMapRef:
        name: bert-large-fp32-training # {"$openapi":"MODEL_NAME"}
    command:
    - python
    args: # {"$openapi":"COMMAND"}
    - /workspace/bert-large-fp32-training/benchmarks/launch_benchmark.py # {"$openapi":"COMMAND"}
    - --model-name=bert_large
    - --precision=fp32
    - --mode=training
    - --framework=tensorflow
    - --batch-size
    - "32"
    - --output-dir=$(OUTPUT_DIR)
    - --
    - train-option=Classifier
    - task-name=MRPC
    - do-train=true
    - do-eval=true
    - data-dir=$(DATASET_DIR)/$(GLUE_DIR)/MRPC
    - vocab-file=$(DATASET_DIR)/$(BERT_BASE_DIR)/vocab.txt
    - config-file=$(DATASET_DIR)/$(BERT_BASE_DIR)/bert_config.json
    - init-checkpoint=$(DATASET_DIR)/$(BERT_BASE_DIR)/bert_model.ckpt
    - max-seq-length=128
    - learning-rate=2e-5
    - num-train-epochs=30
    - optimized_softmax=True
    - experimental_gelu=False
    - do-lower-case=True
    volumeMounts:
    - name: datasets
      mountPath: /datasets # {"$openapi":"DATASET_DIR"}
      readOnly: true
    - name: nfs-path
      mountPath: /nfs # {"$openapi":"NFS_PATH"}
  volumes:
  - name: datasets
    hostPath:
      path: /datasets # {"$openapi":"DATASET_DIR"}
  - name: nfs-path
    nfs:
      server: 0.0.0.0 # {"$openapi":"NFS_SERVER"}
      path: /nfs # {"$openapi":"NFS_PATH"}
  restartPolicy: OnFailure
