Skip to content

Commit

Permalink
Fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
apaniukov committed Oct 18, 2023
1 parent 79bd05f commit 24a60b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import logging
from typing import Dict, Optional, Sequence, Tuple, Union

from constants import LOGITS_OUTPUT_NAME, TOKEN_IDS_OUTPUT_NAME
from openvino import Model
from openvino.preprocess import PrePostProcessor
from openvino.runtime import opset12 as opset

from .constants import LOGITS_OUTPUT_NAME, TOKEN_IDS_OUTPUT_NAME


logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import sys

# import os
# os.environ["OV_TOKENIZER_PREBUILD_EXTENSION_PATH"] = "path/to/libuser_ov_extensions.so"

import pytest
import numpy as np
import pytest
from openvino import Core
from transformers import AutoTokenizer

from ov_tokenizer import (
# init_extension,
convert_tokenizer,
connect_models,
pack_strings,
unpack_strings,
)
Expand All @@ -30,8 +30,7 @@
"A lot\t w!",
"A lot\t\tof whitespaces!",
"\n\n\n\t\t A lot\t\tof\twhitespaces\n!\n\n\n\t\n\n",
"Eng, but with d1gits: 123; 0987654321, stop."
"0987654321 - eng, but with d1gits: 123"
"Eng, but with d1gits: 123; 0987654321, stop." "0987654321 - eng, but with d1gits: 123",
]
multilingual_test_strings = [
"Тестовая строка!",
Expand Down Expand Up @@ -146,7 +145,7 @@ def sentencepice_model_tokenizers(request, fast_tokenizer):
*eng_test_strings,
*multilingual_test_strings,
*emoji_test_strings,
]
],
)
def test_hf_wordpiece_tokenizers_outputs(hf_and_ov_wordpiece_tokenizers, test_string):
hf_tokenizer, ov_tokenizer = hf_and_ov_wordpiece_tokenizers
Expand All @@ -165,7 +164,7 @@ def test_hf_wordpiece_tokenizers_outputs(hf_and_ov_wordpiece_tokenizers, test_st
eng_test_strings,
multilingual_test_strings,
emoji_test_strings,
]
],
)
def test_hf_wordpiece_tokenizers_multiple_strings(hf_and_ov_wordpiece_tokenizers, test_string):
hf_tokenizer, ov_tokenizer = hf_and_ov_wordpiece_tokenizers
Expand All @@ -184,7 +183,7 @@ def test_hf_wordpiece_tokenizers_multiple_strings(hf_and_ov_wordpiece_tokenizers
*eng_test_strings,
*multilingual_test_strings,
*emoji_test_strings,
]
],
)
def test_sentencepiece_model_tokenizer(sentencepice_model_tokenizers, test_string):
hf_tokenizer, ov_tokenizer, _ = sentencepice_model_tokenizers
Expand All @@ -202,7 +201,7 @@ def test_sentencepiece_model_tokenizer(sentencepice_model_tokenizers, test_strin
*eng_test_strings,
*multilingual_test_strings,
*emoji_test_strings,
]
],
)
def test_sentencepiece_model_detokenizer(sentencepice_model_tokenizers, test_string):
hf_tokenizer, _, ov_detokenizer = sentencepice_model_tokenizers
Expand All @@ -220,7 +219,7 @@ def test_sentencepiece_model_detokenizer(sentencepice_model_tokenizers, test_str
*eng_test_strings,
*multilingual_test_strings,
*emoji_test_strings,
]
],
)
def test_hf_bpe_tokenizers_outputs(hf_and_ov_bpe_tokenizers, test_string):
hf_tokenizer, ov_tokenizer, _ = hf_and_ov_bpe_tokenizers
Expand All @@ -242,7 +241,7 @@ def test_hf_bpe_tokenizers_outputs(hf_and_ov_bpe_tokenizers, test_string):
*eng_test_strings,
*multilingual_test_strings,
*emoji_test_strings,
]
],
)
def test_bpe_detokenizer(hf_and_ov_bpe_detokenizer, test_string):
hf_tokenizer, _, ov_detokenizer = hf_and_ov_bpe_detokenizer
Expand Down

0 comments on commit 24a60b3

Please sign in to comment.