Processing math: 100%
본문 바로가기

분류 전체보기209

파이썬 멀티프로세싱 (Pool, starmap_async) negative sampling 하는데, 만여명이 넘는 유저에 대해서 for loop을 도니 속도가 매우*100000으로 느리다. htop을 찍어보니, single loop을 돌 때마다 활성화되는 CPU 코어는 한 개, 30개가 있으니까 모두 이용할 수 있도록 해보자. 목표 가지고 있는 코어를 최대로 활용하여 처리 속도를 줄인다. 방법 from multiprocessing import Pool def sample_negative(user_id): ''' 생략: 오래걸리는 작업 ''' return negative_samples # 기존 방식 train = [] for u in all_users: train.extend(sample_negative(u)) # 멀티프로세싱 적용 train = [] p = Po.. 2023. 8. 7.
파이토치 GPU 인식 확인하기 torch-gpu-test.py 파일을 생성하여 아래 내용을 복붙한다. import torch def main(): print(torch.cuda.is_available()) print(torch.cuda.get_device_name(0)) print(torch.cuda.device_count()) if __name__ == '__main__': main() 파이썬으로 위 프로그램을 실행하였을 때, 디바이스 이름과 개수가 의도한 바와 일치하면 된다. python torch-gpu-test.py True Tesla V100S-PCIE-32GB 2 2023. 7. 28.
python parent module 임포트 방법 맨날 까먹어서.. https://stackoverflow.com/questions/714063/importing-modules-from-parent-folder 참고 import sys sys.path.append('..') 2023. 7. 27.
[paper] GPT4Rec 논문 리뷰 본 포스팅에서는 최근에 아마존에서 연구한 GPT-2 모델 기반 추천 프레임워크인 GPT4Rec 논문을 리뷰합니다. 생성형 언어 모델을 추천에 직접 도입한 사례로 매우 흥미로운 논문이며, 논문 정보, 리뷰 내용, 논문을 읽고 난 개인적 의견차례로 글을 작성하였습니다. 목차 개요 원제: GPT4Rec: A Generative Framework for Personalized Recommendation and User Interests Interpretation 저자: University of Michigan, Ann Arbor, Amazon, United States 제출일: 2023.04.08 논문 링크: https://arxiv.org/abs/2304.03879 코드 공개 여부: X 내용 1. Introd.. 2023. 7. 27.
MacOS에 tesseract 설치하여 사용하기 (영어, 한글) 이것만 해주면 영어 OCR은 된다. 한국어는 안됨 homebrewinstalltesseract pip install pytesseract 영어 OCR import pytesseract from PIL import Image img = Image('test.png') img_text = pytesseract.image_to_string(img) print(img_text) 한국어 설정하기 $ brew list tesseract /opt/homebrew/Cellar/tesseract/5.3.2/bin/ambiguous_words /opt/homebrew/Cellar/tesseract/5.3.2/bin/classifier_tester /opt/homebrew/Cellar/tesseract/5.3.2.. 2023. 7. 25.
python graphviz 설치 오류 오류 메시지 ExecutableNotFound: failed to execute PosixPath('dot'), make sure the Graphviz executables are on your systems' PATH 해결 방법 os 별로 공식 홈페이지에서 권장하는 방법으로 graphviz를 설치한다. 나의 경우 OSX에 설치하므로 homebrew 를 활용하여 설치함 $ brew install graphviz 그러면 오류가 안날 것! 2023. 7. 24.