Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading indices across various python versions #251

Open
canergen opened this issue Jan 25, 2025 · 0 comments
Open

Loading indices across various python versions #251

canergen opened this issue Jan 25, 2025 · 0 comments

Comments

@canergen
Copy link

Hi, this is more a developer question, then a bug report. I want to load classifiers like across different environments:

knn = make_pipeline(
    PyNNDescentTransformer(
        n_neighbors=self.classifier_dict["n_neighbors"],
        n_jobs=settings.n_jobs,
    ),
    KNeighborsClassifier(metric="precomputed", weights=self.classifier_dict["weights"]),
)
knn.fit(train_X, train_Y)
joblib.dump(
    knn,
    open(
        os.path.join(
            adata.uns["_save_path_trained_models"],
            "scvi_knn_classifier.joblib",
        ),
        "wb",
    ),
)

Currently they are restricted to a single python minor version (tested for python 3.10, 3.11 and 3.12). All expect different numbers of arguments during loading. The error is:

joblib stored in python 3.10 opened in python 3.12:    def _unpickle__CustomPickled(serialized):
        """standard unpickling for _CustomPickled.
    
        Uses NumbaPickler to load.
        """
>       ctor, states = loads(serialized)
E       TypeError: code() argument 13 must be str, not int

Do you have any suggestion to increase compatibility (when I disable numba.jit, it doesn't allow pickling the classifier)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant