源代码:
from transformers import TFBertForSequenceClassification
import tensorflow as tf
transformers==3.02
model = TFBertForSequenceClassification.from_pretrained('bert-base-chinese', num_labels=2)
报错:
ImportError:
TFBertForSequenceClassification requires the TensorFlow library but it was not found in your environment. Checkout the instructions on the
installation page: https://www.tensorflow.org/install and follow the ones that match your environment.
版本:
TensorFlow.version
'2.7.0'
transformers.version
'4.12.3'