Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
Reuse a scikit learn model .pkl in AWS Lambda

I am a beginner in AWS and I trained on my computer a RandomForestClassifier with scikit-learn and I used joblib to get my model in pkl format.

Now I would like, to reuse this RandomForest in AWS Lambda. Since it needs sklearn.externals to load my model again, I have made a Zip directory which contains Numpy, Scipy, sklearn, my code and my model in pkl format. I put this zip in a S3 bucket to execute my code in Lambda.

I would like to know if then, it is possible to use this model using model.predict() ? I didn't find any documentation about this specific problem.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Actually, I succeed using URLs. I put my model .pkl in a S3 Bucket, and I can get it using urllib2.

Here is my code, if anyone ever encounters the same problem :

req = urllib2.Request(url=url_model)
f = urllib2.urlopen(req)
model = cPickle.load(f)

It only works if the file is public. If you need it to be private, you can generate a presigned URL using boto3 like this :

url_model = s3.generate_presigned_url(
    ClientMethod='get_object',
    ExpiresIn=1,
    Params={
        'Bucket': 'my-bucket',
        'Key': 'mymodel.pkl'
    }
)
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda