Hyacinthax commited on
Commit
4c17df7
·
verified ·
1 Parent(s): e23baa9

Fixed Previous Error

Browse files

There was an error saying ChatbotTrainer was None, It's now fixed.

Files changed (1) hide show
  1. runCorpus.py +5 -9
runCorpus.py CHANGED
@@ -1,7 +1,8 @@
1
- # runMovieCorpus.py
2
  import os
3
  from playsound3 import playsound
4
  import tensorflow
 
5
  import time
6
  import random
7
  import pdb
@@ -10,12 +11,10 @@ import matplotlib.pyplot as plt
10
 
11
  # Personal files
12
  from preprocessed_dialogs import dialog_data
13
- from chatbotTrainer import ChatbotTrainer
14
 
15
 
16
  class CorpusTrainer:
17
  def __init__(self):
18
- self.chatbot_trainer = None
19
  self.running_trouble = None
20
  self.choices_yes = ["yes", "ya", "yeah", "yessir", "yesir", "y", "ye", "yah"]
21
  self.exit_commands = ["exit", "quit", "stop", "x", "q", ""]
@@ -61,6 +60,7 @@ class CorpusTrainer:
61
 
62
  # Initialize the corpus (Needed for convo-kit to initialize) Only needed when reading/creating the dialogs
63
  self.corpus_path = '/root/.convokit/saved-corpora/movie-corpus'
 
64
  self.chatbot_trainer.load_corpus(self.corpus_path)
65
 
66
  def main(self, chatbot_trainer, user_choice, dialog_data, topConvo=0, top_num=0, play_notification=0):
@@ -340,12 +340,8 @@ class CorpusTrainer:
340
 
341
  if __name__ == "__main__":
342
  while True:
343
- # Initialize the corpus (Needed for convo-kit to initialize) Only needed when reading/creating the dialogs
344
- corpus_path = '/root/.convokit/saved-corpora/movie-corpus'
345
- chatbot_trainer = ChatbotTrainer()
346
- chatbot_trainer.load_corpus(corpus_path)
347
  app = CorpusTrainer()
348
- user_choice = input(f"Run Supervised?({chatbot_trainer.model_filename})\n>")
349
  play_notification = input(f"Would you like to play a notification after each training?\nHelps with manual stopping before max_vocabulary reached... \n>")
350
- app.main(chatbot_trainer=chatbot_trainer, user_choice=user_choice, dialog_data=dialog_data, play_notification=play_notification)
351
 
 
1
+ # self.runMovieCorpus.py
2
  import os
3
  from playsound3 import playsound
4
  import tensorflow
5
+ from chatbotTrainer import ChatbotTrainer
6
  import time
7
  import random
8
  import pdb
 
11
 
12
  # Personal files
13
  from preprocessed_dialogs import dialog_data
 
14
 
15
 
16
  class CorpusTrainer:
17
  def __init__(self):
 
18
  self.running_trouble = None
19
  self.choices_yes = ["yes", "ya", "yeah", "yessir", "yesir", "y", "ye", "yah"]
20
  self.exit_commands = ["exit", "quit", "stop", "x", "q", ""]
 
60
 
61
  # Initialize the corpus (Needed for convo-kit to initialize) Only needed when reading/creating the dialogs
62
  self.corpus_path = '/root/.convokit/saved-corpora/movie-corpus'
63
+ self.chatbot_trainer = ChatbotTrainer()
64
  self.chatbot_trainer.load_corpus(self.corpus_path)
65
 
66
  def main(self, chatbot_trainer, user_choice, dialog_data, topConvo=0, top_num=0, play_notification=0):
 
340
 
341
  if __name__ == "__main__":
342
  while True:
 
 
 
 
343
  app = CorpusTrainer()
344
+ user_choice = input(f"Run Supervised?({app.chatbot_trainer.model_filename})\n>")
345
  play_notification = input(f"Would you like to play a notification after each training?\nHelps with manual stopping before max_vocabulary reached... \n>")
346
+ app.main(chatbot_trainer=app.chatbot_trainer, user_choice=user_choice, dialog_data=dialog_data, play_notification=play_notification)
347