Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/Generator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def generate_paraphrase(self, payload):
sentence = text
text_to_paraphrase = "paraphrase: " + sentence + " </s>"

encoding = self.tokenizer.encode_plus(text_to_paraphrase, pad_to_max_length=True, return_tensors="pt")
encoding = self.tokenizer.encode_plus(text_to_paraphrase, padding="max_length", truncation=True, return_tensors="pt")
input_ids, attention_masks = encoding["input_ids"].to(self.device), encoding["attention_mask"].to(self.device)

beam_outputs = self.model.generate(
Expand Down
4 changes: 2 additions & 2 deletions backend/Generator/mcq.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def generate_multiple_choice_questions(keyword_sent_mapping, device, tokenizer,
text = context + " " + "answer: " + answer + " </s>"
batch_text.append(text)

encoding = tokenizer.batch_encode_plus(batch_text, pad_to_max_length=True, return_tensors="pt")
encoding = tokenizer.batch_encode_plus(batch_text, padding="max_length", truncation=True, return_tensors="pt")

print("Generating questions using the model...")
input_ids, attention_masks = encoding["input_ids"].to(device), encoding["attention_mask"].to(device)
Expand Down Expand Up @@ -223,7 +223,7 @@ def generate_normal_questions(keyword_sent_mapping, device, tokenizer, model):
text = context + " " + "answer: " + answer + " </s>"
batch_text.append(text)

encoding = tokenizer.batch_encode_plus(batch_text, pad_to_max_length=True, return_tensors="pt")
encoding = tokenizer.batch_encode_plus(batch_text, padding="max_length", truncation=True, return_tensors="pt")

print("Running model for generation...")
input_ids, attention_masks = encoding["input_ids"].to(device), encoding["attention_mask"].to(device)
Expand Down