API: Persistence
Fiducio saves a single torch.save payload containing format metadata, the
Fiducio version, a stable calibrator id, the constructor configuration and the
learned state. Loading resolves the id through an internal controlled
registry and never imports an arbitrary module path stored in the file. By
default files are read with weights_only=True and onto CPU.
Warning
Only load calibrator files from sources you trust. See the project security policy.
save_calibrator
Serialize calibrator to path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calibrator
|
Calibrator
|
A fitted (or at least constructed) :class: |
required |
path
|
PathLike
|
Destination file. The |
required |
Source code in src/fiducio/persistence.py
load_calibrator
Load a calibrator previously written by :func:save_calibrator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
PathLike
|
File to load. |
required |
map_location
|
MapLocation | None
|
Device for the loaded tensors and the reconstructed calibrator. Defaults
to |
'cpu'
|
Notes
The payload is read exclusively with weights_only=True, which restricts
deserialization to tensors and basic Python types. Only load files you trust.
Source code in src/fiducio/persistence.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
Registry
registered_ids
get_calibrator_class
Return the calibrator class registered under calibrator_id.
Source code in src/fiducio/registry.py
register_calibrator
Class decorator that registers a calibrator under a stable id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calibrator_id
|
str
|
Stable, unique identifier persisted in saved files. Changing it breaks backward compatibility of previously saved calibrators. |
required |