fastnlp / fastNLP

fastNLP: A Modularized and Extensible NLP Framework. Currently still in incubation.
https://gitee.com/fastnlp/fastNLP
Apache License 2.0
3.05k stars 451 forks source link

ImportError: cannot import name '_get_file_name_base_on_postfix' from 'fastNLP.modules.utils' #333

Closed ArlanCooper closed 3 years ago

ArlanCooper commented 3 years ago

调用的时候报错,请问一下这个是什么原因呢

yhcc commented 3 years ago

可以把完整代码贴一下吗?或者报错的这段代码?这个方法应该是不对外暴露的。

ArlanCooper commented 3 years ago

可以把完整代码贴一下吗?或者报错的这段代码?这个方法应该是不对外暴露的。

from fastNLP.core import logger from fastNLP.modules.utils import _get_file_name_base_on_postfix from utils import MyDropout from fastNLP.embeddings.contextual_embedding import ContextualEmbedding from fastNLP.embeddings.bert_embedding import _WordBertModel from fastNLP.io.file_utils import PRETRAINED_BERT_MODEL_DIR

这个是使用的https://github.com/LeeSureman/Flat-Lattice-Transformer 这个里面的 fastNLP_module.py代码写的时候需要调用这个方法,但是调用的时候出现了这个问题

yhcc commented 3 years ago

你是通过pip install fastNLP安装的fastNLP吗?建议重装一下fastNLP吧,先通过pip uninstall fastNLP卸载fastNLP;然后通过pip install git+https://github.com/fastnlp/fastNLP 安装一下最新版试一下。

ArlanCooper commented 3 years ago

你是通过pip install fastNLP安装的fastNLP吗?建议重装一下fastNLP吧,先通过pip uninstall fastNLP卸载fastNLP;然后通过pip install git+https://github.com/fastnlp/fastNLP 安装一下最新版试一下。

好的,我试试

ArlanCooper commented 3 years ago

你是通过pip install fastNLP安装的fastNLP吗?建议重装一下fastNLP吧,先通过pip uninstall fastNLP卸载fastNLP;然后通过pip install git+https://github.com/fastnlp/fastNLP 安装一下最新版试一下。

我安装最新的版本0.5.6不行,但是我按照邱老师的版本设置,安装0.5.0是可以的,现在没问题了。谢谢

hyperji commented 3 years ago

这样试试? from fastNLP.io.file_utils import _get_file_name_base_on_postfix

Aenchanteda commented 2 years ago

你是通过pip install fastNLP安装的fastNLP吗?建议重装一下fastNLP吧,先通过pip uninstall fastNLP卸载fastNLP;然后通过pip install git+https://github.com/fastnlp/fastNLP 安装一下最新版试一下。

我安装最新的版本0.5.6不行,但是我按照邱老师的版本设置,安装0.5.0是可以的,现在没问题了。谢谢

我一直不行,上网查0.5.0的源代码就没定义这个,只有0.6.0里面有啊。我运行的是V2