Skip to content

Commit 2c465df

Browse files
authored
styles (#4236)
1 parent 6088ebb commit 2c465df

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/transformers/ernie_gram/test_modeling.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,37 @@
1414
# limitations under the License.
1515

1616
import unittest
17-
from typing import Optional, Tuple, Dict, Any
17+
from dataclasses import Field, dataclass, fields
18+
from typing import Any, Dict, Optional, Tuple
19+
1820
import paddle
1921
from paddle import Tensor
2022

21-
from dataclasses import dataclass, asdict, fields, Field
2223
from paddlenlp.transformers import (
23-
ErnieGramModel,
24-
ErnieGramPretrainedModel,
24+
ErnieGramForQuestionAnswering,
2525
ErnieGramForSequenceClassification,
2626
ErnieGramForTokenClassification,
27-
ErnieGramForQuestionAnswering,
27+
ErnieGramModel,
28+
ErnieGramPretrainedModel,
2829
)
2930

30-
from ..test_modeling_common import ids_tensor, floats_tensor, random_attention_mask, ModelTesterMixin
3131
from ...testing_utils import slow
32+
from ..test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
3233

3334

3435
@dataclass
3536
class ErnieGramTestModelConfig:
3637
"""ernie-gram model config which keep consist with pretrained_init_configuration sub fields"""
3738

3839
attention_probs_dropout_prob: float = 0.1
39-
emb_size: int = 768
40+
emb_size: int = 8
4041
hidden_act: str = "gelu"
4142
hidden_dropout_prob: float = 0.1
42-
hidden_size: int = 768
43+
hidden_size: int = 8
4344
initializer_range: float = 0.02
4445
max_position_embeddings: int = 512
45-
num_attention_heads: int = 12
46-
num_hidden_layers: int = 12
46+
num_attention_heads: int = 2
47+
num_hidden_layers: int = 2
4748
type_vocab_size: int = 2
4849
vocab_size: int = 1801
4950

@@ -387,7 +388,6 @@ def test_inference_with_past_key_value(self):
387388
with paddle.no_grad():
388389
output = model(input_ids, attention_mask=attention_mask, use_cache=True, return_dict=True)
389390

390-
past_key_value = output.past_key_values[0][0]
391391
expected_shape = [1, 11, 768]
392392
self.assertEqual(output[0].shape, expected_shape)
393393
expected_slice = paddle.to_tensor(

0 commit comments

Comments
 (0)