tuhinjubcse / alw3-acl2019 Goto Github PK
View Code? Open in Web Editor NEWPay "Attention'' to your Context when Classifying Abusive Language
Pay "Attention'' to your Context when Classifying Abusive Language
Hello, there is no dataset in this project code. Could you please send me a dataset? Thank you very much! My email is [email protected] .
Hi,author
I‘m now trying to use your model of context attention(AttLayer). When I tried to add it to my model, it can be compile but not fit.
This is my model:
inputs = Input(shape=(MAX_SENTENCE_LENGTH, ), dtype='int32')
embedding = Embedding(len(word_index)+1,
EMBEDDING_DIM,
weights=[embedding_weights])(inputs)
x = Bidirectional(LSTM(256, recurrent_dropout=0.35, return_sequences=True))(embedding)
att = AttLayer()(x)
output = Dense(2, activation='softmax')(att)
model = Model(inputs=inputs, outputs=output)
model.compile(loss='binary_crossentropy',
optimizer='adam',
metrics=['accuracy'])
model.summary()
model.fit(train_pad_data, labels,
batch_size=128,
epochs= 10,
callbacks=[early_stopping],
validation_data=(dev_pad_data, dev_labels))
The error message is as follows:
Train on 9000 samples, validate on 1000 samples
Epoch 1/10
Traceback (most recent call last):
File "", line 5, in
validation_data=(dev_pad_data, dev_labels))
File "D:\Anaconda3\lib\site-packages\keras\engine\training.py", line 1039, in fit
validation_steps=validation_steps)
File "D:\Anaconda3\lib\site-packages\keras\engine\training_arrays.py", line 199, in fit_loop
outs = f(ins_batch)
File "D:\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 2715, in call
return self._call(inputs)
File "D:\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 2675, in _call
fetched = self._callable_fn(*array_vals)
File "D:\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1439, in call
run_metadata_ptr)
File "D:\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 528, in exit
c_api.TF_GetCode(self.status.status))
InvalidArgumentError: Input to reshape is a tensor with 5760 values, but the requested shape requires a multiple of 512
[[{{node attention1_23/Reshape_3}}]]
I don't know how to solve this problem, I hope you can help me.
Thank you.
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.