-
-
Notifications
You must be signed in to change notification settings - Fork 463
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
TypeError: list indices must be integers or slices, not str #243
Comments
makcedward
added
bug
Something isn't working
and removed
bug
Something isn't working
labels
Oct 18, 2021
makcedward
added a commit
that referenced
this issue
Oct 19, 2021
transformers changed interface from 4.11. You may either use transformers 4.10 or upgrading nlpaug to 1.1.8 |
Fixed in 1.1.8 version |
This still doesn't work for me. I tried with |
If anyone is interested, I made it work with:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The below code was working perfectly in pytorch 1.4 and python3.6
import nlpaug.augmenter.sentence as nas
aug = nas.ContextualWordEmbsForSentenceAug(model_path='xlnet-base-cased')
text= "Please find below some recent comparative data between the below product and ibrance"
augmented_texts = aug.augment(text, n=3)
---------------------------------------------- Error-----------------------------------------------------------
TypeError Traceback (most recent call last)
in
1 aug = nas.ContextualWordEmbsForSentenceAug(model_path='xlnet-base-cased')
2 text= "Please find below some recent comparative data between the below product and ibrance"
----> 3 augmented_texts = aug.augment(text, n=3)
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nlpaug/base_augmenter.py in augment(self, data, n, num_thread)
93 elif self.class.name in ['AbstSummAug', 'BackTranslationAug', 'ContextualWordEmbsAug', 'ContextualWordEmbsForSentenceAug']:
94 for _ in range(aug_num):
---> 95 result = action_fx(clean_data)
96 if isinstance(result, list):
97 augmented_results.extend(result)
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nlpaug/augmenter/sentence/context_word_embs_sentence.py in insert(self, data)
96 all_data = [data]
97
---> 98 return self.model.predict(all_data)
99
100 @classmethod
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nlpaug/model/lang_models/text_generation_transformers.py in predict(self, texts, target_words, n)
88 results.extend(predict_result)
89
---> 90 return [r['generated_text'] for r in results]
~/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/nlpaug/model/lang_models/text_generation_transformers.py in (.0)
88 results.extend(predict_result)
89
---> 90 return [r['generated_text'] for r in results]
TypeError: list indices must be integers or slices, not str
The text was updated successfully, but these errors were encountered: