Open MrZmj77 opened 1 year ago
IndexError Traceback (most recent call last) Cell In[1], line 42 36 import torch 38 # for example the verbalizer contains multiple label words in each class 39 # myverbalizer = SoftVerbalizer(tokenizer, plm, num_classes=4, 40 # label_words=["politics", "sports", "business", "technology"]) 41 # or without label words ---> 42 myverbalizer = SoftVerbalizer(tokenizer, plm, num_classes=4) 45 from openprompt import PromptForClassification 47 use_cuda = True
File ~/miniconda3/envs/pytorch/lib/python3.8/site-packages/openprompt-1.0.1-py3.8.egg/openprompt/prompts/soft_verbalizer.py:55, in SoftVerbalizer.init(self, tokenizer, model, classes, num_classes, label_words, prefix, multi_token_handler) 53 last_layer_full_name = [] 54 for i in range(max_loop): ---> 55 last_layer_name = [n for n,c in module.named_children()][-1] 56 last_layer_full_name.append(last_layer_name) 57 parent_module = module
IndexError: list index out of range
IndexError Traceback (most recent call last) Cell In[1], line 42 36 import torch 38 # for example the verbalizer contains multiple label words in each class 39 # myverbalizer = SoftVerbalizer(tokenizer, plm, num_classes=4, 40 # label_words=["politics", "sports", "business", "technology"]) 41 # or without label words ---> 42 myverbalizer = SoftVerbalizer(tokenizer, plm, num_classes=4) 45 from openprompt import PromptForClassification 47 use_cuda = True
File ~/miniconda3/envs/pytorch/lib/python3.8/site-packages/openprompt-1.0.1-py3.8.egg/openprompt/prompts/soft_verbalizer.py:55, in SoftVerbalizer.init(self, tokenizer, model, classes, num_classes, label_words, prefix, multi_token_handler) 53 last_layer_full_name = [] 54 for i in range(max_loop): ---> 55 last_layer_name = [n for n,c in module.named_children()][-1] 56 last_layer_full_name.append(last_layer_name) 57 parent_module = module
IndexError: list index out of range