|
Download README.md from stefra/glance-text: direct link, hf CLI and curl.
- Browser
- Download file 2.28 kB
-
https://huggingface.co/stefra/glance-text/resolve/main/README.md
- Command line
-
hf download hf://stefra/glance-text/README.md
-
curl -L -o README.md https://huggingface.co/stefra/glance-text/resolve/main/README.md
2.28 kB
| library_name: pytorch | |
| base_model: FacebookAI/roberta-large | |
| tags: | |
| - glance | |
| - statement-tuning | |
| - zero-shot-classification | |
| - semantic-operators | |
| # glance-text | |
| Architettura **GLANCE**: encoder addestrato con statement tuning multi-domanda | |
| (template di [statement-tuning](https://github.com/afz225/statement-tuning), adattati alla forma stato/statement): dato un testo (lo **stato**) e uno o piu' **statement**, | |
| restituisce la probabilita' che ogni statement sia vero. | |
| Gli statement condividono lo stato nella stessa sequenza, ma una maschera di attenzione bidirezionale a blocchi li | |
| rende indipendenti: il punteggio di uno statement e' identico a quello che si otterrebbe valutandolo da solo. | |
| ## Uso | |
| Basta `transformers`: il codice del modello e' incluso nel repository (`trust_remote_code=True`). | |
| ```python | |
| from transformers import AutoModel | |
| model = AutoModel.from_pretrained("stefra/glance-text", trust_remote_code=True) | |
| model.predict("The vase is broken.", ["The vase is intact.", "It is sad."]) # un array, uno per domanda | |
| model.predict([("The vase is broken.", ["It is sad."]), # batch di (stato, domande): | |
| ("I love it.", ["It is positive.", "It is sad."])]) # una lista di array, uno per stato | |
| ``` | |
| Non e' un modello generativo: `predict` restituisce la probabilita' che ogni statement sia vero. Su GPU il modello | |
| viene caricato in float16; si puo' scegliere con `device=` e `dtype=`. | |
| ## Contenuto | |
| | File | Contenuto | | |
| |---|---| | |
| | `modeling_glance.py` | codice dell'architettura GLANCE, usato da `AutoModel` | | |
| | `config.json` | configurazione per `AutoModel` | | |
| | `backbone/` | encoder fine-tuned (formato transformers) | | |
| | `head.safetensors` | testa vero/falso | | |
| | `statement_encoder.json` | pooling e configurazione del packing usata in training | | |
| | `tokenizer*` | tokenizer | | |
| | `eval_report.json` | metriche per sorgente | | |
| ## Metriche | |
| ### Held-out (task mai visti in training) | |
| | sorgente | n | accuracy | F1 | ROC-AUC | Brier | ECE | | |
| |---|---|---|---|---|---|---| | |
| | ag_news | 3000 | 0.815 | 0.805 | 0.892 | 0.145 | 0.094 | | |
| | emotion | 3000 | 0.736 | 0.719 | 0.786 | 0.207 | 0.128 | | |
| | rotten_tomatoes | 3000 | 0.837 | 0.834 | 0.898 | 0.133 | 0.087 | | |
| | **ALL** | 9000 | 0.796 | 0.787 | 0.864 | 0.162 | 0.103 | | |