Closed movabo closed 3 years ago
The PR is ready for merge now. When you want add a new version of the model, you can update this by adding
@provide_pretrained("vX.Y.Z", "https://github.com/fhamborg/NewsMTSC/releases/download/vX.Y.Z/grutsc")
to grutscsingle.py.
To automatically download this version when using --state_dict pretrained
, adjust the following lines:
- @default_pretrained("v1.0.0")
+ @default_pretrained("vX.Y.Z")
If you want to add pretrained models for other architectures (e.g. LCF_BERT), change following lines:
/models/signletarget/lcf.py
:
- from models.FXBaseModel import FXBaseModel
+ from models.FXBaseModel import FXBaseModel, provide_pretrained, default_pretrained
+
+ @default_pretrained("vX.Y.Z")
+ @provide_pretrained("vX.Y.Z", "https://github.com/fhamborg/NewsMTSC/releases/download/vX.Y.Z/<NAME_OF_LCF_BERT>")
class LCF_BERT(FXBaseModel):
hubconf.py
+ from models.singletarget.lcf import LCF_BERT
Then, the newly added model should be automatically downloaded when e.g. executing python infer.py --own_model_name lcf_bert
.
I'm sorry, it seems that my notes weren't submitted yet (wrote them 1-2 days ago, but didnt hit the submit button)
I implemented now a download utility as per my last comment.
For a simple download to get NewsMTSC running, python download.py
is sufficient.
Also, I added version handling to the download utility. Help-text:
usage: download.py [-h] [--own_model_name OWN_MODEL_NAME] [--version VERSION]
[--force] [--list_versions]
optional arguments:
-h, --help show this help message and exit
--own_model_name OWN_MODEL_NAME
--version VERSION version of the model to download, use --force to
overwrite a version which was already downloaded
--force force the download of a model and overwrite potential
previous versions
--list_versions List all pretrained model versions which a model
provides
Bugs fixed:
AttributeError: spacy.pipeline.DependencyParser object has no attribute 'labels'
-> Allow spacy versions greater 2.0.*ModuleNotFoundError: No module named 'models.singletarget.stancedetectionpaper'
-> Local import in method where it's requiredModuleNotFoundError: No module named 'models.singletarget.knowledgesourceshosseiniatdbert'
-> Local import in method where it's required