본문 바로가기

잡것들

(12)
asyncio 에서 동기 함수를 비동기함수 처럼 사용하는 법 비동기 i/o 에 대한 이해가 없다면 아래 영상을 보고 오시면 도움이 됩니다. https://youtu.be/wB9tIg209-8 async 를 사용할 때 시간이 많이 걸리는 동기 함수를 사용하게 되면 다른 작업을 처리하지 뫗하는 현상이 발생한다. 이 때 run_in_executor 를 사용하게 되면 동기 함수를 비동기 함수처럼 await 로 사용할 수 있게 된다. import asyncio import concurrent.futures def blocking_io(): # File operations (such as logging) can block the # event loop: run them in a thread pool. with open('/dev/urandom', 'rb') as f: ret..
pytorch nan 디버깅 하는 법 torch.autograd.set_detect_anomaly(True) 이것을 설정하고 Nan이 발생하게 되면 RuntimeError가 발생되고 종료된다. 이 때 VSCode의 debugger를 사용해도 되고 RuntimeError에 trace에 뜨는 부분을 직접 찾아가도 된다. 대표적으로 세가지 경우가 있다. input에 nan이 있는 경우 forward시 network에 문제가 있는 경우 backpropagation 시 loss에 문제가 있는 경우 나의 경우 backpropagation에서 문제가 있었다. atan2의 경우 real, imag 값이 모두 0일때 backward를 수행하면 아래와 같이 gradient 가 nan이 나오게 된다. x = torch.zeros(4, requires_grad=..
Docker container Image 한번에 삭제 Container 한번에 삭제하기 for name in $(echo "`sudo docker ps -a | awk '{print $1}'`");do sudo docker rm "${name}"; done Image 한번에 삭제하기 for name in $(echo "`sudo docker images | awk '{print $3}'`");do sudo docker rmi "${name}"; done
Onnx 시각화 프로그램 netron pytroch model 파일을 onnx로 변환한 후 path를 그래프로 그려주는 툴이다. https://netron.app/ Netron netron.app 이 사이트로 들어가면 windows나 mac용 release 버전을 다운받아서 사용하면 된다. 설치 후 자동으로 onnx확장자를 인식하여 파일을 열기만 하면 아래 처럼 그래프가 나오게 된다.
VSCode python auto lint, black format, organize import VSCode python 자동으로 lint, black formatting, import정리 설정 방법 설정하고 하는 workspace로 들어가 .vscode/settings.json에 아래처럼 입력하면 된다. { "python.linting.enabled": true, "python.linting.lintOnSave": true, "python.linting.flake8Enabled": true, "python.linting.flake8Args": [ "--max-line-length=119", ], "python.formatting.provider": "black", "python.formatting.blackArgs": [ "--line-length", "119", ], "isort.args": [..
windows driver documentation https://github.com/microsoft/Windows-driver-samples/tree/master/audio/sysvad GitHub - microsoft/Windows-driver-samples: This repo contains driver samples prepared for use with Microsoft Visual Studio and t This repo contains driver samples prepared for use with Microsoft Visual Studio and the Windows Driver Kit (WDK). It contains both Universal Windows Driver and desktop-only driver samples. - G..
FlexASIO Driver 빌드&설치법 https://github.com/dechamps/FlexASIO GitHub - dechamps/FlexASIO: A flexible universal ASIO driver that uses the PortAudio sound I/O library. Supports WASAPI (shared A flexible universal ASIO driver that uses the PortAudio sound I/O library. Supports WASAPI (shared and exclusive), KS, DirectSound and MME. - GitHub - dechamps/FlexASIO: A flexible universal ASIO ... github.com 0.FlexASIO? universal..
Visual Studio CMake 환경 구성하기 1. visual studio installer 실행 2. Visual Studio Version Select 3. CMake tools for windows 설치 위와 같이 체크해주고 설치를 진행하면 Visual studio안에서 cmake 환경 구성이 완료된다.