36 lines
1.7 KiB
Markdown
36 lines
1.7 KiB
Markdown
# gFun - RAI
|
|
|
|
## Setup:
|
|
```
|
|
git clone https://gitea-s2i2s.isti.cnr.it/andrea.pedrotti/gfun_multimodal.git
|
|
cd gfun_multimodal
|
|
mkdir models
|
|
mkdir resources
|
|
# optional
|
|
mkdir models/category_mappers
|
|
```
|
|
In `models`, scaricare i modelli pre-trained condivisi. La directory `models` contiene 3 subdir `metaclassifier, vgfs, vectorizer`.
|
|
In `resources` estrarre i muse-embeddings.
|
|
In `models/category_mappers` estrarre il file csv che contiene il mapping da category label a category id (opzionale).
|
|
|
|
## Inference:
|
|
Per eseguire la classificazione dei documenti:
|
|
|
|
```python
|
|
python infer.py --datapth <path/to/the/csv_file.csv>
|
|
```
|
|
|
|
I risultati saranno salvati di default nella cartella `results/inference-preds`, in un file csv denominato a seconda input file specificato in `--datapath` + il timetamp della run (e.g., `<csv_file>_<240312_13345>.csv`) (è possibile cambiare directory di output tramite `--outdir <my/output/dir/>`)
|
|
|
|
NB: per ottenere i nomi (stringhe) delle classi predette è necessario specificare il path del file csv che contiene il mapping class id -> class label (argomento `--category_map`).
|
|
|
|
```
|
|
optional arguments:
|
|
-h, --help show this help message and exit
|
|
--datapath path to csv file containing the documents to be classified
|
|
--outdir path to store csv file containing gfun predictions (default=results/inference-preds)
|
|
--category_map path to csv file containing the mapping from label name to label id [str: id] (default=None)
|
|
--nlabels number of target classes defined in the annotation schema (default=28)
|
|
--muse_dir path to muse embeddings
|
|
--trained_gfun name of the trained gfun instance
|
|
``` |