You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/01/12 14:57:32 UTC

[GitHub] astonzhang commented on a change in pull request #9394: text api changes

astonzhang commented on a change in pull request #9394: text api changes
URL: https://github.com/apache/incubator-mxnet/pull/9394#discussion_r161237994
 
 

 ##########
 File path: python/mxnet/text/embedding.py
 ##########
 @@ -88,18 +88,24 @@ def __init__(self, **kwargs):
         super(TokenEmbedding, self).__init__(**kwargs)
 
     @classmethod
-    def _get_pretrained_file_path_from_url(cls, url, embedding_root,
-                                           pretrained_file_name):
-        """Get the local path to the pre-trained token embedding file from url.
+    def _get_download_file_name(cls, pretrained_file_name):
+        return pretrained_file_name
 
+    @classmethod
+    def _get_pretrained_file_url(cls, pretrained_file_name):
+        repo_url = os.environ.get('MXNET_GLUON_REPO', C.APACHE_REPO_URL)
+        embedding_cls = cls.__name__.lower()
 
-        The pre-trained embedding file will be downloaded from url if it has not
-        been downloaded yet or the existing file fails to match its expected
-        SHA-1 hash.
-        """
+        url_format = '{repo_url}gluon/embeddings/{cls}/{file_name}'
+        return url_format.format(repo_url=repo_url,
+                                 cls=embedding_cls,
+                                 file_name=cls._get_download_file_name(pretrained_file_name))
 
+    @classmethod
+    def _get_pretrained_file(cls, embedding_root, pretrained_file_name):
 
 Review comment:
   I think this method name may be confusing: does the "pre-trained file" also cover a custom pre-trained file? How about def _get_pretrained_file_from_url

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services