4,998 questions
3
votes
1
answer
28
views
How to pickle Enum with values of type functools.partial
Problem
Suppose we have a python Enum where values are of type functools.partial. How to pickle and unpickle a member of that enum ?
import pickle
from enum import Enum
from functools import partial
...
-3
votes
0
answers
43
views
How to upload a machine learning model (.pkl) to Hugging Face? [closed]
I'm new to machine learning and I’m trying to upload a simple model (.pkl file) to Hugging Face.
I’ve already created a model repository on Hugging Face, but I'm confused about how to upload the .pkl ...
1
vote
1
answer
283
views
Unable to torch.load due to pickling/safety error
I am trying to use a pytorch model present on this link:
https://drive.google.com/drive/folders/121kucsuGxoYQu03-Jmy6VCDcPzqlG4cG
since it is used by this project I am trying to run:
https://github....
1
vote
1
answer
52
views
How to pickle my custom enum class without a PicklingError?
I have written an Interval python class with attributes for a starting point, an ending point, and a "curve type" that is used to interpolate between the start and the end. I only plan to ...
1
vote
2
answers
43
views
Pickle works but fails pytest
I've created a module persist containing a function obj_pickle which I'm using to pickle various objects in my project. It work fine but it's failing pytest, returning;
> pickle.dump(obj, ...
0
votes
0
answers
19
views
cannot pickle 'module' object error in Anaconda prompt with nnUNetv2
I am trying to do preprocessing of nnUNetv2 on my desktop.
It did not work in Visual Studio, so I changed my environment to Anaconda prompt.
However, it has still the same issue with 'cannot pickle '...
0
votes
0
answers
35
views
%store -r returns "TypeError: 'PickleShareDB' object is not subscriptable"
I have a string variable I've defined in one Jupyter notebook that I'd like to use in another Jupyter notebook. I know from here that %store is an approach, but when I use %store -r <variable> ...
0
votes
0
answers
35
views
No module named 'fickling.pickle'; 'fickling' is not a package
I'm trying to test code in https://huggingface.co/docs/hub/security-pickle this page.
code :
from fickling.pickle import Pickled
import pickle
# Create a malicious pickle
data = "my friend needs ...
1
vote
1
answer
30
views
dill.load_session() causes `UnpicklingError: pickle data was truncated` even though dill.dump_session() pickled perfectly fine
I'm running a Jupyter notebook on a remote server through interactive nodes. I ran many cells of the notebook, and in order to save the state of the notebook, I ran
import dill
filename = <insert ...
2
votes
1
answer
63
views
Shared library cannot be pickled by multiprocessing or dill package [duplicate]
I have a set of C code that is called by ctypes in Python. I am trying to call this code in parallel fully independently. I'm currently using multiprocessing or pathos. These packages aren't a hard ...
1
vote
1
answer
57
views
Pandas astype becomes in-place operation for data loaded from pickle files
Pandas astype() appears to unexpectedly switch to performing in-place operations after loading data from a pickle file. Concretly, for astype(str), the data type of the input dataframe values is ...
0
votes
0
answers
30
views
How can I edit (e.g., remove) data tips in a python figure that has been saved and now reopened?
I created a time series and assigned a cursor to each line so that I could identify the time associated with various behavior in the time series. The first time I made the figure, I selected the ...
0
votes
1
answer
60
views
How do I preserve and reconcile mutable object state across parallel tasks, when pickling breaks references in Python multiprocessing?
We're working on a concurrency problem where a single "Sample" object has multiple dependent tasks that must be executed in stages. For instance, stage 1 has tasks (1a, 1b), stage 2 has ...
0
votes
1
answer
70
views
UnpicklingError from Azure Blob
I'm developing an Azure Function to serve inferences from a machine learning model. The model is saved as a .pkl file on Azure Blob Storage. All attempts to read the file into Python fail.
For ...
0
votes
1
answer
27
views
Efficient way to cyclically update data of a class instance already saved on disk
There is a class Class containing an initial empty list list and a method to add an element to the list. Each time an element was added to the list the whole instance should be saved to disk. So in ...