dongjun-lee / text-classification-models-tf Goto Github PK
View Code? Open in Web Editor NEWTensorflow implementations of Text Classification Models.
Tensorflow implementations of Text Classification Models.
data_utils.py function build_char_dataset
some seem not very reasonable:
when model = "char_cnn":
char_dict["<pad>"] = char_dict["<unk>"] = char_dict["a"] = 0 after onehot in char_cnn.py
when model = "vd_cnn":
char_dict["<pad>"] = char_dict["a"] = 0,
char_dict["<unk>"] = char_dict["b"] = 1
Have you test the SST-2 dataset ?
I have run word_cnn model on SST-2 dataset . Only get 0.38 accuracy. But the accuray is 0.45 in paper.
How to change the model to improve the accuracy? Is something wrong?
The word_rnn model can get 0.45 accuracy, why diff is so large?
Tensorflow 2.x
Python 3.7.3
Traceback (most recent call last):
File "train3.py", line 74, in
model = WordCNN(vocabulary_size, WORD_MAX_LEN, NUM_CLASS)
File "/home/migueltuxd/bucket4testingtpuss/TPU/text-classification-models-tf-master/cnn_models/word_cnn.py", line 54, in init
self.optimizer = tf.train.AdamOptimizer(self.learning_rate).minimize(self.loss, global_step=self.global_step)
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/optimizer.py", line 413, in minimize
name=name)
File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/optimizer.py", line 564, in apply_gradients
raise RuntimeError("Use _distributed_apply()
instead of "
RuntimeError: Use _distributed_apply()
instead of apply_gradients()
in a cross-replica context.
Shared too on stackoverflow:https://stackoverflow.com/questions/61704387/wordcnn-trouble-with-distributed-apply-and-apply-gradients
How can I get prediction results in test.py?
The implementation now only has accuracy, so it's hard to see precision, recall, f1, or the prediction itself.
每次卷积输入的都是input,第二次循环也是conv变量,这样第一次循环不是就用不上了?
find a error when train the att_rnn model
Machine: 4 * Tesla P100-PCIE-16GB, memory: 256G
ResourceExhaustedError (see above for traceback): OOM when allocating tensor of shape [563354,256] and type float [[Node: embeddings/Adam/Initializer/zeros = Const[dtype=DT_FLOAT, value=Tensor<type: float shape: [563354,256] values: [0 0 0]...>, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
It crashes in Tensorflow 1.4 with the error below:
Traceback (most recent call last):
File "train.py", line 47, in
model = VDCNN(alphabet_size, CHAR_MAX_LEN, NUM_CLASS)
File "text-classification-models-tf/cnn_models/vd_cnn.py", line 70, in init
tf.nn.softmax_cross_entropy_with_logits_v2(logits=self.logits, labels=y_one_hot))
AttributeError: module 'tensorflow.python.ops.nn' has no attribute 'softmax_cross_entropy_with_logits_v2'
how to predict for one sentence?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.