You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to run the example notebook generate_text.ipynb. But ran into the following error.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
[<ipython-input-10-bc7211cfb8f8>](https://localhost:8080/#) in <cell line: 5>()
3
4 # Let's pass our prompt right back in, but this time using ALICE
----> 5 response = alice(prompt, classifier, endpoint_url, secret_key, mode="hate") # Switch mode to "hate" to generate hate
5 frames
[/usr/local/lib/python3.10/dist-packages/toxigen/utils.py](https://localhost:8080/#) in alice(prompt, classifier, endpoint_url, api_key, mode, num_to_generate, device)
5 language_model = ALICE(GPT3(endpoint_url=endpoint_url, apikey=api_key), classifier, mode, device="cpu")
6
----> 7 return [language_model(prompt) for _ in range(num_to_generate)]
8
9 def label_annotations(annotated):
[/usr/local/lib/python3.10/dist-packages/toxigen/utils.py](https://localhost:8080/#) in <listcomp>(.0)
5 language_model = ALICE(GPT3(endpoint_url=endpoint_url, apikey=api_key), classifier, mode, device="cpu")
6
----> 7 return [language_model(prompt) for _ in range(num_to_generate)]
8
9 def label_annotations(annotated):
[/usr/local/lib/python3.10/dist-packages/toxigen/language_models.py](https://localhost:8080/#) in __call__(self, prompt)
42
43 def __call__(self, prompt):
---> 44 return self.generate(prompt)
45
46 def generate(self, prompt):
[/usr/local/lib/python3.10/dist-packages/toxigen/language_models.py](https://localhost:8080/#) in generate(self, prompt)
49 else:
50 flag = 1
---> 51 return beam_search(prompt, self.language_model, self.classifier, flag, self.device)
[/usr/local/lib/python3.10/dist-packages/toxigen/alice.py](https://localhost:8080/#) in beam_search(prompt, language_model, classifier, mode, device, end_token, weights, num_beams, vocab_size, max_length, length_penalty)
126 full_names = [[list(x.keys()) for x in scores[i]] for i in range(num_beams)]
127 scores = [[list(x.values()) for x in scores[i]] for i in range(num_beams)]
--> 128 scores_ = torch.Tensor([[[omit_(full_names[i][0][j], scores[i][0][j], stops, prompt) for j in range(len(scores[i][0]))]] for i in range(num_beams)])
129 scores = scores_.view(num_beams * 1, vocab_size)
130 full_names = list(itertools.chain.from_iterable(list(itertools.chain.from_iterable(full_names))))
[/usr/local/lib/python3.10/dist-packages/toxigen/alice.py](https://localhost:8080/#) in <listcomp>(.0)
126 full_names = [[list(x.keys()) for x in scores[i]] for i in range(num_beams)]
127 scores = [[list(x.values()) for x in scores[i]] for i in range(num_beams)]
--> 128 scores_ = torch.Tensor([[[omit_(full_names[i][0][j], scores[i][0][j], stops, prompt) for j in range(len(scores[i][0]))]] for i in range(num_beams)])
129 scores = scores_.view(num_beams * 1, vocab_size)
130 full_names = list(itertools.chain.from_iterable(list(itertools.chain.from_iterable(full_names))))
IndexError: list index out of range
------------------------------------------------------------------------------------------------------------------------------------------------------------
Can you please tell me the how to resolve the error?
The text was updated successfully, but these errors were encountered:
I was trying to run the example notebook generate_text.ipynb. But ran into the following error.
Can you please tell me the how to resolve the error?
The text was updated successfully, but these errors were encountered: