fhamborg / NewsMTSC

Target-dependent sentiment classification in news articles reporting on political events. Includes a high-quality data set of over 11k sentences and a state-of-the-art classification model.
Other
140 stars 21 forks source link

Fix several bugs, prepare PyTorch hub support #1

Closed movabo closed 3 years ago

movabo commented 3 years ago

Bugs fixed:

movabo commented 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:

fhamborg commented 3 years ago

I'm sorry, it seems that my notes weren't submitted yet (wrote them 1-2 days ago, but didnt hit the submit button)

movabo commented 3 years ago

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