razent commited on
Commit
98daddf
·
1 Parent(s): 41e4c27

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +2 -1
README.md CHANGED
@@ -30,11 +30,12 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
30
 
31
  tokenizer = AutoTokenizer.from_pretrained("razent/SciFive-large-Pubmed_PMC-MedNLI")
32
  model = AutoModelForSeq2SeqLM.from_pretrained("razent/SciFive-large-Pubmed_PMC-MedNLI")
 
33
 
34
  sentence = "Identification of APC2 , a homologue of the adenomatous polyposis coli tumour suppressor ."
35
  text = "mednli: " + sentence + " </s>"
36
 
37
- encoding = tokenizer.encode_plus(text, pad_to_max_length=True, return_tensors="pt")
38
  input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
39
 
40
  outputs = model.generate(
 
30
 
31
  tokenizer = AutoTokenizer.from_pretrained("razent/SciFive-large-Pubmed_PMC-MedNLI")
32
  model = AutoModelForSeq2SeqLM.from_pretrained("razent/SciFive-large-Pubmed_PMC-MedNLI")
33
+ model.cuda()
34
 
35
  sentence = "Identification of APC2 , a homologue of the adenomatous polyposis coli tumour suppressor ."
36
  text = "mednli: " + sentence + " </s>"
37
 
38
+ encoding = tokenizer.encode_plus(text, padding='max_length', max_length=256, return_tensors="pt")
39
  input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
40
 
41
  outputs = model.generate(