Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dtype bug of text similarity #3188

Merged
merged 4 commits into from
Sep 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions paddlenlp/taskflow/text_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,11 @@ def _preprocess(self, inputs):
]
if ("rocketqa" in self.model_name):
batchify_fn = lambda samples, fn=Tuple(
Pad(axis=0, pad_val=self._tokenizer.pad_token_id), # input ids
Pad(axis=0, pad_val=self._tokenizer.pad_token_type_id
), # token type ids
Pad(axis=0, pad_val=self._tokenizer.pad_token_id, dtype='int64'
), # input ids
Pad(axis=0,
pad_val=self._tokenizer.pad_token_type_id,
dtype='int64'), # token type ids
): [data for data in fn(samples)]
else:
batchify_fn = lambda samples, fn=Tuple(
Expand Down