분류 전체보기(75)
-
cpu 사용량 확인하기
1. Pytorch Profiler 사용하기import torchimport torch.distributed as distimport torch.nn as nnimport torch.optim as optimfrom torch.profiler import profile, ProfilerActivity# 모델 정의class SimpleModel(nn.Module): def __init__(self): super().__init__() self.fc = nn.Linear(10, 1) def forward(self, x): return self.fc(x)# DDP 초기화dist.init_process_group("nccl")torch.cuda.set_device..
2025.01.07 -
torch 2.x 유용한 기능들
torch.compile()을 사용할 때 특정 연산(예: 사용자 정의 CUDA 커널)이 지원되지 않는 경우,PyTorch의 디버깅 도구를 활용하여 문제를 추적하고 해결할 수 있음1. torch._dynamo.config.verbose=True로 디버깅 활성화torch.compile()에서 문제가 발생하면, torch._dynamo.config.verbose=True를 설정하여 PyTorch의 디버깅 메시지를 활성화이렇게 하면 어떤 연산이나 코드가 문제가 되는지 확인할 수 있음import torchimport torch._dynamotorch._dynamo.config.verbose = True이 설정을 활성화한 상태로 torch.compile()을 사용하면, 컴파일 과정에서 발생한 오류와 문제의 위치를 ..
2025.01.07 -
torch 2.x
PyTorch 2.0 주요 변경 사항1. TorchDynamoPyTorch 2.0의 핵심 기능으로, 동적 그래프를 정적으로 컴파일하는 기능을 제공TorchDynamo는 기존의 Python 함수 코드를 변환하여 빠르고 최적화된 그래프 실행을 지원함사용자는 torch.compile() API를 통해 모델을 쉽게 컴파일할 수 있음2. Inductor BackendInductor는 새로운 고성능 컴파일러 백엔드로, 다양한 하드웨어(예: CPU, GPU)에 대해 최적화된 코드를 생성함.기존의 TorchScript 및 기타 백엔드보다 더 나은 성능을 제공함.3. Dynamic Shapes 지원동적 입력 크기를 더 잘 처리할 수 있도록 개선됨.TorchInductor와 함께 사용할 때도 성능 저하 없이 동적 크기 입..
2025.01.07 -
CUDA build
CUDA extension은 GPU 가속을 위해 사용자 정의 CUDA 커널을 작성하고 이를 Python 코드에서 사용할 수 있도록 만든 확장 모듈torch.utils.cpp_extension을 사용하여 CUDA 커널을 Python 코드에서 호출할 수 있도록 빌드함 CUDA extension은 사용자 정의 CUDA 커널을 PyTorch와 연결하기 위한 모듈일반적인 Python/CPU 코드로는 수백만 개의 점에 대해 이웃을 찾는 연산이 너무 느리기 때문에, CUDA 커널을 직접 작성하여 속도를 높임병렬 연산을 통해 GPU 가속이 가능해지며, PyTorch의 autograd 기능과도 통합할 수 있음 C++ Code (ball_query.cpp): This file contains the interface be..
2024.12.15 -
241130 [NeurIPS 23'] LLaVA: Large Language and Vision AssistantVisual Instruction Tuning
https://github.com/haotian-liu/LLaVA GitHub - haotian-liu/LLaVA: [NeurIPS'23 Oral] Visual Instruction Tuning (LLaVA) built towards GPT-4V level capabilities and beyo[NeurIPS'23 Oral] Visual Instruction Tuning (LLaVA) built towards GPT-4V level capabilities and beyond. - haotian-liu/LLaVAgithub.comhttps://arxiv.org/abs/2304.08485 Visual Instruction TuningInstruction tuning large language models (..
2024.11.30 -
Git
1. 초기 설정: Git 초기 설정먼저, 로컬 컴퓨터에 Git 사용자 정보를 설정합니다. git config --global user.name "Your Name"git config --global user.email "your.email@example.com"이제 로컬 저장소나 모든 커밋에 본인의 이름과 이메일이 기록됩니다.2. 저장소 생성 및 클론: 원격 저장소 만들기 및 클론하기협업을 위해 GitHub나 GitLab과 같은 플랫폼에서 저장소(Repository) 를 생성합니다.저장소가 만들어지면, 아래 명령어로 로컬 컴퓨터에 클론합니다.git clone 이 명령어로 원격 저장소의 내용을 로컬에 다운로드할 수 있습니다.3. 브랜치 사용하기: 독립적인 작업 공간 만들기브랜치를 사용하면 각자 작업을 분리..
2024.10.27