Expected str, bytes or os.PathLike object, not ULMFiTDataset

When running the following code:

exp = multifit1552_fp16()
dataset = Path(f'data/wiki/fa-2')

wiki_dataset = exp.arch.dataset(dataset)
wiki_dataset.load_lm_databunch(bs=128,bptt=70).show_batch()
exp.pretrain_lm.train_(wiki_dataset)

I got:

TypeError                                 Traceback (most recent call last)

in ()
----> 1 exp.pretrain_lm.train_(wiki_dataset)

3 frames
/usr/lib/python3.6/pathlib.py in _parse_args(cls, args)
638 parts += a._parts
639 else:
–> 640 a = os.fspath(a)
641 if isinstance(a, str):
642 # Force-cast str subclasses to str (issue #21127)

TypeError: expected str, bytes or os.PathLike object, not ULMFiTDataset

So, what is wrong with the code? wiki_dataset seems to be a ULMFiTDataset. Then why the pathlib expect str?

This is a code from MultiFit github notebooks

The problem is that train tries to extract the language name from path even if the parameter isn’t the path to a dataset:

I manually set the langauge name in:

   def train_(self, dataset_or_path, tokenizer=None, **train_config):
        if self.arch.lang is None:
            lang = 'fa' # detect_lang_from_dataset_path(Path(dataset_or_path))
            if lang is None:
                warn("Unable to detect language from dataset path assuming English, use replace_(lang='??') change it.")
                lang = 'en'
            self.arch.lang = lang
        self.replace_(**train_config, _strict=True)