[Tensorflow] InternalError: Blas xGEMM launch failed : a.shape=[1,15,1024], b.shape=[1,1024,1024], m=15, n=1024, k=1024 [Op:MatMul] 오류

2023. 1. 25. 21:54·python/라이브러리
728x90
반응형

InternalError                             Traceback (most recent call last)
Cell In[19], line 3
      1 # 신규
      2 with strategy.scope():
----> 3   model = TFBertForQuestionAnswering("bert-large-uncased-whole-word-masking-finetuned-squad")
      4   optimizer = tf.keras.optimizers.Adam(learning_rate=5e-5)
      5   loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=False)

Cell In[18], line 4, in TFBertForQuestionAnswering.__init__(self, model_name)
      2 def __init__(self, model_name):
      3     super(TFBertForQuestionAnswering, self).__init__()
----> 4     self.bert = TFBertModel.from_pretrained(model_name, from_pt=True)
      5     self.qa_outputs = tf.keras.layers.Dense(2,
      6                                             kernel_initializer=tf.keras.initializers.TruncatedNormal(0.02),
      7                                             name='qa_outputs')
      8     self.softmax = tf.keras.layers.Activation(tf.keras.activations.softmax)

File ~/anaconda3/envs/py39/lib/python3.9/site-packages/transformers/modeling_tf_utils.py:1290, in TFPreTrainedModel.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
   1287     from .modeling_tf_pytorch_utils import load_pytorch_checkpoint_in_tf2_model
   1289     # Load from a PyTorch checkpoint
-> 1290     return load_pytorch_checkpoint_in_tf2_model(model, resolved_archive_file, allow_missing_keys=True)
   1292 # we might need to extend the variable scope for composite models
   1293 if load_weight_prefix is not None:
...
-> 6897 six.raise_from(core._status_to_exception(e.code, message), None)

File <string>:3, in raise_from(value, from_value)

InternalError: Blas xGEMM launch failed : a.shape=[1,15,1024], b.shape=[1,1024,1024], m=15, n=1024, k=1024 [Op:MatMul]

주피터 노트북에서 한 파일에 모델 학습을 하면서 다른 파일의 모델도 학습하려니 해당 오류가 떴다.

 

오류가 뜬 이유

[참고] https://stackoverflow.com/questions/37337728/tensorflow-internalerror-blas-sgemm-launch-failed

 

[원인] GPU Memory를 TensorFlow process가 독점하고 있는데, 다른 TensorFlow Process가 GPU Memory에 접근하려고 할때 발생하는 에러.

 

[해결책] TensorFlow Session 설정에서 GPU 메모리를 공유하도록 설정해도 되겠지만, 일단 가장 간단한 방법은 jupyter notebook 을 종료하고, 다시 실행시켜서 하나의 kernel만 실행시킨다. jupyter notebook 을 실행시킨 상태에서 pycharm 에서 실행시킨다면 위와 같은 에러가 발생한다.

 

728x90
반응형

'python > 라이브러리' 카테고리의 다른 글

[Jupyter notebook] vscode 안에서 ipynb에서 html로 바꾸기  (0) 2023.02.06
[Python] argparse로 모델 학습하기 / Python argparse 사용법  (0) 2023.01.30
[Flask] 플라스크 웹 배포  (0) 2022.11.18
[Python] import aspose.words 텍스트 파일을 PDF 파일로 변환하기  (0) 2022.11.16
[Tensorflow] model.save() 오류  (0) 2022.11.11
'python/라이브러리' 카테고리의 다른 글
  • [Jupyter notebook] vscode 안에서 ipynb에서 html로 바꾸기
  • [Python] argparse로 모델 학습하기 / Python argparse 사용법
  • [Flask] 플라스크 웹 배포
  • [Python] import aspose.words 텍스트 파일을 PDF 파일로 변환하기
sillon
sillon
꾸준해지려고 합니다..
    반응형
  • sillon
    sillon coding
    sillon
  • 전체
    오늘
    어제
    • menu (614)
      • notice (2)
      • python (68)
        • 자료구조 & 알고리즘 (23)
        • 라이브러리 (19)
        • 기초 (8)
        • 자동화 (14)
        • 보안 (1)
      • coding test - python (301)
        • Programmers (166)
        • 백준 (76)
        • Code Tree (22)
        • 기본기 문제 (37)
      • coding test - C++ (5)
        • Programmers (4)
        • 백준 (1)
        • 기본기문제 (0)
      • 공부정리 (5)
        • 신호처리 시스템 (0)
        • Deep learnig & Machine lear.. (41)
        • Data Science (18)
        • Computer Vision (17)
        • NLP (40)
        • Dacon (2)
        • 모두를 위한 딥러닝 (강의 정리) (4)
        • 모두의 딥러닝 (교재 정리) (9)
        • 통계 (2)
      • HCI (23)
        • Haptics (7)
        • Graphics (11)
        • Arduino (4)
      • Project (21)
        • Web Project (1)
        • App Project (1)
        • Paper Project (1)
        • 캡스톤디자인2 (17)
        • etc (1)
      • OS (10)
        • Ubuntu (9)
        • Rasberry pi (1)
      • App & Web (9)
        • Android (7)
        • javascript (2)
      • C++ (5)
        • 기초 (5)
      • Cloud & SERVER (8)
        • Git (2)
        • Docker (1)
        • DB (4)
      • Paper (7)
        • NLP Paper review (6)
      • 데이터 분석 (0)
        • GIS (0)
      • daily (2)
        • 대학원 준비 (0)
      • 영어공부 (6)
        • job interview (2)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    소수
    programmers
    Python
    백준
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
sillon
[Tensorflow] InternalError: Blas xGEMM launch failed : a.shape=[1,15,1024], b.shape=[1,1024,1024], m=15, n=1024, k=1024 [Op:MatMul] 오류
상단으로

티스토리툴바