GradientGuru commited on
Commit
b24155f
1 Parent(s): 45f0718

Update tokenization_baichuan.py

Browse files
Files changed (1) hide show
  1. tokenization_baichuan.py +7 -5
tokenization_baichuan.py CHANGED
@@ -72,6 +72,13 @@ class BaichuanTokenizer(PreTrainedTokenizer):
72
  eos_token = AddedToken(eos_token, lstrip=False, rstrip=False) if isinstance(eos_token, str) else eos_token
73
  unk_token = AddedToken(unk_token, lstrip=False, rstrip=False) if isinstance(unk_token, str) else unk_token
74
  pad_token = AddedToken(pad_token, lstrip=False, rstrip=False) if isinstance(pad_token, str) else pad_token
 
 
 
 
 
 
 
75
  super().__init__(
76
  bos_token=bos_token,
77
  eos_token=eos_token,
@@ -83,11 +90,6 @@ class BaichuanTokenizer(PreTrainedTokenizer):
83
  clean_up_tokenization_spaces=clean_up_tokenization_spaces,
84
  **kwargs,
85
  )
86
- self.vocab_file = vocab_file
87
- self.add_bos_token = add_bos_token
88
- self.add_eos_token = add_eos_token
89
- self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
90
- self.sp_model.Load(vocab_file)
91
 
92
  def __getstate__(self):
93
  state = self.__dict__.copy()
 
72
  eos_token = AddedToken(eos_token, lstrip=False, rstrip=False) if isinstance(eos_token, str) else eos_token
73
  unk_token = AddedToken(unk_token, lstrip=False, rstrip=False) if isinstance(unk_token, str) else unk_token
74
  pad_token = AddedToken(pad_token, lstrip=False, rstrip=False) if isinstance(pad_token, str) else pad_token
75
+
76
+ self.vocab_file = vocab_file
77
+ self.add_bos_token = add_bos_token
78
+ self.add_eos_token = add_eos_token
79
+ self.sp_model = spm.SentencePieceProcessor(**self.sp_model_kwargs)
80
+ self.sp_model.Load(vocab_file)
81
+
82
  super().__init__(
83
  bos_token=bos_token,
84
  eos_token=eos_token,
 
90
  clean_up_tokenization_spaces=clean_up_tokenization_spaces,
91
  **kwargs,
92
  )
 
 
 
 
 
93
 
94
  def __getstate__(self):
95
  state = self.__dict__.copy()