metadata
language: en
tags:
- controlled generation
- perturbation
widget:
- text: >-
[VERB+passive+past: break | PATIENT+partial: cup] <extra_id_0>
<extra_id_1> <extra_id_2> .
- max_length: null
β
Polyjuice
β
Model description
β This is a ported version of Tailor, the general-purpose counterfactual generator. For more code release, please refer to this github page. β
How to use
β
from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
β
# TODO: change to the correct name
model_path = "uw-hai/tailor_private"
generator = pipeline("text2text-generation",
model=AutoModelForSeq2SeqLM.from_pretrained(model_path),
tokenizer=AutoTokenizer.from_pretrained(model_path),
framework="pt", device=0)
β
prompt_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> ."
generator(prompt_text, max_length=200)