Enum safetensors::tensor::SafeTensorError
source · pub enum SafeTensorError {
Show 14 variants
InvalidHeader,
InvalidHeaderStart,
InvalidHeaderDeserialization,
HeaderTooLarge,
HeaderTooSmall,
InvalidHeaderLength,
TensorNotFound(String),
TensorInvalidInfo,
InvalidOffset(String),
IoError(Error),
JsonError(Error),
InvalidTensorView(Dtype, Vec<usize>, usize),
MetadataIncompleteBuffer,
ValidationOverflow,
}
Expand description
Possible errors that could occur while reading A Safetensor file.
Variants§
InvalidHeader
The header is an invalid UTF-8 string and cannot be read.
InvalidHeaderStart
The header’s first byte is not the expected {
.
InvalidHeaderDeserialization
The header does contain a valid string, but it is not valid JSON.
HeaderTooLarge
The header is large than 100Mo which is considered too large (Might evolve in the future).
HeaderTooSmall
The header is smaller than 8 bytes
InvalidHeaderLength
The header length is invalid
TensorNotFound(String)
The tensor name was not found in the archive
TensorInvalidInfo
Invalid information between shape, dtype and the proposed offsets in the file
InvalidOffset(String)
The offsets declared for tensor with name String
in the header are invalid
IoError(Error)
IoError
JsonError(Error)
JSON error
InvalidTensorView(Dtype, Vec<usize>, usize)
The follow tensor cannot be created because the buffer size doesn’t match shape + dtype
MetadataIncompleteBuffer
The metadata is invalid because the data offsets of the tensor does not fully cover the buffer part of the file. The last offset must be the end of the file.
ValidationOverflow
The metadata contains information (shape or shape * dtype size) which lead to an arithmetic overflow. This is most likely an error in the file.