nlpaug icon indicating copy to clipboard operation
nlpaug copied to clipboard

Issue with Contextual Word Augmentor

Open rajat-tech-002 opened this issue 3 years ago • 1 comments

File "/workspace/system-paper/main_dsscc_hil.py", line 61, in main_dsscc_hil main_copy(p) File "/workspace/system-paper/main_copy_args.py", line 230, in main_copy contextual_augment(p, aug_percentage[p['dataset']]) File "/workspace/system-paper/contextual_augmenter.py", line 49, in contextual_augment aug_txt_2 = aug_2.augment(txt)
File "/opt/conda/lib/python3.6/site-packages/nlpaug/base_augmenter.py", line 98, in augment result = action_fx(clean_data) File "/opt/conda/lib/python3.6/site-packages/nlpaug/augmenter/word/context_word_embs.py", line 464, in substitute masked_text = self.model.get_tokenizer().convert_tokens_to_string(head_doc.get_augmented_tokens()).strip() AttributeError: 'list' object has no attribute 'strip'

rajat-tech-002 avatar Apr 05 '22 06:04 rajat-tech-002

I was able to solve the issue by downloading the repo and updating 1 line as follows: line 464 in https://github.com/makcedward/nlpaug/blob/master/nlpaug/augmenter/word/context_word_embs.py masked_text= self.model.get_tokenizer().convert_tokens_to_string(head_doc.get_augmented_tokens())[0].strip()

rajat-tech-002 avatar Apr 06 '22 09:04 rajat-tech-002