Skip to content
Discussion options

You must be logged in to vote

safetensors 0.8.0 is now supported on Android and iOS: https://pypi.flet.dev/safetensors

safetensors loads and saves model weights/embeddings as a safe, zero-copy file format — none of pickle's arbitrary-code-execution risk, and fast mmap reads that pull one tensor at a time.

Install

safetensors itself has no required dependencies, but the usable mobile path needs numpy, so add both:

dependencies = [
    "flet",
    "safetensors",
    "numpy",
]

Example

Save a couple of tensors, reload them via safe_open, and show the result on screen. Note the file goes into Flet's storage: the app bundle is read-only on device, so write to FLET_APP_STORAGE_TEMP/_DATA, not the working directory.

import os

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ndonkoHenri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants