fastnlp / fastNLP

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

找不到 ConfigSection和 ConfigLoader这两个类 #268

Closed jwc19890114 closed 4 years ago

jwc19890114 commented 4 years ago

Describe the bug A clear and concise description of what the bug is. 清晰而简要地描述bug 你好,在运行一个基于fastNLP的ESIM项目的时候发现有两个类找不到,不知道是不是已经做了修改啊 项目地址https://github.com/ming6383/ESIM 缺失的类名:from fastNLP.io.config_io import ConfigSection, ConfigLoader 我在文档里也没有查到这两个类

xuyige commented 4 years ago

关于ESIM模型及其训练代码可以参考

https://github.com/fastnlp/fastNLP/tree/master/reproduction/matching

ConfigSection与ConfigLoader应该是在旧版本中才有

jwc19890114 commented 4 years ago

关于ESIM模型及其训练代码可以参考

https://github.com/fastnlp/fastNLP/tree/master/reproduction/matching

ConfigSection与ConfigLoader应该是在旧版本中才有

您好,谢谢您的回复,提问的时候忘记贴那两个类的上下文了,想了解一下这两个类应该如何替换

from fastNLP.io.config_io import ConfigSection, ConfigLoader

if __name__ == "__main__":
    args = ConfigSection()
    ConfigLoader().load_config("../data/config.json", {"preprocess": args})
    train_data, dev_data, test_data = preprocess_nli_data(os.path.normpath(args["data_dir"]),
                                                          os.path.normpath(args["embeddings_file"]),
                                                          os.path.normpath(args["target_dir"]))
xuyige commented 4 years ago

关于ESIM模型及其训练代码可以参考 https://github.com/fastnlp/fastNLP/tree/master/reproduction/matching ConfigSection与ConfigLoader应该是在旧版本中才有

您好,谢谢您的回复,提问的时候忘记贴那两个类的上下文了,想了解一下这两个类应该如何替换

from fastNLP.io.config_io import ConfigSection, ConfigLoader

if __name__ == "__main__":
    args = ConfigSection()
    ConfigLoader().load_config("../data/config.json", {"preprocess": args})
    train_data, dev_data, test_data = preprocess_nli_data(os.path.normpath(args["data_dir"]),
                                                          os.path.normpath(args["embeddings_file"]),
                                                          os.path.normpath(args["target_dir"]))

在最新版本中,数据处理部分我们已经封装了对应的代码 以SNLI数据集为例

from fastNLP.io.pipe import SNLIBertPipe, SNLIPipe

data_bundle_bert = SNLIBertPipe(lower=True).process_from_file()
data_bundle = SNLIPipe(lower=True).process_from_file()

训练集、验证集、测试集数据已经被加载并转化为index 同时还有words词表和target词表