강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của pururun716969
pururun716969

câu hỏi đã được viết

Khóa học xử lý ngôn ngữ tự nhiên (NLP) sử dụng trí tuệ nhân tạo (Deep Learning) (từ cơ bản đến ChatGPT/mô hình tạo)

201_classify_text_with_bert_tfhub_Kor.ipynb 오류

Đã giải quyết

Viết

·

325

0

안녕하세요?
201_classify_text_with_bert_tfhub_Kor.ipynb 소스 수행 시 아래와 같은 오류가 납니다.
구글 colab gpu에서 돌리고 있습니다. (오류 이미지도 같이 첨부합니다.)

왜 오류가 나는지 답변 부탁 드립니다.

ValueError                                Traceback (most recent call last)
<ipython-input-17-3b4b1d94b15e> in <cell line: 1>()
----> 1 classifier_model = build_classifier_model()
      2 bert_raw_result = classifier_model(tf.constant(text_test))
      3 
      4 print(bert_raw_result)
      5 print(tf.sigmoid(bert_raw_result))


7 frames


/usr/local/lib/python3.10/dist-packages/keras/src/backend/common/keras_tensor.py in __array__(self)
     59 
     60     def __array__(self):
---> 61         raise ValueError(
     62             "A KerasTensor is symbolic: it's a placeholder for a shape "
     63             "an a dtype. It doesn't have any actual numerical value. "

ValueError: Exception encountered when calling layer 'preprocessing' (type KerasLayer).

A KerasTensor is symbolic: it's a placeholder for a shape an a dtype. It doesn't have any actual numerical value. You cannot convert it to a NumPy array.

Call arguments received by layer 'preprocessing' (type KerasLayer):
  • inputs=<KerasTensor shape=(None,), dtype=string, sparse=None, name=text>
  • training=None


딥러닝tensorflowNLP

Câu trả lời 2

1

YoungJea Oh님의 프로필 이미지
YoungJea Oh
Người chia sẻ kiến thức

다음과 같이 수정하시면 됩니다.

(기존)

!pip install -q -U tensorflow-text

!pip install -q tf-models-official

(수정)

!pip install -U "tensorflow-text==2.13.*"

!pip install "tf-models-official==2.13.*"

이 교재는 Google Tutorial의 https://www.tensorflow.org/text/tutorials/classify_text_with_bert 교재를 IMBD 대신 한글 naver movie 데이터로 제가 customizing 한 것인데 원래의 영문 tutorial 도 수정이 되어있네요. github 교재 source도 수정해 놓았습니다. 불편을 드려 죄송합니다.

제가 새롭게 고쳐서 실행해 보니 T4 GPU 기준 6시간 걸리네요. 예전 보다 시간이 훨씬 길어졌는데 아마도 Google 에서 무료 GPU 에 대한 지원을 낮춘 것으로 보입니다.
감사합니다.

0

pururun716969님의 프로필 이미지
pururun716969
Người đặt câu hỏi

이것은 6시간 돌리다 끊어져서 다시 돌려 봐야 할 것 같습니다.
답변 감사합니다.

Hình ảnh hồ sơ của pururun716969
pururun716969

câu hỏi đã được viết

Đặt câu hỏi