quando eu tento rodar esse código:
from transformers import pipeline
classificador = pipeline('text-classification', 'curtojulia/distilbert-pt-cased-redacao-nota', framework = 'tf')
da erro:
ValueError Traceback (most recent call last)
/tmp/ipython-input-2168751135.py in <cell line: 0>()
1 from transformers import pipeline
2
----> 3 classificador = pipeline('text-classification', 'curtojulia/distilbert-pt-cased-redacao-nota', framework = 'tf')
1 frames
/usr/local/lib/python3.12/dist-packages/transformers/pipelines/base.py in infer_framework_load_model(model, config, model_classes, task, framework, **model_kwargs)
331 for class_name, trace in all_traceback.items():
332 error += f"while loading with {class_name}, an error is thrown:\n{trace}\n"
--> 333 raise ValueError(
334 f"Could not load model {model} with any of the following classes: {class_tuple}. See the original errors:\n\n{error}\n"
335 )
ValueError: Could not load model curtojulia/distilbert-pt-cased-redacao-nota with any of the following classes: (<class 'transformers.models.auto.modeling_tf_auto.TFAutoModelForSequenceClassification'>, <class 'transformers.models.distilbert.modeling_tf_distilbert.TFDistilBertForSequenceClassification'>). See the original errors:
while loading with TFAutoModelForSequenceClassification, an error is thrown:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/transformers/pipelines/base.py", line 311, in infer_framework_load_model
model = model_class.from_pretrained(model, **fp32_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/models/auto/auto_factory.py", line 604, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_tf_utils.py", line 2929, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/models/distilbert/modeling_tf_distilbert.py", line 767, in init
super().init(config, *inputs, **kwargs)
File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_tf_utils.py", line 1190, in init
super().init(*inputs, **kwargs)
File "/usr/local/lib/python3.12/dist-packages/tensorflow/python/trackable/base.py", line 204, in _method_wrapper
result = method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/tf_keras/src/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.12/dist-packages/tensorflow/python/framework/dtypes.py", line 889, in as_dtype
raise TypeError(f"Cannot convert the argument type_value: {type_value!r} "
TypeError: Cannot convert the argument type_value: torch.float32 to a TensorFlow DType.
while loading with TFDistilBertForSequenceClassification, an error is thrown:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/transformers/pipelines/base.py", line 311, in infer_framework_load_model
model = model_class.from_pretrained(model, **fp32_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_tf_utils.py", line 2929, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/transformers/models/distilbert/modeling_tf_distilbert.py", line 767, in init
super().init(config, *inputs, **kwargs)
File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_tf_utils.py", line 1190, in init
super().init(*inputs, **kwargs)
File "/usr/local/lib/python3.12/dist-packages/tensorflow/python/trackable/base.py", line 204, in _method_wrapper
result = method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/tf_keras/src/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.12/dist-packages/tensorflow/python/framework/dtypes.py", line 889, in as_dtype
raise TypeError(f"Cannot convert the argument type_value: {type_value!r} "
TypeError: Cannot convert the argument type_value: torch.float32 to a TensorFlow DType.
E não consigo corrigir de forma alguma, a IA aconselhou fazer de forma manual sem utilizar a biblioteca pipeline, mas gostaria de saber se tem como usando.