Views
No views yet
namednil/sip-d4-pt and the documentation in the git repo). The main use is in fine-tuning.1import transformers, torch
2tokenizer = transformers.AutoTokenizer.from_pretrained("google/byt5-small")
3model = transformers.AutoModelForSeq2SeqLM.from_pretrained("namednil/sip-d4", trust_remote_code=True)
4# (always make sure to check the remote code on Huggingface!)
5
6# Construct an optimizer that uses the SIP-finetuning procedure:
7optimizer = model.get_optimizer(torch.optim.Adam, prefix_lr=1.0, lr=3e-4)
8# ... fine-tune the model as usual
9
10# The above code uses a random initialization of the tunable prefix of SIP.
11# If you don't want that and have more control over the length of the tunable prefix, run:
12
13config = transformers.AutoConfig.from_pretrained("namednil/sip-d4", trust_remote_code=True)
14config.random_selection = False
15config.prefix_length = 50
16model = transformers.AutoModelForSeq2SeqLM.from_pretrained("namednil/sip-d4", config=config, trust_remote_code=True)1@inproceedings{lindemann-etal-2024-sip,
2 title = "{SIP}: Injecting a Structural Inductive Bias into a {S}eq2{S}eq Model by Simulation",
3 author = "Lindemann, Matthias and
4 Koller, Alexander and
5 Titov, Ivan",
6 booktitle = "Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
7 month = aug,
8 year = "2024",
9 address = "Bangkok, Thailand",
10 publisher = "Association for Computational Linguistics",
11 url = "https://aclanthology.org/2024.acl-long.355/",
12 doi = "10.18653/v1/2024.acl-long.355",
13}