nikicc / twitter-emotion-recognition

Models for predicting emotions from English tweets.
GNU Affero General Public License v3.0
163 stars 68 forks source link

ValueError: Optimizer weight shape (6,) not compatible with provided weight shape (800, 6) #3

Open ShreyaKhare opened 7 years ago

ShreyaKhare commented 7 years ago

I get this error when i try to load an existing model.

nikicc commented 7 years ago

Can you please paste the whole stack trace? Also are you on Keras version 1?

ShreyaKhare commented 7 years ago

Can you specifiy tensorflow and keras version that was used for training

nikicc commented 6 years ago

We only used Theano, no Tensorflow. I think most experiments were run on Theano 0.8.2.

ghost commented 6 years ago

I have Keras installed. Can I use Keras here to implement the codes?

nikicc commented 6 years ago

Can I use Keras here to implement the codes?

@HangsunKim not sure I understand the question. You need keras==1.1.0 and pandas installed, as stated in requirements.txt. After that, you should be able to run the code. Check the example of usage.

ghost commented 6 years ago

@nikicc Thanks for your reply. I have the pandas and keras library installed. I've always done deep learning by importing keras, as tensforflow as the backend. I think then I'll be able to run the codes then. I asked this question because you somewhere indicated that the codes are run on theano. That was my concern.

nikicc commented 6 years ago

I asked this question because you somewhere indicated that the codes are run on theano.

Yes, the models were trained using Keras with Theano backend. I'm not sure if the models can be loaded and used with Tensorflow for not. Let me know if this will work for you on Tensorflow.

ghost commented 6 years ago

@nikicc I'm trying to run the demo codes with Theano as backend. I found a way to change the backend engine easily from Tensorflow to Theano. But, when I run the first line of codes. I get this error, ImportError: No module named html

Do you know what could be wrong and how I could fix this? Thanks in advance.

nikicc commented 6 years ago

I get this error, ImportError: No module named html

Are you sure you're on Python 3? html is a standard Python's library.

ghost commented 6 years ago

@nikicc Oh, I was using python 2.7. Okay, so I tried on python 3.6, but now I get the error ModuleNotFoundError: No module named 'theano'. Do I just do "pip install theano" in my command prompt?

nikicc commented 6 years ago

Do I just do "pip install theano" in my command prompt?

To be sure, use the same version of Theano that I did: pip install theano==0.8.2 should do it.

ghost commented 6 years ago

@nikicc Thanks, I installed theano 0.8.2 but now I get the below error. Are you familiar with this error? . collect2.exe: error: ld returned 1 exit status status=1): C:\Users\Anaconda3\libs/python36.lib: error adding symbols: File in wrong format

nikicc commented 6 years ago

@HangsunKim no idea what that error is about, sorry.

ghost commented 6 years ago

@nikicc It's okay.. I'm in Python 3.6. May I know which python version you are using? Thanks.

nikicc commented 6 years ago

I think I was on 3.6 as well.

ghost commented 6 years ago

I now get this error. ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("embedding_1/random_uniform:0", shape=(412, 25), dtype=float32)' I was wondering if you know this error. I referred to https://github.com/keras-team/keras/issues/7460. However, there's no clear solution to it..

nikicc commented 6 years ago

Don't know. Are you sure you are on keras==1.1.0?

SidShenoy commented 6 years ago

Hey! @HangsunKim Finally solved this issue. Follow these steps:

  1. Only install the packages mentioned in requirements.txt (with the exact same versions) and no other package (like tensorflow). Uninstall tensorflow if already installed.

  2. Change the backend of 'keras' from 'tensorflow' to 'theano'. Instructions to do this have been mentioned on the 'keras' website (https://keras.io/backend/):

image

Cheers!

nikicc commented 6 years ago

@SidShenoy thanks for posting this!

jhaozz commented 6 years ago

I couldn't install the version, any problem? it says 'could not find a version that satisfies the requirement emotion_predictor (from versions: ) No matching distribution found for emotion_predictor.'

venkatshan707 commented 5 years ago

sir please give where i want to run the following code : in jupiter notebook or anaconda prompt

venkatshan707 commented 5 years ago

these codes:

from emotion_predictor import EmotionPredictor

model = EmotionPredictor(classification='ekman', setting='mc')

tweets = [ "Watching the sopranos again from start to finish!", "Finding out i have to go to the dentist tomorrow", "I want to go outside and chalk but I have no chalk", "I HATE PAPERS AH #AH #HATE", "My mom wasn't mad", "Do people have no Respect for themselves or you know others peoples homes", ]

venkatshan707 commented 5 years ago

screenshot 320 screenshot 321

venkatshan707 commented 5 years ago

i got those errors while running through jupitter notebook

nikicc commented 5 years ago

@venkatshan707 seem like the issue is in the backend your Keras is trying to use. According to the above screenshots your Keras wants to invoke a tensorflow backend, while you will need to use theano backend to use the emotion predictiors from this repository. More precisely, you'll need theano==0.8.2 (see the requirements file). Check this page in the Keras documentation to figure out how to switch to theano backend.

venkatshan707 commented 5 years ago

Sir,after setting a background from where we want to start our code execution.I am just started to learn(very beginner) data science.I am doing my final year project with your code. I failed to execute your code. Can you please,send user manual of that code execution (or) please,teach me how we want to execute our code in step by step manner using TeamViewer or anydesk.please I tried my level best.please help me sir.

On Sun 17 Feb, 2019, 6:18 PM nikicc, notifications@github.com wrote:

@venkatshan707 https://github.com/venkatshan707 seem like the issue is in the backend your Keras is trying to use. According to the above screenshots your Keras wants to invoke a tensorflow backend, while you will need to use theano backend to use the emotion predictiors from this repository. More precisely, you'll need theano==0.8.2 (see the requirements file https://github.com/nikicc/twitter-emotion-recognition/blob/master/requirements.txt). Check this page in the Keras documentation https://keras.io/backend/ to figure out how to switch to theano backend.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nikicc/twitter-emotion-recognition/issues/3#issuecomment-464452975, or mute the thread https://github.com/notifications/unsubscribe-auth/AddwCAKf66gQo36Pnfa1XOOCIGFhg_NBks5vOU-mgaJpZM4PoL1R .

nikicc commented 5 years ago

@venkatshan707 if you set the backend up, then you should be able to start the code either from Jupiter or python script. What is the error you are seeing now after the backend has been set?

Sorry but I don't have any user manual I could share with you.

venkatshan707 commented 5 years ago

sir ,can you please help me with teamviewer .

venkatshan707 commented 5 years ago

just 10 mins

nikicc commented 5 years ago

@venkatshan707 I think it's easier if we keep the communication here. What is the error you are seeing now?

drcs8283 commented 4 years ago

how to import emotion predicator module...

nikicc commented 4 years ago

@chandrasekhar8283 see https://github.com/nikicc/twitter-emotion-recognition#example-usage

Mounika2825 commented 4 years ago

how to import emotion predicator module... i found this error while importing ModuleNotFoundError: No module named 'emotion_predictor'

nikicc commented 4 years ago

@Mounika2825 are you in the correct folder when executing your code? The example assumes you are in the same folder where the emotion_predictor.py file is.

Mounika2825 commented 4 years ago

@nikicc Thanks a lot.. i executed the code.... Can i get accuracy by using this code ?

Mounika2825 commented 4 years ago

how can i implement this code in google colab?

nikicc commented 4 years ago

@Mounika2825 the current code does not support calculating the accuracy. You would need to implement that yourself. Also, not sure about the google colab.

Mounika2825 commented 4 years ago

How can i get accuracy by using models of unison

nikicc commented 4 years ago

@Mounika2825 not sure which accuracy are you interested in. If you want to know the accuracy of the models as we estimated it, look at the paper for more details; but approximately the accuracy is around 70%. If you want to know the accuracy of the model on your own data set, then you'd need to calculate that yourself.