1

Using this code, or a variant of, is there anything that can be added to "trick" opt into conversing as another user in a style more similar to a chatbot. As of now it will either start something more similar to an article or have a conversation with itself for a few lines as seen below.

    val = input("Enter your value: ")
    input_ids = tokenizer((val), return_tensors='pt').input_ids

    output = model.generate(input_ids, min_length=1, max_length=1024, penalty_alpha=0.6, top_k=6)
    print("Output:\n" + 100 * '-')
    print(tokenizer.decode(output[0], skip_special_tokens=True))
    print("" + 100 * '-')
    with open("OutputText.txt", "w") as f:
        f.write(tokenizer.decode(output[0], skip_special_tokens=True))


Here's an example of the current output:

*User Input: Hello There.

Model Output: Hello there. I have an egg that matches your TSV. Would you mind hatching it for me? Sure, I'll add you now. Let me know when you're online. Sorry for the late reply. I'm online now for the next few hours. Just send me a trade request whenever you're ready. No probs, I'm in the middle of a battle at the moment, but I'll get you as soon as I'm done. Thank you very much for the hatch. Have a nice day :D *

I've attempted to add a prompt to the start and it hasn't made a difference.

1 Answers1

0

You need to tell OPT-2.7B to work as chatbot.

It look like something like this:

user_input = "Hello There."
prompt = f'You are helpful AI assistant.\n\nYou: {user_input}\nAI'