xlxwalex / FCGEC

The Corpus & Code for EMNLP 2022 paper "FCGEC: Fine-Grained Corpus for Chinese Grammatical Error Correction" | FCGEC中文语法纠错语料及STG模型
https://aclanthology.org/2022.findings-emnlp.137
Apache License 2.0
104 stars 12 forks source link

在使用checkpoint时,遇到了缺少test.csv的报错 #9

Closed GuWeiCi256 closed 1 year ago

GuWeiCi256 commented 1 year ago

我的运行指令是这样的: python joint_evaluate.py --mode test --gpu_id 0 --seed 2023 --checkpoints checkpoints --checkp joint_mode --export stg_joint_test.xlsx --data_base_dir dataset --max_generate 5 --lm_path model/pretrained-models/roberta-base-chinese --batch_size 32

报错如下: Traceback (most recent call last): File "joint_evaluate.py", line 134, in evaluate(args) File "joint_evaluate.py", line 44, in evaluate switch_test = SwitchDataset(args, test_dir, 'test') File "/workspace/ceph-rbd/mwz/FCGEC-main/model/STG-correction/DataProcessor/SwitchDataset.py", line 22, in init self.sentences, self.label = self._read_csv(path) File "/workspace/ceph-rbd/mwz/FCGEC-main/model/STG-correction/DataProcessor/SwitchDataset.py", line 29, in _read_csv data = np.array(pd.read_csv(path, encoding='ISO-8859-1')) File "/opt/conda/lib/python3.8/site-packages/pandas/io/parsers.py", line 688, in read_csv return _read(filepath_or_buffer, kwds) File "/opt/conda/lib/python3.8/site-packages/pandas/io/parsers.py", line 454, in _read parser = TextFileReader(fp_or_buf, kwds) File "/opt/conda/lib/python3.8/site-packages/pandas/io/parsers.py", line 948, in init self._make_engine(self.engine) File "/opt/conda/lib/python3.8/site-packages/pandas/io/parsers.py", line 1180, in _make_engine self._engine = CParserWrapper(self.f, self.options) File "/opt/conda/lib/python3.8/site-packages/pandas/io/parsers.py", line 1993, in init src = open(src, "rb") FileNotFoundError: [Errno 2] No such file or directory: 'dataset/test.csv'

请问这个文件是要自行构建么?如果是,结构应该是怎么样的呢,我看好像有一个sentences,一个label的样子,有更详细的介绍么,或者能否提供一下test.csv文件呢,麻烦了

xlxwalex commented 1 year ago

您好, 在测试前您需要先对数据进行处理,处理代码可直接使用 run_stg_joint.sh 中的STEP1部分命令:利用preprocess_data.py及其参数来构造.csv文件。

若您在处理时遇到问题,欢迎回复!

GuWeiCi256 commented 1 year ago

按照您的方法已经解决了,非常感谢

xlxwalex commented 1 year ago

不客气 :)