-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Model store #1077
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 | ||
} | ||
|
||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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/'] |
There was a problem hiding this comment.
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"> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem.
There was a problem hiding this 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', |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
I have some trouble setting the custom URL. I do this: Then in So
|
@TimZaman , my bad. The prompt portion of store codes was broken. I rewrote that portion and it should work now. |
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)')] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.
There was a problem hiding this 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. |
There was a problem hiding this comment.
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 :-)
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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']} |
There was a problem hiding this comment.
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"/> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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, ...)
@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. |
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. |
@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. |
There was a problem hiding this 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. #} |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be just "2016"
@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. |
I will merge this and later create another PR for adding the Python layer file support on importing part, which depends on this PR. |
Depends on #1048, will rebase/squash later after #1048 is merged.