Repository: dmlc/gluon-nlp

Issue:
nlp.model.list_models(), nlp.data.list_datasets()
## Description
We have a lot of pre-trained models and hosted datasets in gluonnlp. Currently the only way to discover them is via the API documentation. It would be great to have APIs to query the list of models and datasets available. The list is already maintained in the code anyways. 


Discussion:

Resolving patch:
diff --git a/src/gluonnlp/model/__init__.py b/src/gluonnlp/model/__init__.py
--- a/src/gluonnlp/model/__init__.py
+++ b/src/gluonnlp/model/__init__.py
@@ -71,7 +71,7 @@
                convolutional_encoder, elmo, highway, language_model,
                lstmpcellwithclip, parameter, sampled_block,
                seq2seq_encoder_decoder, sequence_sampler, train, transformer,
-               utils)
+               utils, info)
 from .attention_cell import *
 from .bert import *
 from .bilm_encoder import BiLMEncoder
@@ -88,13 +88,14 @@
 from .transformer import *
 from .translation import *
 from .utils import *
+from .info import *
 from ..base import get_home_dir
 
 __all__ = (language_model.__all__ + sequence_sampler.__all__ + attention_cell.__all__ +
            utils.__all__ + parameter.__all__ + block.__all__ + highway.__all__ +
            convolutional_encoder.__all__ + sampled_block.__all__ + bilm_encoder.__all__ +
            lstmpcellwithclip.__all__ + elmo.__all__ + seq2seq_encoder_decoder.__all__ +
-           transformer.__all__ + bert.__all__ + ['train', 'get_model'])
+           transformer.__all__ + bert.__all__ + info.__all__ + ['train', 'get_model'])
 
 
 def get_model(name, **kwargs):
diff --git a/src/gluonnlp/model/info.py b/src/gluonnlp/model/info.py
new file mode 100644
--- /dev/null
+++ b/src/gluonnlp/model/info.py
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""API to get list of pretrained models"""
+__all__ = ['list_models']
+
+from . import (bert, bilm_encoder, elmo, language_model,
+               transformer)
+
+
+def list_models():
+    """Returns the list of pretrained models
+    """
+    models = (bert.__all__ + bilm_encoder.__all__ + elmo.__all__ +
+              language_model.__all__ + transformer.__all__)
+
+    return models


Test patch:
diff --git a/tests/unittest/test_info.py b/tests/unittest/test_info.py
new file mode 100644
--- /dev/null
+++ b/tests/unittest/test_info.py
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+import sys
+import warnings
+
+import gluonnlp as nlp
+
+def test_get_models():
+    models = nlp.model.list_models()
+    assert len(models)!=0