text2code安装

浏览: 1366

1. 下载安装

git clone https://github.com/deepklarity/jupyter-text2code.git
cd jupyter-text2code
pip install .

2. 打开jupyter notebook

jupyter notebook
  • If installation happened successfully, then for the first time, Universal Sentence Encoder model will be downloaded from tensorflow_hub.

3. 解决下载Universal Sentence Encoder超时

但是文件很大 https://tfhub.dev/google/universal-sentence-encoder/4 报超时错误,因此要下载到本地先

下载后,保存本地位置设置如下:

import hashlib
import os

os.environ["TFHUB_CACHE_DIR"] = '/home/jordan/.cache/tfhub_modules'

handle = "https://tfhub.dev/google/universal-sentence-encoder/4"
hashlib.sha1(handle.encode("utf8")).hexdigest()

063d866c06683311b44b4992fd46003be952409c


/home/jordan/.cache/tfhub_modules/ # your cache directory
/f002061d9dee6acda3f90d591a65dbab7627f665/ # a module folder
/assets/
/variables/
/saved_model.pb
/tfhub_module.pb


"tfhub_module.pb; No such file or directory"错误

v1有,v2之后tfhub_module.pb就取消了


4. Nbextensions中选中mopp




参考:

https://medium.com/@xianbao.qian/how-to-run-tf-hub-locally-without-internet-connection-4506b850a915

https://github.com/deepklarity/jupyter-text2code

推荐 0
本文由 safa 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。

0 个评论

要回复文章请先登录注册