Skip to content

Commit 105f572

Browse files
authored
[Function optimization] add fixed input_ids for bert-converter (#4453)
1 parent 58eb2be commit 105f572

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/transformers/bert/test_modeling.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ def test_bert_converter(self):
592592
with tempfile.TemporaryDirectory() as tempdir:
593593

594594
# 1. create commmon input
595-
input_ids = np.random.randint(100, 200, [1, 20])
595+
input_ids = np.array([[i + 100 for i in range(20)]])
596596

597597
# 2. forward the paddle model
598598
from paddlenlp.transformers import BertModel
@@ -639,7 +639,7 @@ def test_bert_converter_from_local_dir(self):
639639
with tempfile.TemporaryDirectory() as tempdir:
640640

641641
# 1. create commmon input
642-
input_ids = np.random.randint(100, 200, [1, 20])
642+
input_ids = np.array([[i + 100 for i in range(20)]])
643643

644644
# 2. forward the torch model
645645
import torch

0 commit comments

Comments
 (0)