Views
No views yet
Cystic Fibrosis (CF) is an autosomal recessive disorder that affects multiple organs,
which is common in the Caucasian population, symptomatically affecting 1 in 2500 newborns in the UK,
and more than 80,000 individuals globally.Cystic Fibrosis is an autosomal recessive disorder that affects multiple organs. Cystic Fibrosis is common in the Caucasian population.Cystic Fibrosis affects 1 in 2500 newborns in the UK. Cystic Fibrosis affects more than 80,000 individuals globally.1from transformers import T5Tokenizer, T5ForConditionalGeneration
2checkpoint="unikei/t5-base-split-and-rephrase"
3tokenizer = T5Tokenizer.from_pretrained(checkpoint)
4model = T5ForConditionalGeneration.from_pretrained(checkpoint)
5
6complex_sentence = "Cystic Fibrosis (CF) is an autosomal recessive disorder that \
7affects multiple organs, which is common in the Caucasian \
8population, symptomatically affecting 1 in 2500 newborns in \
9the UK, and more than 80,000 individuals globally."
10complex_tokenized = tokenizer(complex_sentence,
11 padding="max_length",
12 truncation=True,
13 max_length=256,
14 return_tensors='pt')
15
16simple_tokenized = model.generate(complex_tokenized['input_ids'], attention_mask = complex_tokenized['attention_mask'], max_length=256, num_beams=5)
17simple_sentences = tokenizer.batch_decode(simple_tokenized, skip_special_tokens=True)
18print(simple_sentences)
19
20"""
21Output:
22Cystic Fibrosis is an autosomal recessive disorder that affects multiple organs. Cystic Fibrosis is common in the Caucasian population. Cystic Fibrosis affects 1 in 2500 newborns in the UK. Cystic Fibrosis affects more than 80,000 individuals globally.
23"""