Update README.md
Browse files
README.md
CHANGED
@@ -103,34 +103,27 @@ def generate_response(model, tokenizer, messages):
|
|
103 |
return generations[0].split(tokenizer.eos_token)[0]
|
104 |
|
105 |
def main():
|
106 |
-
# Initialize the model and tokenizer
|
107 |
print("Initializing model and tokenizer...")
|
108 |
model, tokenizer = initialize_model()
|
109 |
|
110 |
-
# Store conversation history
|
111 |
messages = []
|
112 |
|
113 |
print("Chat initialized. Type 'quit' to exit.")
|
114 |
print("-" * 50)
|
115 |
|
116 |
while True:
|
117 |
-
# Get user input
|
118 |
user_input = input("\nYou: ").strip()
|
119 |
|
120 |
-
# Check if user wants to quit
|
121 |
if user_input.lower() == 'quit':
|
122 |
print("\nEnding conversation. Goodbye!")
|
123 |
break
|
124 |
|
125 |
-
# Add user message to conversation history
|
126 |
messages.append({"role": "user", "content": user_input})
|
127 |
|
128 |
-
# Generate response
|
129 |
print("\nAssistant: ", end="")
|
130 |
response = generate_response(model, tokenizer, messages)
|
131 |
print(response)
|
132 |
|
133 |
-
# Add assistant's response to conversation history
|
134 |
messages.append({"role": "assistant", "content": response})
|
135 |
|
136 |
if __name__ == "__main__":
|
|
|
103 |
return generations[0].split(tokenizer.eos_token)[0]
|
104 |
|
105 |
def main():
|
|
|
106 |
print("Initializing model and tokenizer...")
|
107 |
model, tokenizer = initialize_model()
|
108 |
|
|
|
109 |
messages = []
|
110 |
|
111 |
print("Chat initialized. Type 'quit' to exit.")
|
112 |
print("-" * 50)
|
113 |
|
114 |
while True:
|
|
|
115 |
user_input = input("\nYou: ").strip()
|
116 |
|
|
|
117 |
if user_input.lower() == 'quit':
|
118 |
print("\nEnding conversation. Goodbye!")
|
119 |
break
|
120 |
|
|
|
121 |
messages.append({"role": "user", "content": user_input})
|
122 |
|
|
|
123 |
print("\nAssistant: ", end="")
|
124 |
response = generate_response(model, tokenizer, messages)
|
125 |
print(response)
|
126 |
|
|
|
127 |
messages.append({"role": "assistant", "content": response})
|
128 |
|
129 |
if __name__ == "__main__":
|