Safetensors Utils#

bool trt_edgellm::rt::safetensors::saveSafetensors(
std::filesystem::path const &filePath,
std::vector<Tensor> const &tensors,
cudaStream_t stream
)#

Save tensors to a safetensors file.

Each tensor in the vector must have a unique name associated with it.

Parameters:
  • filePath – Path to output safetensors file

  • tensors – Vector of tensors to save

  • stream – CUDA stream for async operations

Returns:

True on success, false on failure

bool trt_edgellm::rt::safetensors::loadSafetensors(
std::filesystem::path const &filePath,
std::vector<Tensor> &tensors,
cudaStream_t stream
)#

Load tensors from a safetensors file.

Tensors are loaded into the provided vector. Each tensor owns its memory.

Parameters:
  • filePath – Path to input safetensors file

  • tensors – Output vector to store loaded tensors

  • stream – CUDA stream for async operations

Returns:

True on success, false on failure