# 현재 설치된 font, 경로 확인하기 import matplotlib.pyplot as plt import matplotlib.font_manager as fm fm.fontManager.ttflist 위 코드를 실행해보면 폰트가 설치된 경로와 폰트 list를 볼 수 있는데, 이 중 한글을 지원하는 Nanum~를 하나 선택해보자. [ FontEntry(fname='/usr/share/fonts/truetype/nanum/NanumBarunGothicUltraLight.ttf', name='NanumBarunGothic', style='normal', variant='normal', weight=300, stretch='normal', size='scalable'), FontEntry(fname='/u..

huggingface의 Transformer를 Train class를 이용해 학습시키면 checkpoint가 생성된다. checkpoint는 학습 중에 모델의 파라미터와 다른 관련 정보를 학습의 일정 point마다 snapshot을 생성하는 것과 같다. # checkpoint가 유용한 이유 학습 재개 : 학습이 의도치 않게 중단되는 경우, checkpoint에 저장된 가장 마지막 step부터 학습을 시작할 수 있다. 원하는 성능의 모델 사용 : 일정 간격으로 저장된 모델 중 원하는 단계를 선택해 fine-tuning을 하거나, evaluation을 할 수 있다. train loss는 낮았지만 evaluation dataset에는 그렇지 않을 수 있으므로 저장된 단계별로 eval dataset의 성능을 확..
huggingface 에서 tokenizer 가져와서 나의 dataset으로 추가 학습하기 from transformers import AutoTokenizer import pandas as pd def batch_iterator(text, batch_size = 1000): for i in range(0, len(text), batch_size): yield text[i : i + batch_size] def main(): # data df = pd.read_pickle('train_data.pkl') text = df.text.tolist() # base tokenizer # tokenizer.is_fast==True인 경우에만 가능 tokenizer = AutoTokenizer.from_pretra..
# jupyter notebook에서 hugging face 로그인 from huggingface_hub import notebook_login notebook_login() # repository 생성 / 삭제 from huggingface_hub import create_repo # Repository 생성 create_repo(name=REPO_NAME) # Repository 삭제 delete_repo(name=REPO_NAME) # 원격 저장소 clone from huggingface_hub import Repository # LOCAL_DIR_NAME : 저장할 로컬 저장소 이름 # NAMESPACE/REPO_NAME : huggingface의 repository 이름 repo = Reposi..