Building open-domain chatbots is a challenging area for machine learning research. While prior work has shown that scaling neural models in the number of parameters and the size of the data they are trained on gives improved results, we show that other ingredients are important for a high-performing chatbot. Good conversation requires a number of skills that an expert conversationalist blends in a seamless way: providing engaging talking points and listening to their partners, both asking and answering questions, and displaying knowledge, empathy and personality appropriately, depending on the situation. We show that large scale models can learn these skills when given appropriate training data and choice of generation strategy. We build variants of these recipes with 90M, 2.7B and 9.4B parameter neural models, and make our models and code publicly available. Human evaluations show our best models are superior to existing approaches in multi-turn dialogue in terms of engagingness and humanness measurements. We then discuss the limitations of this work by analyzing failure cases of our models.
import argparse
import torch
from openmind import pipeline, is_torch_npu_available
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--model_name_or_path", type=str, help="Path to model", default=None)
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_args()
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
print("device",device)
model_path = args.model_name_or_path
print("Model path is:", model_path)
try:
generator = pipeline('text-generation', model=model_path, device=device)
print("Generator initialized successfully")
except Exception as e:
print(f"Error initializing generator: {e}")
try:
output = generator("Hello, I'm a language model,", max_length=30, num_return_sequences=5, num_beams=5, truncation=True)
print("Run successful. Generated outputs:")
for idx, sequence in enumerate(output):
print(f"Generated sequence {idx + 1}: {sequence['generated_text']}")
except Exception as e:
print(f"Error during generation: {e}")