Skip to content

Configuration & CLI Reference ​

SoraSR separates runtime configuration from source code using typed YAML files validated at startup. Any YAML key can be overridden from the command line using dotted --set key=value notation.

Complete Training YAML Example ​

yaml
experiment:
  name: sorasr_s_x4_df2k
  seed: 42
  precision: bf16          # fp32 | fp16 | bf16

model:
  arch: sorasr_s
  scale: 4
  in_channels: 3
  embed_dim: 64
  depths: [4, 4, 4, 4]
  num_heads: [4, 4, 4, 4]
  window_size: 8

data:
  train:
    hr_dir: datasets/DF2K/HR_sub512
    lr_dir: datasets/DF2K/LR_sub128
    patch_size: 64         # LR patch size (HR = patch_size * scale)
    batch_size: 16
    num_workers: 8
    augment:
      hflip: true
      vflip: true
      rot90: true
  val:
    hr_dir: datasets/benchmarks/Set14/GTmod12
    lr_dir: datasets/benchmarks/Set14/LRbicx4
    interval_steps: 5000

optim:
  type: adamw
  lr: 2.0e-4
  betas: [0.9, 0.99]
  weight_decay: 0.0
  grad_clip: 1.0

scheduler:
  type: cosine
  warmup_steps: 2000
  total_steps: 300000
  min_lr: 1.0e-6

ema:
  enabled: true
  decay: 0.999

losses:
  charbonnier:
    weight: 1.0
    eps: 1.0e-3
  fft:
    weight: 0.02

CLI Subcommands ​

CommandPurposeKey Flags
sorasr trainLaunch or resume training--config, --work-dir, --resume, --precision, --set
sorasr inferUpscale image(s) or directories--model, --input, --output, --tile-size, --tile-overlap
sorasr evalCompute PSNR / SSIM / LPIPS--model, --lr-dir, --hr-dir, --scale, --metrics
sorasr export onnxExport checkpoint to ONNX--checkpoint, --output, --opset, --dynamic-hw, --verify
sorasr data prepare-subimagesSlice HR images for fast I/O--input, --output, --crop-size, --step, --workers
sorasr doctorInspect CUDA / ORT / TRT setup--json

Common Troubleshooting ​

CUDA Out of Memory During Inference ​

  • Reduce --tile-size from 512 to 256 (or 128) and set --precision fp16 or bf16.
  • Confirm tiled batch size is 1 on GPUs with <= 8 GB VRAM.

Subtle Grid Lines Between Tiles ​

  • Increase --tile-overlap from 8 to 16 or 24 pixels so the raised-cosine blending margin covers the attention window width.

ONNX Verification Mismatch Exceeds Tolerance ​

  • Ensure the checkpoint was loaded in .eval() mode with EMA weights selected.
  • Upgrade to --opset 17 or newer so LayerNormalization exports natively rather than decomposing into numerically drifted primitives.

Released under the Apache-2.0 License.