Skip to content

Commit f727741

Browse files
authored
Fix Unit Test (PaddlePaddle#5188)
* replace by small model * uie-test * update
1 parent a164884 commit f727741

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

paddlenlp/taskflow/information_extraction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,12 @@ class UIETask(Task):
438438
},
439439
"__internal_testing__/tiny-random-uie-x": {
440440
"model_state": [
441-
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-uie-x/model_state.pdparams",
442-
"b62bdbfec23ee839c5d0a8a7e6920075",
441+
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-uie-x_v1.0/model_state.pdparams",
442+
"d9b573b31a82b860b6e5a3005d7b879e",
443443
],
444444
"config": [
445-
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-uie-x/config.json",
446-
"abeaeacca5316e2cbe779f37d986efb4",
445+
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-uie-x_v1.0/config.json",
446+
"27d715e680596a69d882056a400d97db",
447447
],
448448
"vocab_file": [
449449
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-uie-x/vocab.txt",

paddlenlp/taskflow/zero_shot_text_classification.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,23 +234,23 @@ class ZeroShotTextClassificationTask(Task):
234234
"__internal_testing__/tiny-random-utc": {
235235
"model_state": [
236236
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-utc/model_state.pdparams",
237-
"5ca864e9cc07b54e66f5caa184ddfffb",
237+
"d303b59447be690530c35c73f8fd03cd",
238238
],
239239
"config": [
240240
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-utc/config.json",
241-
"1e8b508d0fbefca16f94c96ef72b3dd3",
241+
"3420a6638a7c73c6239eb1d7ca1bc5fe",
242242
],
243243
"vocab_file": [
244244
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-utc/vocab.txt",
245-
"fd630e130f707f860b0edd148f0445d9",
245+
"97eb0ec5a5890c8190e10e251af2e133",
246246
],
247247
"special_tokens_map": [
248248
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-utc/special_tokens_map.json",
249249
"8b3fb1023167bb4ab9d70708eb05f6ec",
250250
],
251251
"tokenizer_config": [
252252
"https://bj.bcebos.com/paddlenlp/models/community/__internal_testing__/tiny-random-utc/tokenizer_config.json",
253-
"dcb0f3257830c0eb1f2de47f2d86f89a",
253+
"258fc552c15cec90046066ca122899e2",
254254
],
255255
},
256256
}

tests/taskflow/test_information_extraction.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
16+
import shutil
1517
import unittest
1618

1719
from paddlenlp import Taskflow
20+
from paddlenlp.utils.env import PPNLP_HOME
1821

1922
from ..testing_utils import get_tests_dir
2023

@@ -32,6 +35,22 @@ def setUpClass(cls):
3235
model="__internal_testing__/tiny-random-uie-m",
3336
)
3437

38+
tiny_uie_m_path = os.path.join(
39+
PPNLP_HOME, "taskflow/information_extraction/__internal_testing__/tiny-random-uie-m/"
40+
)
41+
tiny_uie_x_path = os.path.join(
42+
PPNLP_HOME, "taskflow/information_extraction/__internal_testing__/tiny-random-uie-x/"
43+
)
44+
45+
if not os.path.exists(tiny_uie_x_path):
46+
os.mkdir(tiny_uie_x_path)
47+
48+
for file_to_copy in ["vocab.txt", "sentencepiece.bpe.model"]:
49+
shutil.copy(
50+
os.path.join(tiny_uie_m_path, file_to_copy),
51+
os.path.join(tiny_uie_x_path, file_to_copy),
52+
)
53+
3554
cls.uie_x = Taskflow(
3655
task="information_extraction",
3756
model="__internal_testing__/tiny-random-uie-x",

0 commit comments

Comments
 (0)