Views
No views yet
1from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
2
3model_path = "allenai/tailor"
4generator = pipeline("text2text-generation",
5 model=AutoModelForSeq2SeqLM.from_pretrained(model_path),
6 tokenizer=AutoTokenizer.from_pretrained(model_path),
7 framework="pt", device=0)
8
9prompt_text = "[VERB+active+past: comfort | AGENT+complete: the doctor | PATIENT+partial: athlete | LOCATIVE+partial: in] <extra_id_0> , <extra_id_1> <extra_id_2> <extra_id_3> ."
10generator(prompt_text, max_length=200)1@misc{ross2021tailor,
2 title={Tailor: Generating and Perturbing Text with Semantic Controls},
3 author={Alexis Ross and Tongshuang Wu and Hao Peng and Matthew E. Peters and Matt Gardner},
4 year={2021},
5 eprint={2107.07150},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2107.07150},
9}