Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model store #1077

Merged
merged 5 commits into from
Oct 11, 2016
Merged

Model store #1077

merged 5 commits into from
Oct 11, 2016

Conversation

IsaacYangSLA
Copy link
Contributor

@IsaacYangSLA IsaacYangSLA commented Sep 16, 2016

Depends on #1048, will rebase/squash later after #1048 is merged.

@lukeyeager lukeyeager self-assigned this Sep 19, 2016
Copy link
Member

@lukeyeager lukeyeager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just looked through the code - haven't really tried it yet


@classmethod
def visibility(cls):
return config_option.Visibility.HIDDEN
Copy link
Member

@lukeyeager lukeyeager Sep 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this DEFAULT instead? Otherwise I have to use python -m digits.config.edit -v to edit it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. That's also what I got confused about. Thanks for the suggestion.

'url_list': self.url_list
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're going to want to implement validate() somehow. Right now, it accepts "1234", "foo", etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I will implement it later in this PR. The code should ensure that URL is supposed to be well-formatted, not random strings.

return True

def suggestions(self):
self.url_list = ['http://localhost/modelstore/']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the user going to input a list? This needs to be a string, possibly separated by a separator (a comma seems like a good choice).

<title>Model Store</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't add links that require internet access to download. Either check them into our source tree under digits/static/js/ or pick another library.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is already checked into our tree.

integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
<script src="/static/js/store.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use this format for files stored under static/js/:
https://github.com/NVIDIA/DIGITS/blob/v4.0.0/digits/templates/layout.html#L12

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look into those three 'scripts' and 'link' tags and modify them accordingly.

# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import

import flask
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to nitpick, but can you put this import flask below the standard imports? And above the digits imports?
https://www.python.org/dev/peps/pep-0008/#imports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Sorry for the improper ordering of imports.

@@ -69,6 +69,7 @@
<li><span class="navbar-text"><a target="_blank" href="https://github.com/NVIDIA/DIGITS/tree/master/docs">DIGITS docs</a></span></li>
<li><span class="navbar-text"><a target="_blank" href="https://github.com/NVIDIA/DIGITS">DIGITS on github</a></span></li>
<li><span class="navbar-text"><a target="_blank" href="https://groups.google.com/forum/#!forum/digits-users">DIGITS User Group</a></span></li>
<li hidden><span class="navbar-text"><a target="_blank" href="https://developer.nvidia.com/digits/nvzoo">NVidia model store for DIGITS</a></span></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use NVIDIA here instead of NVidia?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem.

@lukeyeager lukeyeager removed their assignment Sep 19, 2016
Copy link
Member

@lukeyeager lukeyeager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use this PR, but when I click on the "Update model list" button, nothing happens. No error or anything.

'access-model-store': {
'title': 'Retrieve from Model Store',
'id': 'retrieveModelStore',
'url': '/static/store.html',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this an actual Flask route and not just a link to a static HTML file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Yes, it will be much better to do flask.url_for on this. I changed codes to reflect this.

@TimZaman
Copy link
Contributor

TimZaman commented Sep 20, 2016

I have some trouble setting the custom URL. I do this:
python -m digits.config.edit -v
then I input as Model Store URL List: ['http://foo.bar']

Then in digits/store/views.py I do for debugging print(app.config['store_url_list']) it prints out: ['http://localhost/modelstore/'] ?

So

  1. For me (I might be using it wrong) it does not want to retain the static url
  2. The bogus url should communicate to the front-end that it cannot be reached (404).

@IsaacYangSLA
Copy link
Contributor Author

@TimZaman , my bad. The prompt portion of store codes was broken. I rewrote that portion and it should work now.

@TimZaman
Copy link
Contributor

I can see why we want this in the next release, it's really cool!

self.url_list = ['http://localhost/modelstore/']
return [prompt.Suggestion(self.url_list, 'H', desc='URL list')]
self.url_list = ''
return [prompt.Suggestion(self.url_list, 'M', desc='Model Store URL list (comma separated)')]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the format requirements in prompt_message() above. I don't think you actually need any suggestions for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wondered what should be the suggested URL. Now it's much easier for me for this option.

url_list = value.split(',')
for url in url_list:
if url is not None and urlparse(url).scheme != "" and not os.path.exists(url):
valid_url_list.append(url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not valid, throw an error.

Copy link
Contributor Author

@IsaacYangSLA IsaacYangSLA Sep 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I should throw BadValue and let user to enter the URL again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validate method is now throwing BadValue exception whenever it encounters invalid url inside url_list loop.

@TimZaman
Copy link
Contributor

I do think we need to make the download progress visible (and a loading indicator when retrieving details from the particular model store)

…Store

Enable direct import from Model Store to Pretrained Model

Rebase onto master.
Use new env-vars for option.
Copy link
Contributor

@gheinrich gheinrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a little unintuitive to have to have to click on Images to load a model from the model store in the pretrained model tab.



## Introduction
Model Store is a new feature in DIGITS.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might not be new for a very long time :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's been a long time. Let me remove that. :-)



## Create your own Model Store server
At the top directory, create a master.json file (if your server does not support directory listing).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a hint to show how to set up a web server. For example:

$ cd .../my-model-store/
$ python2 -m SimpleHTTPServer 8000

## Browse and import model
First launch DIGITS.
Click Pretrained Models tab, and select 'Retrieve from Model Store' under 'Load Model.'
The new page shows models available in model stores.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add screen shots? It's the first thing readers look at before figuring out if they're interested in reading further

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think screenshots would be much better than sentences after sentences (for most readers like me). I will add some.

Click Pretrained Models tab, and select 'Retrieve from Model Store' under 'Load Model.'
The new page shows models available in model stores.

Hoover over the model name shows the complete text in Note field.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo hoover->hover

At the top directory, create a master.json file (if your server does not support directory listing).
The following is a sample master.json file.
```
{'msg':'This is my own model store server.', 'children':['Model01','Model02']}
Copy link
Contributor

@gheinrich gheinrich Oct 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be double quotes - otherwise it's not valid JSON and the parser silently fails (=> you don't see any models in your store)

{[ model.info.username ]}
</td>
<td>
<img ng-src="{[value.base_url+model.dir_name]}/logo.png" height="30" width="40"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is showing a broken image if the logo wasn't specified - better not show anything in that case

<tr ng-repeat="model in value.model_list | filter: query">
<td>
<div data-toggle="tooltip" title="{[model.info.note]}">
<a href="/store/push?id={[model.id]}"> {[ model.info.name ]} </a>
Copy link
Contributor

@gheinrich gheinrich Oct 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not entirely intuitive that clicking here will push the model - can we show an upload button?

{'msg':'This is my own model store server.', 'children':['Model01','Model02']}
```
Model01 and Model02 are subdirectories containing the actual models.
Each model must consist one weight file, one info.json file.
Copy link
Contributor

@gheinrich gheinrich Oct 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also mention that the file pointed to by model_file in info.json (e.g. original.protoxt) must be there.
otherwise a lot of things silently fail (network customization, ...)

@IsaacYangSLA
Copy link
Contributor Author

@gheinrich , really thank you for reviewing the codes and excellent comments. I just pushed the new commits to address each of your comment. Since there are lots of areas to improve, and to save some space, I didn't add my reply to each of your comments.

@gheinrich
Copy link
Contributor

Thanks @IsaacYangSLA this looks fine though it still feels like the model store is somewhat hidden and like @TimZaman I feel it would be nice to show progress notifications, when downloading large models.

@IsaacYangSLA
Copy link
Contributor Author

@gheinrich , I believed you also found importing a model took a long time. A progress notification will be really useful to users. I will create another PR for that after this is merged.

Copy link
Member

@lukeyeager lukeyeager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check your copyright years

@@ -0,0 +1,37 @@
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be just "2016"

@@ -0,0 +1,142 @@
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be just "2016"

@@ -0,0 +1,127 @@
{# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. #}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be just "2016"

@@ -0,0 +1,54 @@
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be just "2016"

@IsaacYangSLA
Copy link
Contributor Author

@lukeyeager , thanks a lot. To be honest, I didn't know the meaning of those years until you pointed them out. It's great to know more.

@IsaacYangSLA
Copy link
Contributor Author

I will merge this and later create another PR for adding the Python layer file support on importing part, which depends on this PR.

SlipknotTN pushed a commit to cynnyx/DIGITS that referenced this pull request Mar 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants