-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
'list' object has no attribute 'embed' when trying to predict with pretrained model #294
Comments
Hi @iamyihwa,
|
Hello @tabergma
The code below:
|
Thanks! It does not matter which version you are using, we just need to know it so that we know where to look and how to reproduce the error (if needed). So please always state which branch you are working on. That helps us debugging :) The code itself looks good. Just one minor thing: We don't have any word embedding for |
I failed to reproduce the problem. As I don't have your Spanish dataset, I used the IMDB dataset (English) for training. I did not have any issues. Could you maybe try to simplify your problem and try again? Does the error still occur if you execute the following simplified code?
|
Thanks @tabergma I am uploading the dataset that had this problem I mentioned. For this, I had to change multi_label=True since it had multiple labels. Below are the train, valid, test sets. (Test set doesn't contain labels.)
|
Just for clarification: When training on this kind of dataset you are getting the error For me everything is fine. Here is what I have done:
I just trained for two epochs to speed up the process and afterwards I used the trained model to predict a test sentence:
Everything works fine. Thus, some more questions:
|
Hi @tabergma For the glove, yes i used the same commands to convert to the Gensim format. I am attaching here the screenshot of the error I get for the trained model. |
Try to parse a single sentence -> does that fix the error? |
It happens on some datasets and not on others .. for now, the only thing i see is the lack of test label (but not sure .. ) which i thought shouldn't be an issue .. @stefan-it It happens the same .. |
You should make sure, that your test dataset contains labels. Otherwise an error will be throw ( The error
|
However the best model that is saved, should be okay, because it is saved during training.
|
Can you please also share the output of |
mmhh... In the current master branch the
In the Can you please check in the source code you are using, if the |
You were right about the issues! instead of like in the master branch: What could be a good solution for situations like this?
|
Glad we found the issue! If you are working on different computers, you should make sure that all of them are working with the same version of flair, as we are still changing the code quite frequently. I would recommend that you use the latest flair release 0.3.2 or the latest version of the master branch and redo the training. Hope that helps! |
@tabergma Yes in fact I see it is important! You guys are developing very quickly ! Adding new features! Thanks a lot! I will check the most recent version, and will download the most up to date version and check added features! However, do you think there is any chance I could use an old version of git just for testing some old models that were trained with the old version? Some backward compatibility? Any ideas? |
You used version v0.2.0, thus you could checkout the old code by executing
Using either of the options should allow you to use the old models. However, keep in mind that the text classifier in version 0.2.0 is kind of buggy. We fixed quite some stuff with the next releases - which also included breaking changes, which results in no backward compatibility. So, I would really recommend you to use the latest version of flair for future experiments. |
Thanks @tabergma Previously I installed the master branch git clone ing the master branch and installing it later (because back then (Around August) pip install flair didn't give the most recent version) - It is discussed here . But now it seems pip install installs the most recent version (or from master branch)? There was a bit of mess (because i wasn't sure how I installed.. )
What is recommended way to use flair? How can I check the version that was installed with pip install?
Can I see these changes in versions? which changes were made? Just to be aware? I understand the quickest way to solve this would be to retrain. Also as I have mentioned above, some models that were trained with the old version is working with the newer version of flair! Yes I understand the quickest way to solve this issue now is to retrain! Thanks @tabergma |
We released already a couple of versions since our first version in July. You can find the latest version in pypi. Whenever we publish a new release, we also publish release notes, which can be found here. You can find all major changes (e.g. features, bug fixes, etc.) for the release in that list. So if you want to know what changed between two releases, please check our release notes. In general we recommend to install flair via If you installed flair via |
@iamyihwa Do you have more questions? Otherwise I would like to close the issue. |
Hi @tabergma sorry but it didn't work yet .. |
hi @tabergma I have realized that the version 0.2 of flair (installed from git) is different from v0.2.0-243-gabb72a0 that i installed though git repository. The thing is I made a couple of changes to the code, (not much, but just to add additional embeddings), so I downloaded git repository and used that one. So I made the prediction using (1) the result is returned Error I get with (2) is
I think I will just try to use local copy for this specific trained model, and next time take more care with it. I think it is amazing how fast you guys add to Flair recent advances, and answering questions to all who want to use Flair! I can close this case, if you want. |
Great to hear it is now working for you! Yes, the master branch might differ actually from the latest release as we from time to time merge directly into the master branch. Sorry for the confusion. I'll close the issue for now. Feel free to open a new issues if you have further questions. |
After training the TextClassifier Model, when I try to predict using that model, I get error that says
"'list' object has no attribute 'embed'".
When I type model.document_embeddings, there is the model there,
but somehow the model is not recognized as model ..
I have been looking at the code, but couldn't figure out what could have been the problem ..
The text was updated successfully, but these errors were encountered: