yongzhuo / Keras-TextClassification

中文长文本分类、短句子分类、多标签分类、两句子相似度(Chinese Text Classification of Keras NLP, multi-label classify, or sentence classify, long or short),字词句向量嵌入层(embeddings)和网络层(graph)构建基类,FastText,TextCNN,CharCNN,TextRNN, RCNN, DCNN, DPCNN, VDCNN, CRNN, Bert, Xlnet, Albert, Attention, DeepMoji, HAN, 胶囊网络-CapsuleNet, Transformer-encode, Seq2seq, SWEM, LEAM, TextGCN
https://blog.csdn.net/rensihui
MIT License
1.78k stars 405 forks source link

hyper_parameters.json NOT found #67

Closed tathanwu closed 3 years ago

tathanwu commented 3 years ago

Using TensorFlow backend. Traceback (most recent call last): File "C:/Users/ewuxtai/PycharmProjects/Keras-TextClassification-master/keras_textclassification/m01_FastText/predict.py", line 131, in pred_tet(path_test=path_baidu_qa_2019_valid, rate=1) # sample条件下设为1,否则训练语料可能会很少 File "C:/Users/ewuxtai/PycharmProjects/Keras-TextClassification-master/keras_textclassification/m01_FastText/predict.py", line 38, in pred_tet hyper_parameters = load_json(path_hyper_parameter) File "C:\Users\ewuxtai\PycharmProjects\Keras-TextClassification-master\keras_textclassification\data_preprocess\text_preprocess.py", line 136, in load_json with open(path, 'r', encoding='utf-8') as fj: FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/ewuxtai/PycharmProjects/Keras-TextClassification-master/keras_textclassification/data/model/fast_text/hyper_parameters.json'

yongzhuo commented 3 years ago

如果移动存储模型目录, 除了修改地址path_hyper_parameter,文件hyper_parameters.json里边的路径也需要修改

Yudezhi commented 3 years ago

Same issue here.

Yudezhi commented 3 years ago

Using TensorFlow backend. Traceback (most recent call last): File "C:/Users/ewuxtai/PycharmProjects/Keras-TextClassification-master/keras_textclassification/m01_FastText/predict.py", line 131, in pred_tet(path_test=path_baidu_qa_2019_valid, rate=1) # sample条件下设为1,否则训练语料可能会很少 File "C:/Users/ewuxtai/PycharmProjects/Keras-TextClassification-master/keras_textclassification/m01_FastText/predict.py", line 38, in pred_tet hyper_parameters = load_json(path_hyper_parameter) File "C:\Users\ewuxtai\PycharmProjects\Keras-TextClassification-master\keras_textclassification\data_preprocess\text_preprocess.py", line 136, in load_json with open(path, 'r', encoding='utf-8') as fj: FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/ewuxtai/PycharmProjects/Keras-TextClassification-master/keras_textclassification/data/model/fast_text/hyper_parameters.json'

Solved! first run python m01_FastText/train.py to generate related file. the file is saved into you envs location eg. envs/TF12/lib/python3.6/site-packages/keras_textclassification/data/model/fast_text/...