Export model from dataiku jupyter to my local machine

omar21
Level 2
Export model from dataiku jupyter to my local machine

Hi ,

 

I built a customize model on dataiku jupyter notebook (we can say from scratch) , (i didn't use the the model proposed by dataiku) and i want to save and export it on my local machine out of dataiku because i want to deploy it on another software not linked with dataiku 

How can i do it?

 

0 Kudos
4 Replies
louisplt
Dataiker

Hello @omar21,

It's not very clear for me what you want to achieve.

If you want to export only the model you could try to dump its python object into a file (using pickle) and then put this file in a Folder managed by DSS. For this you need first to create a Folder (on the top right of the Flow > +Dataset > Folder) and execute the following code in your notebook: 

import dataiku
import pickle

model_file_name = THE_MODEL_FILENAME

folder = dataiku.api_client().get_project(YOUR_PROJECT_KEY).get_managed_folder(MANAGED_FOLDER_ID)
with open(model_file_name, 'w+') as f:
    pickle.dump(model_object, f) 
    folder.put_file(model_file_name, f)

Afterwards, you should see the new file in the Managed Folder and be able to download it.

Hope this helps

0 Kudos
CY
Level 1

Hi @louisplt , 

I have the same question as above and I tried your suggestion by creating a folder and export the model into the folder. I'm able to see a new files created in the created folder but the model was saved as a empty file.

Do you have any idea on what could be the issue that causing it unable to write the content into the file? 

screenshot.jpg

โ€ƒ

0 Kudos
louisplt
Dataiker

Hello @CY,

I have no idea why this is not working, but you can try the following:

folder = dataiku.Folder(FOLDER_ID)

with folder.get_writer(FILE_NAME) as w:
    w.write("some data")

 

Hope this helps

Sv3n-Sk4
Level 3

Not sure I understand clearly what you intend to do, but you could simply export the jupyter notebook (File -> Download As -> Notebook (.ipynb)), open it on your computer.

I suggest you to download Anaconda if you don't have it already and work from there with your downloaded Notebook.

Anaconda | The World's Most Popular Data Science Platform

 

If you just want to use a model previously created you could create a pickle file and use it to only recreate your model.

pickle โ€” Python object serialization โ€” Python 3.11.0 documentation


Hope it helped!

Hadrien

0 Kudos