Export model from dataiku jupyter to my local machine

Options
omar21
omar21 Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 18 ✭✭✭✭

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?

Answers

  • louisplt
    louisplt Dataiker Posts: 21 Dataiker
    Options

    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 dataikuimport picklemodel_file_name = THE_MODEL_FILENAMEfolder = 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

  • CY
    CY Registered Posts: 1
    Options

    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

  • louisplt
    louisplt Dataiker Posts: 21 Dataiker
    Options

    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
    Sv3n-Sk4 Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 32 ✭✭✭✭
    Options

    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

Setup Info
    Tags
      Help me…