-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Description
Feature request
tokenizer = AutoTokenizer.from_pretrained('ernie-1.0')
#text = tokenizer('自然语言处理', padding=True, return_attention_mask=True)
text = tokenizer(
'自然语言处理',
padding='max_length', # Pad to the specified max_length
max_length=128, # Set the fixed length to 128
truncation=True, # Truncate if longer than max_length
return_attention_mask=True
)
model = AutoModelForSequenceClassification.from_pretrained('ernie-1.0',num_classes=2)
#sequence_output = model(input_ids=paddle.to_tensor([text['input_ids']]))
sequence_output = model(input_ids=paddle.to_tensor([text['input_ids']]), attention_mask=paddle.to_tensor([text['attention_mask']]))
print(sequence_output)
Motivation
rt
Your contribution
rt
Metadata
Metadata
Assignees
Labels
No labels