Skip to main content
torch.js has not been released yet.
torch.js logotorch.js logotorch.js
PlaygroundContact
Login
Documentation
IntroductionType SafetyTensor ExpressionsTensor IndexingEinsumEinopsAutogradTraining a ModelProfiling & MemoryPyTorch MigrationBest PracticesRuntimesPerformancePyTorch CompatibilityBenchmarksDType Coverage
IntroductionQuickstartClient APIWorker APIFile I/OBackends
getGPUBackendloadGPUProvidergetGPUBackendInfoGPUBackendsaveloadload_safetensorsSerializationFormatSaveOptionsLoadOptions
torch.js· 2026
LegalTerms of UsePrivacy Policy
/
/
  1. docs
  2. torch-node
  3. torch-node
  4. serialization
  5. SaveOptions

torch-node.serialization.SaveOptions

export interface SaveOptions {
  /**
   * Metadata to include in safetensors file.
   * Only used when saving to safetensors format.
   * Metadata is stored as string key-value pairs.
   */
  metadata?: Record<string, string>;

  /**
   * Format to save. Default: `'auto'`
   *
   * When set to 'auto', the format is determined by the file extension:
   * - `.safetensors` → safetensors format
   * - `.pt` or `.pth` → PyTorch format
   */
  format?: SerializationFormat;
}
metadata(Record<string, string>)optional
– Metadata to include in safetensors file. Only used when saving to safetensors format. Metadata is stored as string key-value pairs.
format(SerializationFormat)optional
– Format to save. Default: 'auto' When set to 'auto', the format is determined by the file extension: - .safetensors → safetensors format - .pt or .pth → PyTorch format

Options for save.

Previous
save
Next
SerializationFormat