본문 바로가기

전체 글101

Huggingface "UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor." 처리법 Huggingface에서 주어지는 Imageprocessor class을 사용할 때 간혹 위와 같은 warning문구가 뜨곤 한다. 예를 들어 비디오를 읽어서 전처리를 하는 함수가 있다고 해보자 self.video_processor = VivitImageProcessor.from_pretrained("google/vivit-b-16x2-kinetics400") ... video = read_video_pyav(container=container, indices=indices) #[T, H, W, C] inputs = self.video_processor(list(video), return_tensors="pt")["pixel_values"] #[1, T, C, H, W] 위 블록의 마지막 줄에서 해당 w.. 2024. 3. 13.
HF Trainer 사용 시 collator에 아무것도 들어오지 않는 경우 Huggingface Trainer 사용시, dataset과 collator class을 같이 넘겨준다. 그런데 getitem까지는 잘 데이터가 담기는데, collator의 call 부분을 찍을 시, 아무것도 들어오지 않는 ( [{}, {}, {}] -> bs 3인 경우) 경우가 생겼을 때 -> Trainer에 넘겨주는 training argument 중 remove_unused_columns을 False로 주면 된다. (기본은 True) Trainer 소스 코드에서 아래 함수로 인해 문제가 발생하는 것인데, def _get_collator_with_removed_columns( self, data_collator: Callable, description: Optional[str] = None ) -> .. 2024. 3. 13.
warm up 처음 warm up https://arxiv.org/pdf/1706.02677.pdf 낮은것부터 점차 올라가는 warm up https://arxiv.org/pdf/1812.01187.pdf 반대로 높은것부터 내려오는? 확실하진않음. variance관련 warmup https://arxiv.org/pdf/1908.03265.pdf 기타 https://papers.nips.cc/paper_files/paper/2019/hash/dc6a70712a252123c40d2adba6a11d84-Abstract.html Control Batch Size and Learning Rate to Generalize Well: Theoretical and Empirical Evidence Requests for name c.. 2023. 8. 23.
dictionary get value with dot class Map(dict): """ Example: m = Map({'first_name': 'Eduardo'}, last_name='Pool', age=24, sports=['Soccer']) """ def __init__(self, *args, **kwargs): super(Map, self).__init__(*args, **kwargs) for arg in args: if isinstance(arg, dict): for k, v in arg.iteritems(): self[k] = v if kwargs: for k, v in kwargs.iteritems(): self[k] = v def __getattr__(self, attr): return self.get(attr) def __setattr_.. 2023. 8. 2.
zip, wget 여러 파일 내부 zip으로.. zip temp.zip -r /mango/* /apple/* wget --no-check-certificate https://~~ 2023. 7. 10.
Hash checksum md5sum *.npy > check_gt.txt 2023. 3. 31.
Remote VSCODE Tensorboard 1. 기본적으로 Extension에서 Python이 깔려있으면 사용가능함 -> container내의 vscode에서 extension python을 재설치한다. 2. Command palette에서 Launch Tensorboard가 있음. 그걸 누르면 폴더 설정하는게 나옴 -> tensorboard log 들어있는 폴더로 지정하면 session 시작됨 3. 만약 Launch Tensorboard 했는데 torch-tb-profiler 설치가 안된다고 뜨면 Python Interpreter가 가상환경이랑 안맞아서 그럴확률이 큼 -> Command Palette -> Python Select Interpreter -> 내 가상환경으로 변경 -> Launch Tensorboard하면 된다. 2023. 3. 17.
TMUX apt-get install tmux >tmux 로 시작 - 창 분할 vert : ctrl b % hor : ctrl b " 창 이동 : ctrl b 화살표 죽이기 ctrl b d (tmux자체를 죽이는거임 -> 나 혼자 쓸때만 쓰기) 특정 pane 죽이기 -> ctrl b + x -tmux session (단백질 과제에서 유용) tmux new -s jwahn (새로운 session생성) tmux a -t jwahn (attach) ctrl B + D (Detach) tmux ls (session 조회) tmux kill-session -t jwahn (내 session 만 kill) https://gist.github.com/henrik/1967800 2023. 3. 15.