Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9168743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:41:55+00:00 2026-06-17T15:41:55+00:00

I’ve got an application where I’m loading very large python objects– they’re serialized scikit-learn

  • 0

I’ve got an application where I’m loading very large python objects– they’re serialized scikit-learn classifiers and their associated vocabularies.

The classifiers are large enough (on the order of 1-100 MBs) that loading them into memory is a non-trivial task. The actual read is quick, but unpickling takes a long time, around 10 seconds for a 4MB classifier.

Is there a faster way to serialize/deserialize objects than cPickle.dumps/cPickle.loads?

Additional Info:

The classifiers are instances of one-vs-rest random forests of 10 elements. The classifiers were trained on around 1,000 samples, around 500 features, and 52 possible labels. The min_density parameter is set to 0.


cProfile output of cPickle.load:

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000  300.168  300.168 <ipython-input-4-9b8a128f290d>:1(loader)
        1    0.899    0.899  301.067  301.067 <string>:1(<module>)
    51380  288.151    0.006  288.151    0.006 __init__.py:93(__RandomState_ctor)
    51380    0.059    0.000    0.404    0.000 fromnumeric.py:1774(amax)
        1   11.613   11.613  300.168  300.168 {cPickle.load}
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
    51380    0.344    0.000    0.344    0.000 {method 'max' of 'numpy.ndarray' objects}
        1    0.000    0.000    0.000    0.000 {open}

I’m in the process of opening an issue at github.com/scikit-learn about this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:41:56+00:00Added an answer on June 17, 2026 at 3:41 pm

    Have you tried to use the joblib picker? It’s bundled in the sklearn package:

    >>> from sklearn.externals import joblib
    >>> joblib.dump(model, '/path/to/model.pkl')
    >>> model_copy = joblib.load('/path/to/model.pkl')
    

    Edit: actually for random forest, default pickling with HIGHEST protocolo seems to be faster:

    >>> from cPickle import dump, load, HIGHEST_PROTOCOL
    >>> dump(model, open('/tmp/model_highest.pkl', 'wb'), HIGHEST_PROTOCOL)
    >>> load(open('/tmp/model_highest.pkl', 'rb'))
    

    Edit2: based on your profile report, the issue seems to be the unpickling of pseudo random number generator instances. Could you please provide the exact python snippet your are using to train the models along with the shape of the dataset and include that along with the profiling report as a bug on the github issue tracker of the scikit-learn project?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am using Paperclip to handle profile photo uploads in my app. They upload
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.