我正在尝试使用Hugging Face'Transformers'库提供的不同转换器架构对自定义数据(csv格式)进行二进制文本分类。我正在使用此Tensorflow blog post作为参考。
我正在使用以下代码将自定义数据集加载为'tf.data.Dataset'格式:
def get_dataset(file_path, **kwargs):
dataset = tf.data.experimental.make_csv_dataset(
file_path,
batch_size=5, # Artificially small to make examples easier to show.
na_value="",
num_epochs=1,
ignore_errors=True,
**kwargs)
return dataset
此后,当我尝试使用'glue_convert_examples_to_features'方法进行如下标记化时:
train_dataset = glue_convert_examples_to_features(
examples = train_data,
tokenizer = tokenizer,
task = None,
label_list = ['0', '1'],
max_length = 128
)
在以下位置抛出错误“ UnboundLocalError:赋值之前引用的本地变量'处理器'”]
if is_tf_dataset: example = processor.get_example_from_tensor_dict(example) example = processor.tfds_map(example)
[在所有示例中,我看到他们正在使用像'mrpc'这样的任务,这些任务是预定义的,并具有胶粘处理器来处理。 source code中的“ 85行”出现错误。
任何人都可以通过使用“自定义数据”来帮助解决此问题吗?
我正在尝试使用Hugging Face'Transformers'库提供的不同转换器架构对自定义数据(csv格式)进行二进制文本分类。我正在使用此...
我有同样的开始问题。