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

Bug report:DataSet经过copy_field后进行切片,发现新field丢失 #387

Closed TraceIvan closed 2 years ago

TraceIvan commented 2 years ago

Describe the bug 我对DataSet进行copy_field,将'chars'列copy一份为‘words’,然后设定'words'列为input。之后对该DataSet进行切片,发现切片后的结果'words'列丢失,且'chars'列变为input。

To Reproduce

train_dataset.copy_field('chars','words')
train_dataset.set_input('words','seq_len','target')
train_dataset.set_input('lattice','pos_s','pos_e',flag=False)
train_dataset.set_target('target','seq_len')
train_dataset.print_field_meta()
train_dataset[:1].print_field_meta()

Expected behavior 期望train_dataset切片后结果'words'列仍保留,且作为input的列和切片前相同。

Screenshots 微信截图_20211014111809

Desktop (please complete the following information):

yhcc commented 2 years ago

谢谢您的反馈,我们已经在dev分支解决了这个bug。您可以通过pip uninstall fastNLP先卸载已有的fastNLP,然后再通过pip install git+http://github.com/fastnlp/fastNLP@dev安装最新的fastNLP

yhcc commented 2 years ago

或者现在也可以通过pip install fastNLP -U来升级到最新的fastNLP

TraceIvan commented 2 years ago

感谢~