pytorch 3

check number model parameter and freeze, 모델 파라미터 개수 확인 및 layer freeze 하기

from transformers import AutoModelForSeq2SeqLM name = "sshleifer/distilbart-cnn-6-6" models = AutoModelForSeq2SeqLM.from_pretrained(name) model = model.to(device) print(models.state_dict().keys()) # 요런식으로 model layer들이 뜰거고 그 중 freeze 하고 싶은 애들만 고르기 #['model.encoder.layers.0.', 'model.encoder.layers.1','model.encoder.layers.2','model.encoder.layers.3','model.encoder.layers.4'] print("Trainable par..

ImportError: cannot import name 'Field' from 'torchtext.data' , undefined symbol: _ZNK3c104Type14isSubtypeOfExtESt10shared_ptrIS0_EPSo

※ ImportError ImportError: cannot import name 'Field' from 'torchtext.data' ImportError: cannot import name 'BucketIterator' from 'torchtext.data' ModuleNotFoundError: No module named 'torchtext.legacy' 원인 : torchtext의 버전에 따라 불러오는 방식이 다르다 해결 : 버전에 맞게 legacy.data 에서 불러오거나 .data 에서 불러온다 from torchtext.legacy.data import Field, TabularDataset, BucketIterator, Iterator 0.9 이상의 버전에서는 torchtext.data -..

CODE/ERROR 2022.10.05

NLP with PyTorch

파이토치로 배우는 자연어 처리: 딥러닝을 이용한 자연어 처리 애플리케이션 구축 GitHub https://github.com/rickiepark/nlp-with-pytorch GitHub - rickiepark/nlp-with-pytorch: (한빛미디어, 2021)의 소스 코드를 (한빛미디어, 2021)의 소스 코드를 위한 저장소입니다. - GitHub - rickiepark/nlp-with-pytorch: (한빛미디어, 2021)의 소스 코드를 위한 저장 github.com 목표 1주에 1 챕터씩 끝내는 것을 목표로 하여 3월, 늦어도 4월 초 안에 정독 완료 시작일 22.02.03

NLP/with PyTorch 2022.02.03
728x90