# Buggy code
def _convert_lines_to_sentence(self, lines):
    sentence: Sentence = Sentence()
    for line in lines:
        # skip comments
        if self.comment_symbol is not None and line.startswith(self.comment_symbol):
            continue

        # if sentence ends, convert and return
        if self.__line_completes_sentence(line):
            if len(sentence) > 0:
                if self.tag_to_bioes is not None:
                    sentence.convert_tag_scheme(
                        tag_type=self.tag_to_bioes, target_scheme="iobes"
                    )
                # check if this sentence is a document boundary
                if sentence.to_original_text() == self.document_separator_token:
                    sentence.is_document_boundary = True
                return sentence

        # otherwise, this line is a token. parse and add to sentence
        else:
            token = self._parse_token(line)
            sentence.add_token(token)

    # check if this sentence is a document boundary
    if sentence.to_original_text() == self.document_separator_token:
        sentence.is_document_boundary = True
    if len(sentence) > 0:
        return sentence


# Traceback (OSError)
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-5-2f413379aedd> in <module>
6
7 # load the NER tagger
----> 8 tagger = SequenceTagger.load('best-model.pt')
9
10

c:\users\nicod\miniconda3\lib\site-packages\flair\nn.py in load(cls, model)
86             # see https://github.com/zalandoresearch/flair/issues/351
87             f = file_utils.load_big_file(str(model_file))
---> 88             state = torch.load(f, map_location='cpu')
89
90         model = cls._init_model_with_state_dict(state)

c:\users\nicod\miniconda3\lib\site-packages\torch\serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
527             with _open_zipfile_reader(f) as opened_zipfile:
528                 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
--> 529         return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
530
531

c:\users\nicod\miniconda3\lib\site-packages\torch\serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
700     unpickler = pickle_module.Unpickler(f, **pickle_load_args)
701     unpickler.persistent_load = persistent_load
--> 702     result = unpickler.load()
703
704     deserialized_storage_keys = pickle_module.load(f, **pickle_load_args)

c:\users\nicod\miniconda3\lib\site-packages\transformers\tokenization_camembert.py in __setstate__(self, d)
259             raise
260         self.sp_model = spm.SentencePieceProcessor()
--> 261         self.sp_model.Load(self.vocab_file)
262
263     def convert_tokens_to_string(self, tokens):

c:\users\nicod\miniconda3\lib\site-packages\sentencepiece.py in Load(self, model_file, model_proto)
365       if model_proto:
366         return self.LoadFromSerializedProto(model_proto)
--> 367       return self.LoadFromFile(model_file)
368
369

c:\users\nicod\miniconda3\lib\site-packages\sentencepiece.py in LoadFromFile(self, arg)
175
176     def LoadFromFile(self, arg):
--> 177         return _sentencepiece.SentencePieceProcessor_LoadFromFile(self, arg)
178
179     def Init(self,

OSError: Not found: "/home/ubuntu/.cache/torch/transformers/3715e3a4a2de48834619b2a6f48979e13ddff5cabfb1f3409db689f9ce3bb98f.28d30f926f545047fc59da64289371eef0fbdc0764ce9ec56f808a646fcfec59": No such file or directory Error #2

# Fixed code
def _convert_lines_to_sentence(self, lines):
    sentence: Sentence = Sentence()
    for line in lines:
        # skip comments
        if self.comment_symbol is not None and line.startswith(self.comment_symbol):
            continue

        # if sentence ends, convert and return
        if self.__line_completes_sentence(line):
            if len(sentence) > 0:
                if self.tag_to_bioes is not None:
                    sentence.convert_tag_scheme(
                        tag_type=self.tag_to_bioes, target_scheme="iobes"
                    )
                # check if this sentence is a document boundary
                if sentence.to_original_text() == self.document_separator_token:
                    sentence.is_document_boundary = True
                return sentence

        # otherwise, this line is a token. parse and add to sentence
        else:
            token = self._parse_token(line)
            sentence.add_token(token)

    # check if this sentence is a document boundary
    if sentence.to_original_text() == self.document_separator_token:
        sentence.is_document_boundary = True

    if self.tag_to_bioes is not None:
        sentence.convert_tag_scheme(tag_type=self.tag_to_bioes, target_scheme="iobes")

    if len(sentence) > 0:
        return sentence