google colaboratory 에서 실행하였으나 실패하였습니다.
Opened this issue · 0 comments
ckdo8008 commented
PC (windows 10, i7-10700, ram: 32GB, Nvidia: GTX 1660 8GB) 에서 실패해서 환경이 문제인가 싶어서
google colaboratory도 프로로 구매해서 테스트 해봤지만 실패하였습니다.
사용 환경상 16기가 모델로 테스트 하였습니다.
테스트한 환경 정보 공유 부탁 드립니다.
여러번 실패한 중에 남아 있는 실패 로그도 공유합니다.
--------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
[<ipython-input-4-f4f7dc2d49ea>](https://localhost:8080/#) in <module>
1 prompt = """그러면 대화가 가능한 현존 최고 수준의 인공지능과의 인터뷰를 진행해보겠습니다. Q: 인공지능님 안녕하세요. 만나서 반갑습니다. 조코딩 구독자 분들에게 인사한번 부탁드립니다. A: """
----> 2 gpt(prompt)
10 frames
[<ipython-input-3-c1309a025c46>](https://localhost:8080/#) in gpt(prompt)
2 with torch.no_grad():
3 tokens = tokenizer.encode(prompt, return_tensors='pt').to(device='cpu', non_blocking=True)
----> 4 gen_tokens = model.generate(tokens, do_sample=True, temperature=0.8, max_length=256)
5 generated = tokenizer.batch_decode(gen_tokens)[0]
6
[/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py](https://localhost:8080/#) in decorate_context(*args, **kwargs)
26 def decorate_context(*args, **kwargs):
27 with self.__class__():
---> 28 return func(*args, **kwargs)
29 return cast(F, decorate_context)
30
[/usr/local/lib/python3.7/dist-packages/transformers/generation_utils.py](https://localhost:8080/#) in generate(self, input_ids, max_length, min_length, do_sample, early_stopping, num_beams, temperature, top_k, top_p, repetition_penalty, bad_words_ids, bos_token_id, pad_token_id, eos_token_id, length_penalty, no_repeat_ngram_size, encoder_no_repeat_ngram_size, num_return_sequences, max_time, max_new_tokens, decoder_start_token_id, use_cache, num_beam_groups, diversity_penalty, prefix_allowed_tokens_fn, output_attentions, output_hidden_states, output_scores, return_dict_in_generate, forced_bos_token_id, forced_eos_token_id, remove_invalid_values, synced_gpus, **model_kwargs)
1025 return_dict_in_generate=return_dict_in_generate,
1026 synced_gpus=synced_gpus,
-> 1027 **model_kwargs,
1028 )
1029
[/usr/local/lib/python3.7/dist-packages/transformers/generation_utils.py](https://localhost:8080/#) in sample(self, input_ids, logits_processor, stopping_criteria, logits_warper, max_length, pad_token_id, eos_token_id, output_attentions, output_hidden_states, output_scores, return_dict_in_generate, synced_gpus, **model_kwargs)
1533 return_dict=True,
1534 output_attentions=output_attentions,
-> 1535 output_hidden_states=output_hidden_states,
1536 )
1537
[/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py](https://localhost:8080/#) in _call_impl(self, *input, **kwargs)
1069 input = bw_hook.setup_input_hook(input)
1070
-> 1071 result = forward_call(*input, **kwargs)
1072 if _global_forward_hooks or self._forward_hooks:
1073 for hook in itertools.chain(
[/usr/local/lib/python3.7/dist-packages/transformers/models/gptj/modeling_gptj.py](https://localhost:8080/#) in forward(self, input_ids, past_key_values, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict)
783 output_attentions=output_attentions,
784 output_hidden_states=output_hidden_states,
--> 785 return_dict=return_dict,
786 )
787 hidden_states = transformer_outputs[0]
[/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py](https://localhost:8080/#) in _call_impl(self, *input, **kwargs)
1069 input = bw_hook.setup_input_hook(input)
1070
-> 1071 result = forward_call(*input, **kwargs)
1072 if _global_forward_hooks or self._forward_hooks:
1073 for hook in itertools.chain(
[/usr/local/lib/python3.7/dist-packages/transformers/models/gptj/modeling_gptj.py](https://localhost:8080/#) in forward(self, input_ids, past_key_values, attention_mask, token_type_ids, position_ids, head_mask, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)
574
575 if inputs_embeds is None:
--> 576 inputs_embeds = self.wte(input_ids)
577
578 hidden_states = inputs_embeds
[/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py](https://localhost:8080/#) in _call_impl(self, *input, **kwargs)
1049 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1050 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051 return forward_call(*input, **kwargs)
1052 # Do not call functions when jit is used
1053 full_backward_hooks, non_full_backward_hooks = [], []
[/usr/local/lib/python3.7/dist-packages/torch/nn/modules/sparse.py](https://localhost:8080/#) in forward(self, input)
158 return F.embedding(
159 input, self.weight, self.padding_idx, self.max_norm,
--> 160 self.norm_type, self.scale_grad_by_freq, self.sparse)
161
162 def extra_repr(self) -> str:
[/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py](https://localhost:8080/#) in embedding(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse)
2041 # remove once script supports set_grad_enabled
2042 _no_grad_embedding_renorm_(weight, input, max_norm, norm_type)
-> 2043 return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
2044
2045
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking arugment for argument index in method wrapper_index_select)
감사합니다.