Intra-Bag-and-Inter-Bag-Attentions icon indicating copy to clipboard operation
Intra-Bag-and-Inter-Bag-Attentions copied to clipboard

请教一下,有部分没看懂

Open Thoye opened this issue 5 years ago • 6 comments

请问extract.cpp里面的word2vec.txt,bags_train.txt,bags_test.txt 数据集里怎么没有这些文件? 还有我要换数据集的话,是不是还得处理成train.txt里面的格式?代码里好像没有处理成train.txt格式的过程。谢谢解答!

Thoye avatar Jun 11 '19 02:06 Thoye

先解压NYT_data.zip文件 unzip NYT_data/NYT_data.zip

ZhixiuYe avatar Jun 11 '19 03:06 ZhixiuYe

嗯嗯,是的解压了,就是自己 bash precess.sh 的时候,报错了,帮忙看看,谢谢! Init Begin. wordTotal= 114042 Word dimension= 50 preprocess.sh: line 2: 12694 Segmentation fault (core dumped) ./extract bags_train.txt Traceback (most recent call last): File "data2pkl.py", line 83, in data2pickle('bags_train.txt','train_temp.pkl',1) File "data2pkl.py", line 75, in data2pickle data = readData(input, mode) File "data2pkl.py", line 20, in readData f = codecs.open(filename, 'r') File "/home/mrc/anaconda3/envs/env3/lib/python3.6/codecs.py", line 895, in open file = builtins.open(filename, mode, buffering) FileNotFoundError: [Errno 2] No such file or directory: 'bags_train.txt' load test and train raw data... Traceback (most recent call last): File "pickledata.py", line 236, in testData = pickle.load(open('test_temp.pkl', 'rb'), encoding='utf-8') FileNotFoundError: [Errno 2] No such file or directory: 'test_temp.pkl' rm: cannot remove 'temp': No such file or directory

Thoye avatar Jun 11 '19 07:06 Thoye

extract.cpp中267行,fout.open(("word2id.txt"),ios::out);但是也没有这个word2id.txt文件。

Thoye avatar Jun 11 '19 07:06 Thoye

  1. 确定文件结构是下面这样的
Intra-Bag-and-Inter-Bag-Attentions
|-- figure
    |-- CNNmethods.pdf
    |-- PCNNmethods.pdf
|-- model
    |-- embedding.py
    |-- model_bagatt.py
    |-- pcnn.py
|-- NYT_data
    |-- relation2id.txt
    |-- test.txt
    |-- train.txt
    |-- vec.bin
|-- preprocess
    |-- data2pkl.py
    |-- extract.cpp
    |-- pickledata.py
    |-- preprocess.sh
|-- plot.py
|-- README.md
|-- train.py
  1. 在preprocess文件夹下执行的bash preprocess.sh cd preprocess; bash preprocess.sh; cd ..

ZhixiuYe avatar Jun 12 '19 09:06 ZhixiuYe

你可以单独运行extract.cpp文件获得那些pkl文件,再手动运行data2pkl和pkl2data就可以了

WoodPecker1111 avatar Jan 14 '20 15:01 WoodPecker1111

你可以单独运行extract.cpp文件获得那些pkl文件,再手动运行data2pkl和pkl2data就可以了

请问怎么单独运行呢,用什么?

Fengzhu-xu avatar Feb 03 '21 07:02 Fengzhu-xu