Spaces:
Sleeping
Sleeping
Download models/pert_model.py from jaothan/GenAI_project: direct link, hf CLI and curl.
- Browser
- Download file 442 Bytes
-
https://huggingface.co/spaces/jaothan/GenAI_project/resolve/main/models/pert_model.py
- Command line
-
hf download hf://spaces/jaothan/GenAI_project/models/pert_model.py
-
curl -L -o pert_model.py https://huggingface.co/spaces/jaothan/GenAI_project/resolve/main/models/pert_model.py
442 Bytes
| from transformers import BertForSequenceClassification, AdapterConfig | |
| def get_pert_model(config): | |
| model = BertForSequenceClassification.from_pretrained('bert-base-uncased') | |
| adapter_config = AdapterConfig(mh_adapter=True, output_adapter=True, reduction_factor=config['model']['adapter']['reduction_factor']) | |
| model.add_adapter('imdb_adapter', config=adapter_config) | |
| model.train_adapter('imdb_adapter') | |
| return model | |