PrithivirajDamodaran / Parrot_Paraphraser

A practical and feature-rich paraphrasing framework to augment human intents in text form to build robust NLU models for conversational engines. Created by Prithiviraj Damodaran. Open to pull requests and other forms of collaboration.
Apache License 2.0
866 stars 141 forks source link

Issue in model output. Model's output changed to NoneType #51

Open qaixerabbas opened 1 year ago

qaixerabbas commented 1 year ago

I used the following code to generate the augmented paraphrased sentences. After the last model's output changed to NoneType. Although I am iterating over my question lists, it outputs None. I am not sure about it and could not find any issues.

import time
ts = time.time()
augmented_questions = []
for question in finance_list:
  para_phrases = parrot.augment(input_phrase=question.lower(), use_gpu=False)
  print(f"Length of para phrased by model are: {len(para_phrases)}")
  for aug in para_phrases:
    print(f"Printing aug in this: {aug}")
    augmented_questions.append(aug)
    print(f"Appended the {aug} with type {type(aug)}")

te = time.time()
print(len(augmented_questions))
print(f"time taken to augment " + str(len(questions)) + " is "+ str(te-ts) + " seconds ")

ChatGPT suggested to add the line of code for checking the NoneType in output (line 7 below). Anyone has information why I am getting this NoneType error from model output?

import time
ts = time.time()
augmented_questions = []
#19 thy without .lower()
for question in finance_list:
  para_phrases = parrot.augment(input_phrase=question.lower(), use_gpu=False)
  if para_phrases is not None:
    print(f"Length of para phrased by model are: {len(para_phrases)}")
    for aug in para_phrases:
      print(f"Printing aug in this: {aug}")
      augmented_questions.append(aug)
      print(f"Appended the {aug} with type {type(aug)}")

te = time.time()
print(len(augmented_questions))
print(f"time taken to augment " + str(len(questions)) + " is "+ str(te-ts) + " seconds ")
qingzhengse commented 1 year ago

It will work if you lower down the threshold.