Roboflow fork of fickle - load pickled data as safely as possible
Project description
RFFickle: Roboflow Fork of Fickle
This is a fork of the Fickle package by Eduard Christian Dumitrescu, with additional functionality added by Roboflow.
Fork Information
- Original Package: fickle v0.2.2
- Original Author: Eduard Christian Dumitrescu
- Fork Maintainer: Roboflow, Inc.
- PyPI Package:
rffickle
This fork was created from the PyPI source distribution as the original source code was not available on GitHub.
Original README: Fickle - Firewalled Pickle
People abuse pickle. Especially researchers. Pickle is not secure. Published datasets and ML training weights are often distributed as pickle files (or formats which use pickle files, such as PyTorch checkpoint.ckpt files). Sometimes it is the only format that they are available in.
Examples
Loading basic types is easy:
>>> from fickle import DefaultFirewall
>>> import pickle
>>>
>>> my_picked_data = pickle.dumps({"list": [1, 2, "three", b"four"]})
>>>
>>> firewall = DefaultFirewall()
>>> firewall.loads(my_picked_data)
{'list': [1, 2, 'three', b'four']}
Safely loading PyTorch checkpoint files into numpy arrays is just as easy:
>>> from fickle.ext.pytorch import fake_torch_load_zipped
>>> from zipfile import ZipFile
>>>
>>> zf = ZipFile("/path/to/sd-v1-4.ckpt")
>>> ckpt = fake_torch_load_zipped(zf)
>>> tensor = ckpt["state_dict"]["model.diffusion_model.output_blocks.3.1.norm.weight"]
>>> tensor.array
array([0.39097363, 0.3898967 , 0.35191917, ..., 0.41924757, 0.4031702 ,
0.37156993], dtype=float32)
You can, optionally, even use marshmallow for validation!
Alternatives
| fickle | picklemagic | pikara | |
|---|---|---|---|
Does not rely on pickle._Unpickler? |
✅ | ❌ | ✅ |
Uses pickletools.genops |
yes | no | yes |
| Can load without executing? | ✅ | ✅ | ? |
| Forbid importing arbitrary objects? | ✅ | ✅ | ? |
Forbid calling list.append/set.add/etc? |
✅ | ❌ | ? |
| Forbid calling all methods by default? | ✅ | ❌ | ? |
| Can create dangerous circular structures? | ✅ | ✅ | ? |
| Safe against billion laughs DoS attack? | ? | ? | ? |
| Full support for all pickle opcodes? | ❌ | ✅ | ? |
| Has unit tests? | ✅ | ❌ | ✅ |
| Stable API? | ❌ | ✅ | ✅ |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rffickle-0.2.2.tar.gz.
File metadata
- Download URL: rffickle-0.2.2.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67cd9d9b964f7ced51562fbc4c5a5a35eb3bb21f5e9c73573e597025f3c69e5a
|
|
| MD5 |
310524f414f0a931b52b86885e5a454d
|
|
| BLAKE2b-256 |
7e45f9de363cfbcc257b751571788e7d37f4175406bf14983797f386d89f900b
|
Provenance
The following attestation bundles were made for rffickle-0.2.2.tar.gz:
Publisher:
publish-release.yml on roboflow/fickle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rffickle-0.2.2.tar.gz -
Subject digest:
67cd9d9b964f7ced51562fbc4c5a5a35eb3bb21f5e9c73573e597025f3c69e5a - Sigstore transparency entry: 450837088
- Sigstore integration time:
-
Permalink:
roboflow/fickle@b835555020b8d24fd415212acca57649a731f905 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/roboflow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-release.yml@b835555020b8d24fd415212acca57649a731f905 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file rffickle-0.2.2-py3-none-any.whl.
File metadata
- Download URL: rffickle-0.2.2-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2459979c1e1025feff38f9f708e6328a6263fe2df359692bcd24c2e5fad9cef5
|
|
| MD5 |
e2c299244aefc8c187890f2a288db3cc
|
|
| BLAKE2b-256 |
2d37a3240d76c2723a89332aa73a9a917d69e4d0945a90050d315bb7759e2ac9
|
Provenance
The following attestation bundles were made for rffickle-0.2.2-py3-none-any.whl:
Publisher:
publish-release.yml on roboflow/fickle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rffickle-0.2.2-py3-none-any.whl -
Subject digest:
2459979c1e1025feff38f9f708e6328a6263fe2df359692bcd24c2e5fad9cef5 - Sigstore transparency entry: 450837095
- Sigstore integration time:
-
Permalink:
roboflow/fickle@b835555020b8d24fd415212acca57649a731f905 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/roboflow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-release.yml@b835555020b8d24fd415212acca57649a731f905 -
Trigger Event:
workflow_dispatch
-
Statement type: