Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to train or eval? #2

Open
berli opened this issue Jan 11, 2018 · 1 comment
Open

how to train or eval? #2

berli opened this issue Jan 11, 2018 · 1 comment

Comments

@berli
Copy link

berli commented Jan 11, 2018

`u@u-VirtualBox:~/sentiment_analysis_textcnn/textcnn$ python train.py

Parameters:
ALLOW_SOFT_PLACEMENT=True
BATCH_SIZE=64
CHECKPOINT_EVERY=100
DEV_SAMPLE_PERCENTAGE=0.1
DROPOUT_KEEP_PROB=0.5
EMBEDDING_DIM=128
EVALUATE_EVERY=50
FILTER_SIZES=2,3,4
L2_REG_LAMBDA=0.0
LOG_DEVICE_PLACEMENT=False
NUM_CHECKPOINTS=5
NUM_EPOCHS=10
NUM_FILTERS=128
TRAIN_DATA_FILE=../data/cutclean_label_corpus10000.txt
TRAIN_LABEL_DATA_FILE=
W2V_FILE=../data/vectors.bin

Loading data...
Traceback (most recent call last):
File "train.py", line 226, in
train(w2v_wr.model)
File "train.py", line 93, in train
x_train, x_dev, y_train, y_dev ,vocab_size= load_data(w2v_model)
File "train.py", line 54, in load_data
x_text, y = data_helpers.load_data_and_labels(FLAGS.train_data_file)
File "/home/u/sentiment_analysis_textcnn/textcnn/data_input_helper.py", line 76, in load_data_and_labels
with open(filepath, 'r', encoding='utf-8',errors='ignore') as f:
TypeError: file() takes at most 3 arguments (4 given)`` eval
u@u-VirtualBox:~/sentiment_analysis_textcnn/textcnn$ python eval.py

Parameters:
ALLOW_SOFT_PLACEMENT=True
BATCH_SIZE=64
CHECKPOINT_DIR=./runs/1501842714/checkpoints/
EVAL_TRAIN=True
LOG_DEVICE_PLACEMENT=False
VALID_DATA_FILE=../data/cutclean_label_corpus10000.txt
W2V_FILE=../data/vectors.bin

2018-01-11 10:02:53.954545: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2018-01-11 10:02:53.954615: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2018-01-11 10:02:53.954634: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "eval.py", line 107, in
eval(w2v_wr.model)
File "eval.py", line 68, in eval
saver = tf.train.import_meta_graph("{}.meta".format(checkpoint_file))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1679, in import_meta_graph
meta_graph_def = meta_graph.read_meta_graph_file(meta_graph_or_file)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/meta_graph.py", line 402, in read_meta_graph_file
raise IOError("File %s does not exist." % filename)
IOError: File None.meta does not exist.

`

@JasonLiuys
Copy link

`u@u-VirtualBox:~/sentiment_analysis_textcnn/textcnn$ python train.py

Parameters:
ALLOW_SOFT_PLACEMENT=True
BATCH_SIZE=64
CHECKPOINT_EVERY=100
DEV_SAMPLE_PERCENTAGE=0.1
DROPOUT_KEEP_PROB=0.5
EMBEDDING_DIM=128
EVALUATE_EVERY=50
FILTER_SIZES=2,3,4
L2_REG_LAMBDA=0.0
LOG_DEVICE_PLACEMENT=False
NUM_CHECKPOINTS=5
NUM_EPOCHS=10
NUM_FILTERS=128
TRAIN_DATA_FILE=../data/cutclean_label_corpus10000.txt
TRAIN_LABEL_DATA_FILE=
W2V_FILE=../data/vectors.bin

Loading data...
Traceback (most recent call last):
File "train.py", line 226, in
train(w2v_wr.model)
File "train.py", line 93, in train
x_train, x_dev, y_train, y_dev ,vocab_size= load_data(w2v_model)
File "train.py", line 54, in load_data
x_text, y = data_helpers.load_data_and_labels(FLAGS.train_data_file)
File "/home/u/sentiment_analysis_textcnn/textcnn/data_input_helper.py", line 76, in load_data_and_labels
with open(filepath, 'r', encoding='utf-8',errors='ignore') as f:
TypeError: file() takes at most 3 arguments (4 given) eval ``
u@u-VirtualBox:~/sentiment_analysis_textcnn/textcnn$ python eval.py

Parameters:
ALLOW_SOFT_PLACEMENT=True
BATCH_SIZE=64
CHECKPOINT_DIR=./runs/1501842714/checkpoints/
EVAL_TRAIN=True
LOG_DEVICE_PLACEMENT=False
VALID_DATA_FILE=../data/cutclean_label_corpus10000.txt
W2V_FILE=../data/vectors.bin

2018-01-11 10:02:53.954545: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2018-01-11 10:02:53.954615: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2018-01-11 10:02:53.954634: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "eval.py", line 107, in
eval(w2v_wr.model)
File "eval.py", line 68, in eval
saver = tf.train.import_meta_graph("{}.meta".format(checkpoint_file))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/saver.py", line 1679, in import_meta_graph
meta_graph_def = meta_graph.read_meta_graph_file(meta_graph_or_file)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/meta_graph.py", line 402, in read_meta_graph_file
raise IOError("File %s does not exist." % filename)
IOError: File None.meta does not exist.

`

把第22行的
tf.flags.DEFINE_string("checkpoint_dir", "./runs/1553516157/checkpoints/", "Checkpoint directory from training run")
路径改成你自己的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants