Skip to content

Commit

Permalink
fix text correction windows dtype (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
joey12300 authored Sep 15, 2021
1 parent 898f2e1 commit 1d52537
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/text_correction/ernie-csc/predict_sighan.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def do_predict(args):
max_seq_length=args.max_seq_length,
is_test=True)
batchify_fn = lambda samples, fn=Tuple(
Pad(axis=0, pad_val=tokenizer.pad_token_id), # input
Pad(axis=0, pad_val=tokenizer.pad_token_type_id), # segment
Pad(axis=0, pad_val=pinyin_vocab.token_to_idx[pinyin_vocab.pad_token]), # pinyin
Pad(axis=0, pad_val=tokenizer.pad_token_id, dtype='int64'), # input
Pad(axis=0, pad_val=tokenizer.pad_token_type_id, dtype='int64'), # segment
Pad(axis=0, pad_val=pinyin_vocab.token_to_idx[pinyin_vocab.pad_token], dtype='int64'), # pinyin
Stack(axis=0, dtype='int64'), # length
): [data for data in fn(samples)]

Expand Down
6 changes: 3 additions & 3 deletions paddlenlp/taskflow/text_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def __init__(self, task, model, **kwargs):
self._pypinyin = pypinyin
self._max_seq_length = 128
self._batchify_fn = lambda samples, fn=Tuple(
Pad(axis=0, pad_val=self._tokenizer.pad_token_id), # input
Pad(axis=0, pad_val=self._tokenizer.pad_token_type_id), # segment
Pad(axis=0, pad_val=self._pinyin_vocab.token_to_idx[self._pinyin_vocab.pad_token]), # pinyin
Pad(axis=0, pad_val=self._tokenizer.pad_token_id, dtype='int64'), # input
Pad(axis=0, pad_val=self._tokenizer.pad_token_type_id, dtype='int64'), # segment
Pad(axis=0, pad_val=self._pinyin_vocab.token_to_idx[self._pinyin_vocab.pad_token], dtype='int64'), # pinyin
Stack(axis=0, dtype='int64'), # length
): [data for data in fn(samples)]
self._num_workers = self.kwargs[
Expand Down

0 comments on commit 1d52537

Please sign in to comment.