목록2025/05 (6)
토니의 연습장
요약BatchNorm: 배치 전체 통계 기반, CNN에 특화, 큰 배치에서 최고의 성능LayerNorm: 샘플별 통계 기반, 시퀀스·토큰 모델에 필수, 작은 배치에도 안정이미지 분류·객체 검출(CNN 계열)배치 크기가 충분하다면 → BatchNorm배치가 매우 작거나 온라인 추론 위주라면 → GroupNorm 또는 LayerNorm 고려자연어 처리·시퀀스 모델Transformer, RNN 계열 → LayerNorm특히 auto-regressive 생성(decoding) 시 causal 구조와 잘 맞음일반 MLP배치 독립성이 필요하면 → LayerNorm배치 통계가 풍부하면 → BatchNorm 왜 LayerNorm을 쓰는가?배치 크기 독립성BatchNorm은 배치 전체의 통계량을 사용하지만, LayerN..

* 실제 사용은 하단 전체 코드 참고미래 토큰 차단용 마스크 (causal mask)self.register_buffer( 'mask', torch.triu(torch.ones(CONTEXT_LENGTH, CONTEXT_LENGTH), diagonal=1)) (L, L) 크기의 상삼각 행렬 생성 (L = CONTEXT_LENGTH).대각선 위쪽(미래 위치)에 1이 채워져 있고, 나머지는 0.register_buffer로 저장하면 파라미터가 아니지만 .to(device) 등 이동 시 함께 따라갑니다.이후 forward에서scores = scores.masked_fill(self.mask == 1, float('-inf'))처럼 사용해서 “미래 정보”가 보이지 않도록 막음. Transformer의..
참고 : https://starknotes.tistory.com/202 MiniGPT-4MiniGPT-4: Enhancing Vision-Language Understanding with Advanced Large Language ModelsThe recent GPT-4 has demonstrated extraordinary multi-modal abilities, such as directly generating websites from handwritten text and identifying humorous elements withinstarknotes.tistory.com class MultimodalProjector(nn.Module): def __init__(self, image_embe..

MiniGPT-4: Enhancing Vision-Language Understanding with Advanced Large Language ModelsThe recent GPT-4 has demonstrated extraordinary multi-modal abilities, such as directly generating websites from handwritten text and identifying humorous elements within images. These features are rarely observed in previous vision-language models. Howevearxiv.org Minigpt-4The recent GPT-4 has demonstrated ex..

SAM-CLIP: Merging Vision Foundation Models towards Semantic and Spatial Understandinghttps://arxiv.org/pdf/2310.15308v4 논문 개요제목 : SAM-CLIP: Merging Vision Foundation Models towards Semantic and Spatial Understanding저자/소속 : Haoxiang Wang (University of Illinois U-C, Apple Intern) 외 Apple 연구진버전 / 날짜 : v4 - 2024-06-10 arXiv1. 연구 동기 & 문제 정의CLIP은 텍스트-이미지 대비 학습으로 “무엇(semantic)”을 잘 파악하지만, 고해상도에 약하고 픽셀 ..