serva Python package is the official client for the Serva Encoder. You install it once, create a single Serva client, and every capability hangs off that one object: encoding files to .serva, decoding them back, pushing and pulling encoded datasets on the Hugging Face Hub, and loading .serva files straight into PyTorch.
The SDK wraps the REST API and handles the multi step
streaming flow for you. For most cases it is the smoothest way to work with
.serva files.Install
ServaDataset works out of the box with nothing extra to install.
The Serva client
Generate a Service API key from the dashboard (Settings → API keys), then pass it to the client or setSERVA_API_KEY in your environment.
Encode and decode
Encoding turns a file into the portable.serva format. Decoding turns it back. Both are a single call that runs the initiate, stream, and download steps for you.
.serva suffix. Pass output= to choose the path.
Rows of numbers encode the same way. They are staged as a float32 .npy and encoded as a file. An array has no filename to borrow, so pass output= to name the result:
decode still accepts one, for a .serva issued while encoding still locked files:
EncodeResult carries the details of the run:
Datasets and training
- Hugging Face. Push encoded datasets to the Hub and pull them back, with a dataset card written for you.
- PyTorch. Load a folder of
.servafiles into a training loop withServaDataset.
A
.serva does not carry the original filename, so decoding cannot restore it.
Pass output= to name the decoded file; without it you get the .serva name
with a .out suffix.
