From dev-return-5557-archive-asf-public=cust-asf.ponee.io@mxnet.incubator.apache.org Fri Feb 22 23:49:13 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2764F180648 for ; Sat, 23 Feb 2019 00:49:12 +0100 (CET) Received: (qmail 24143 invoked by uid 500); 22 Feb 2019 23:49:12 -0000 Mailing-List: contact dev-help@mxnet.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mxnet.incubator.apache.org Delivered-To: mailing list dev@mxnet.incubator.apache.org Received: (qmail 24125 invoked by uid 99); 22 Feb 2019 23:49:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Feb 2019 23:49:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 11F2ECAE48 for ; Fri, 22 Feb 2019 23:49:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.025 X-Spam-Level: *** X-Spam-Status: No, score=3.025 tagged_above=-999 required=6.31 tests=[DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=2, MIME_BOUND_DIGITS_15=1.225, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 7bqQ29pqGSRw for ; Fri, 22 Feb 2019 23:49:09 +0000 (UTC) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 8C49062438 for ; Fri, 22 Feb 2019 23:42:35 +0000 (UTC) Received: by mail-ot1-f52.google.com with SMTP id c18so3313853otl.13 for ; Fri, 22 Feb 2019 15:42:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=9eZOFw+SOy9nqPvhPzStlLv1PiYF2u1iof4nDAOrtRc=; b=ELFLFwE3YOQSMgQLoSQ7jTfzuv4Y37YrAL3g2xMYvBKov3qIumPLrmXIYfhB0epgHe /nqZhtnFzH5uxbNuV+JCjiKR2Or2IPgvNeXPUtK+NkNxpRlkeHx5beBj/LdeK9PyjD3m xKnwAby6XSnbZpJMAuAoxxvBE99n9q96YwbznaFRNiM+CkZVuTSNMmfa371QgNlQGI1N 5WIkY1ceXMsl155Lb6wkPyadoKETvSp5SdQu9DwDfVUQ9FZSF6T4l10t/7ma3GVSxF0t 2sqLJDMBeV+p0ypkAeIC0ZyYaIcEXlcG2NN1ej9E2hF5gAHL32vtZdr4BMKcGlJoPyBt 0amA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=9eZOFw+SOy9nqPvhPzStlLv1PiYF2u1iof4nDAOrtRc=; b=IPkWjVh/JMBbNuVnX822YjKWyV/4D/NPBFZK+QeKKcCKhWXU/eMj0oGHj9t2uKSzRA FB6PAcUbPwD4EXtmxbStLFDdphMukMu2EeAAxFqhXyjB7vTK9y7Gw/Y6Yr/D3T2s6VIj Uqhow0FotONRhxTJZBkd94truV4KYgN4ue6MU0stNBgGQvD+/a1FwY5oTP3yAMkniE+X J7cb3CqDCc93AWC3BnRX1D+qaFcQ0xHWjipKLlPf3jJglC/qCyoEPpPgjhTr7noi1WF/ vTdbBcdSqindTK7GAQ0Ahphmsqn6vMBjYIPZUtGNoT85AtE/W9YGSSR8tujtxovr17hm daEA== X-Gm-Message-State: AHQUAuYn8qhnwh8A0CN9N5KuZ33dN0/qpcYwg1Hf1G6jJkGBWVhovEB5 EcoRUCHOMwvPP89SS0lU6sFPPm4VLe5Hnz7aD4ChoSiQ X-Google-Smtp-Source: AHgI3Ibqz+n3SnYSda/rVkWeYb86emLa7RU+Ztr321yH2ADtkkZqD0MBPeIA4ZKIY7KqNGd1q94C6lGPYwD8H3H8b8E= X-Received: by 2002:a9d:7597:: with SMTP id s23mr4296436otk.25.1550878954224; Fri, 22 Feb 2019 15:42:34 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Sheng Zha Date: Fri, 22 Feb 2019 15:42:22 -0800 Message-ID: Subject: Re: [Design Review Request] Extending model save/load API To: dev@mxnet.incubator.apache.org Content-Type: multipart/alternative; boundary="0000000000002801780582842530" --0000000000002801780582842530 Content-Type: text/plain; charset="UTF-8" Hi Sandeep, > users need to know input name This information is already in the files from Gluon export API. Here's how you get them: In [1]: import mxnet as mx ...: net = mx.gluon.model_zoo.vision.alexnet(pretrained=True) ...: net.hybridize() ...: net(mx.nd.ones((1,3,224,224))) ...: net.export('alexnet') ...: net_sym = mx.sym.load('alexnet-symbol.json') ...: net_params = mx.nd.load('alexnet-0000.params') ...: print('input is {}'.format([n for n in net_sym.list_inputs() if 'arg:{}'.format(n) not in net_params.keys()])) ...: print('output is {}'.format(net_sym.list_outputs())) ...: ...: input is ['data'] output is ['alexnet0_dense2_fwd_output'] > shape It's true that shape needs to be specified before binding. The catch for coding it into the symbol file is that many networks support variable size data, such as RNN and CNN. Having static size makes the symbol file strictly less useful. Also, those who develop the inference code would have to know the shape at the time of binding because otherwise they won't know if the data they feed is "legal". IMO the proposed additional metadata seems to be coupling the model development and deployment instead of decoupling them. -sz On Thu, Feb 21, 2019 at 2:36 PM sandeep krishnamurthy < sandeep.krishna98@gmail.com> wrote: > Hi Sheng, > > By stating unusable out of the box, I meant, when loading a model for > inference, today, users need to know input name, shape for binding. This > information if part of the model, could have simplified model training to > model deployment path much easier and decoupled. > > Best, > Sandeep > > On Thu, Feb 21, 2019 at 2:10 PM Sheng Zha wrote: > > > Hi Sandeep, > > > > In the design doc, you stated that > > > Input/Output signature are not part of the model: Saved model missing > the > > information about the input/output descriptions, like name/shape, making > > the saved model unusable out of the box. > > > > Could you elaborate why you think this is the case? > > > > -sz > > > > On Thu, Feb 21, 2019 at 11:11 AM sandeep krishnamurthy < > > sandeep.krishna98@gmail.com> wrote: > > > > > Hello MXNet community, > > > > > > I have put up a design proposal to extend the MXNet model saving and > > > loading APIs to solve the following 2 problems: > > > 1. Currently, model export/save APIs do not allow you to export the > data > > > transformations as part of the model. By allowing this, we greatly > > simplify > > > the user experience during inference across all language bindings and > > also > > > we see a good performance gains. > > > 2. Currently, model export/save APIs do not save input/output signature > > > like input data names, shapes etc.. By saving it as part of the model, > we > > > simplify again the inference and model deployment logic. > > > > > > > > > https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=103090063 > > > > > > Thanks to our fellow community members (Zhi, Naveen, Pinar and Jake) > for > > > their initial feedback. I request the community to review and provide > > > feedback on the proposal. > > > > > > -- > > > Sandeep Krishnamurthy > > > > > > > > -- > Sandeep Krishnamurthy > --0000000000002801780582842530--