bogdancazan/wikilarge-text-simplification
Viewer • Updated • 150k • 375 • 5
How to use JeremyLi96/Control_Token_Joint with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "summarization" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("summarization", model="JeremyLi96/Control_Token_Joint") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("JeremyLi96/Control_Token_Joint")
model = AutoModelForSeq2SeqLM.from_pretrained("JeremyLi96/Control_Token_Joint")# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("JeremyLi96/Control_Token_Joint")
model = AutoModelForSeq2SeqLM.from_pretrained("JeremyLi96/Control_Token_Joint")A customised model based on MUSS, with added special tokens and tokenization method.
The 4 control tokens are "<DEPENDENCYTREEDEPTHRATIO_1.0>", "<WORDRANKRATIO_1.0>", "<REPLACEONLYLEVENSHTEIN_1.0>", "<LENGTHRATIO_1.0>", whose values range from 0.2 to 1.5 (except for the REPLACEONLYLEVENSHTEIN maximises at 1.0).
Here is a sample input:"<DEPENDENCYTREEDEPTHRATIO_0.65> <WORDRANKRATIO_0.6> <REPLACEONLYLEVENSHTEIN_0.8> <LENGTHRATIO_0.8> He advocates applying a user-centered design process in product development cycles and also works towards popularizing interaction design as a mainstream discipline."
# Use a pipeline as a high-level helper # Warning: Pipeline type "summarization" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("summarization", model="JeremyLi96/Control_Token_Joint")