Error 15

[Error] wget 윈도우 / wget : command not found

리눅스의 wget 명령어를 윈도우에도 쓰고 싶은데...! (git bash terminal 에서도 당연하다면 당연히 기본적으로는 wget 명령어를 사용할 수 없습니다.) 1. 사이트로 이동합니다 https://eternallybored.org/misc/wget/ GNU Wget 1.21.3 for Windows eternallybored.org 2. 1.20.3 64bit exe file을 다운받습니다.(win 10 기준) 3. C:\Windows\System32 아래 다운받은 wget file을 가져다 놓습니다. 4. 완료~ 테스트로 wget을 이용하여 다운받아봅니다 (환경변수 설정하는 방식도 있지만... 이것이 가장 편한것 같습니다.)

Error 2022.11.18

RuntimeError: Function MmBackward returned an invalid gradien

순전파는 잘 나와서 loss 값까지 잘 얻어지는데... RuntimeError: Function MmBackward returned an invalid gradien~~~~ 뭐라고 뜨면서 autograd가 문제가 생기는 현상이 있습니다. 3주동안 이것저것 다건드려봤는데 결국... pytorch 1.9.0이하의 문제라서 1.9.1 + cu111 설치했더니 바로 해결... https://discuss.pytorch.org/t/mmbackward-returned-an-invalid-gradient-at-index-0/132956 MmBackward returned an invalid gradient at index 0? I’m collecting two different measures of loss and ..

Error 2022.09.16

[python] keyboard module (left/right/up/down)

다음 방식으로 keyboard module에서 많은 예제는 키보드 문자를 입력했을 때 판별하여 true/false를 return합니다 import keyboard if keyboard.read_key() == "p": print('p') ....... 하지만 키보드 화살표를 입력하고싶을때는 어떻게 해야할까요? import keyboard if keyboard.read_key() == "down": print("down") if keyboard.read_key() == "up": print("up") if keyboard.read_key() == "left": print("left") if keyboard.read_key() == "right": print("right") 직관적으로 좌,우,위,아래를 영어..

Error 2022.04.22

[Python] *args에 대한 고찰

함수(*args) 에 대한 설명입니다. 1. *(args)의 기본 사용. *args, 혹은 *(아스타리스크) + 자유 변수명 를 함수의 input으로 넣어 주면 함수는 input에 들어오는 인자들을 전부 받아줍니다. def aa(*args): print(*args) aa(1,2,'삼') >> 1 2 삼 aa(1,2,'삼','사오') >> 1 2 삼 사오 aa라는 함수에 들어간 인자들이 전부 받아지고 함수 내부는 이들 결과를 전부 튜플로 묶어서 받아줍니다 2. 내가 넣고 싶은 변수와 *arg를 함께 쓰고 싶을때 아래와 같은 예시입니다 def aa(epoch, *args): print(epoch) print(*args) aa(1,2,'삼') >>1 2 삼 epoch / 나머지 input들의 묶음 으로 변수가..

Error 2022.03.03

[Pytorch] RuntimeError: Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead.

RuntimeError: Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead. 문제상황 : test때 gpu의 모델 추론값을 .cpu().numpy()을 통해 바꾸어 주려니 생기는 문제. 이유 : 위와 같은 상태로는 trainable tensor기 때문에 tensor를 non-trainable 상태로 바꾸어 놓고 numpy로 보내야한다. 해결방법 : vid_emb=vid_emb.cpu().detach().numpy() 설명 : vid_emb 가 모델을 통해 infer된 tensor입니다. numpy 연산을 위해 gpu > cpu로 보낸 후 .detach()를 통해 학습하지않는 텐서 형태로 바꾸어 줍니다. 이..

Error 2022.02.26

[Pytorch] Resnet custom layer training / getting

문제: pretrained된 resnet의 뒷부분을 잘라내고 custom layer를 넣거나 그 잘라냈을때까지의 결과를 얻고싶습니다 해결:https://discuss.pytorch.org/t/how-to-delete-layer-in-pretrained-model/17648/40 How to delete layer in pretrained model? I was wondering why the output for these two code is different? 1) resnet50 = models.resnet50(pretrained=True) resnet50.fc = Identity() resnet50.avgpool = Identity() output = resnet50(torch.randn(1, 3,..

Error 2022.02.02

[Error] Pytorch RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got CUDAType instead

문제상황 : 모델이나 데이터가 일부는 cpu에, 일부는 gpu에 올라가있어서 연산이 안되는 문제 출력 Pytorch RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got CUDAType instead 해결방법 : cuda에 모델 혹은 데이터를 잘 올렸는지 모델/데이터를 다 확인한다. .cuda()를 통해 처리할 수 있는데 이게 가끔 tensor들을 덜올리고 처리하는 경우 (꼼꼼하지 못하면 굉장히 자주) 발생하게 된다...

Error 2022.01.31

[Pytorch] RuntimeError: Input and parameter tensors are not at the same device, found input tensor at cuda:0 and parameter tensor at cpu

RuntimeError: Input and parameter tensors are not at the same device, found input tensor at cuda:0 and parameter tensor at cpu 결론은 input과 parameter tensor가 cpu / gpu에 나눠서 들어가있다는것이다. 나의 실수는 모델을 수정하면서 data는 gpu에 올려놓고 수정한 모델은 gpu에 올려놓지 않아서 rnn cell 돌릴때 default로 cpu로 잡혀서 두개의 공간이 다르기때문에 연산이 불가했던 것... 다른 github issue로 data를 gpu에 올려놓지 못하는 error 상황이 나는것같은데 그런건 아니고 그냥 잘 확인하자. 모델이 어디에서 돌아가고있는지

Error 2022.01.27