import tokenizer
from torch import tensor
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
model_name = "facebook/blenderbot-400M-distill"
# Load model (download on first run and reference local installation for consequent runs)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
conversation_history = []
history_string = "\n".join(conversation_history)
history_string
input_text ="hello"
input_text
inputs = tokenizer.encode_plus(history_string, input_text, return_tensors="pt")
inputs
tokenizer.pretrained_vocab_files_map
outputs = model.generate(**inputs)
outputs
response = tokenizer.decode(outputs[0], skip_special_tokens=True).strip()
response
conversation_history.append(input_text)
conversation_history.append(response)
conversation_history
while True:
    # Create conversation history string
    history_string = "\n".join(conversation_history)

    # Get the input data from the user
    input_text = input("> ")

    # Tokenize the input text and history
    inputs = tokenizer.encode_plus(history_string, input_text, return_tensors="pt")

    # Generate the response from the model
    outputs = model.generate(**inputs)

    # Decode the response
    response = tokenizer.decode(outputs[0], skip_special_tokens=True).strip()

    # Add interaction to conversation history
    conversation_history.append(input_text)
    conversation_history.append(response)
