bqn-safetensors/test.bqn
2024-11-15 20:59:02 +01:00

19 lines
731 B
BQN
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ExtractMetadata,GetArrayNames,GetArray,SerializeArrays•Import"safetensors.bqn"
# Read a safetensors file generated from Python
bytes•file.MapBytes"arrs.safetensors"
{•Out𝕩•Show bytesGetArray𝕩}¨GetArrayNames bytes
# Serialize BQN arrays to a safetensors file
a32101100
b34560
c233.14×6
"test.safetensors"•file.Bytes "arr_a""arr_b""arr_c" SerializeArrays abc
# Read the file that was created
bytes•file.MapBytes"test.safetensors"
namesGetArrayNames bytes
{•Out𝕩•Show bytesGetArray𝕩}¨names
! abytes GetArray "arr_a"
! bbytes GetArray "arr_b"
! cbytes GetArray "arr_c"