IO¶
-
class
finalfusion.io.Chunk[source]¶ Basic building blocks of finalfusion files.
-
write(file: Union[str, bytes, int, os.PathLike])[source]¶ Write the Chunk as a standalone finalfusion file.
- Parameters
file (Union[str, bytes, int, PathLike]) – Output path
- Raises
TypeError – If the Chunk is a
Header.
-
abstract static
chunk_identifier() → finalfusion.io.ChunkIdentifier[source]¶ Get the ChunkIdentifier for this Chunk.
- Returns
chunk_identifier
- Return type
-
abstract static
read_chunk(file: BinaryIO) → finalfusion.io.Chunk[source]¶ Read the Chunk and return it.
The file must be positioned before the contents of the
Chunkbut after its header.- Parameters
file (BinaryIO) – a finalfusion file containing the given Chunk
- Returns
chunk – The chunk read from the file.
- Return type
-
-
class
finalfusion.io.ChunkIdentifier(value)[source]¶ Bases:
enum.IntEnumKnown finalfusion Chunk types.
-
Header= 0¶
-
SimpleVocab= 1¶
-
NdArray= 2¶
-
BucketSubwordVocab= 3¶
-
QuantizedArray= 4¶
-
Metadata= 5¶
-
NdNorms= 6¶
-
FastTextSubwordVocab= 7¶
-
ExplicitSubwordVocab= 8¶
-
-
class
finalfusion.io.FinalfusionFormatError[source]¶ Bases:
ExceptionException to specify that the format of a finalfusion file was incorrect.
-
class
finalfusion.io.TypeId(value)[source]¶ Bases:
enum.IntEnumKnown finalfusion data types.
-
u8= 1¶
-
f32= 10¶
-