@@ -12,19 +12,19 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
See the License for the specific language governing permissions and
13
13
limitations under the License. */
14
14
15
+ #include " fast_tokenizer/core/tokenizer.h"
16
+
15
17
#include < fstream>
16
- #include " glog/logging.h"
17
18
18
19
#include " fast_tokenizer/core/added_vocabulary.h"
19
20
#include " fast_tokenizer/core/base.h"
20
21
#include " fast_tokenizer/core/encoding.h"
21
- #include " fast_tokenizer/core/tokenizer.h"
22
-
23
22
#include " fast_tokenizer/decoders/decoders.h"
24
23
#include " fast_tokenizer/models/models.h"
25
24
#include " fast_tokenizer/normalizers/normalizers.h"
26
25
#include " fast_tokenizer/postprocessors/postprocessors.h"
27
26
#include " fast_tokenizer/pretokenizers/pretokenizers.h"
27
+ #include " glog/logging.h"
28
28
29
29
namespace paddlenlp {
30
30
namespace fast_tokenizer {
@@ -685,7 +685,12 @@ void from_json(const nlohmann::json& j, Tokenizer& tokenizer) {
685
685
}
686
686
687
687
// deserialize pretokenizer_
688
- const auto & pretokenizer = j.at (" pretokenizer" );
688
+ nlohmann::json pretokenizer;
689
+ if (j.find (" pretokenizer" ) == j.end ()) {
690
+ pretokenizer = j.at (" pre_tokenizer" );
691
+ } else {
692
+ pretokenizer = j.at (" pretokenizer" );
693
+ }
689
694
if (!pretokenizer.is_null ()) {
690
695
if (pretokenizer.at (" type" ) == " BertPreTokenizer" ) {
691
696
pretokenizers::BertPreTokenizer bert_pretokenizer;
@@ -735,7 +740,12 @@ void from_json(const nlohmann::json& j, Tokenizer& tokenizer) {
735
740
}
736
741
737
742
// deserialize post_processor_
738
- const auto & post_processor = j.at (" postprocessor" );
743
+ nlohmann::json post_processor;
744
+ if (j.find (" postprocessor" ) == j.end ()) {
745
+ post_processor = j.at (" post_processor" );
746
+ } else {
747
+ post_processor = j.at (" postprocessor" );
748
+ }
739
749
if (!post_processor.is_null ()) {
740
750
if (post_processor.at (" type" ) == " BertPostProcessor" ) {
741
751
postprocessors::BertPostProcessor bert_postprocessor;
0 commit comments