Hello,
I’m new to Fastai and currently making my way through part 1. I am currently work in version 1.0.55 and I am behind a firewall where I can’t run the URLs.WT103 to download the pre-trained embeddings from the s3 bucket.
However I do have access to the original wt103 model located here and I have downloaded it locally on my machine. Can anyone provide guidance on how I can load this file to get the language_model_learner working with my constraints of not being able to access it and download it from URLs.WT103.
Note that this model won’t fully work with v1.0.55 as we have changed things in the tokenization process or special token ids. It won’t be horrible, just not as good as the latest one. Also note that the line of code you passed can’t work as there is no pretrained_model argument in language_model_learner.
To use a pretrained model you have locally, you should put the files in .pth and .pkl in the models directory of your Learner (by default data_path/models) then use
@sgugger Thanks for the help on @mlxMantic’s question, wondering about a couple of things. First, a quick assumption I want to clear up. When you say “latest one” you mean the WT103_v1, correct?
Second, regarding placement of the pretrained models in the filesystem such that the language_model_learner is able to find them, where exactly is data_path? Is it an environmental variable that I need to set? I don’t see a folder in the filesystem that fastai would care about with this name. I also tried to set a relative path to the location I saved the files but I got a SyntaxError exception, which may be expected I guess.
FWIW I started on this path because I couldn’t download the model the standard way (not related to @mlxMantic’s firewall problem). I get this exception if I try as is suggested:
learner = language_model_learner(new_LM, URLs.WT103_v1,drop_mult=0.3)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-30-04d9ce49c683> in <module>
----> 1 learner = language_model_learner(new_LM, URLs.WT103_v1,drop_mult=0.3)
AttributeError: type object 'URLs' has no attribute 'WT103_v1'
I’ll start another thread on this issue if it’s worthwhile (not trivial)
I can’t find anything online for this error so I think it’s probably something on my side. I am running this on GCP, but I’ve tried a few different instances and machine types without being able to figure this out.
Happy to start another thread if this isn’t a quick fix.
For what it’s worth. I was able to get the WT103 modeling working by downloading the latest files (lstm_wt103 and itos_wt103). I then had to add a few lines to the config parameter as shown below and wrote the lang_model_learner as shown below and it worked…
I have run into similar issue. Is it possible to download the pre-trained model locally and use it from any location within local directory ? I do not have access to either download from internet or make changes to installation directory. For example, if I donwload wt103 to c:/temp/…Can i specify the location as part of language_model_learner ?