ipvikas commited on
Commit
89c38bf
1 Parent(s): b8c19dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -148,9 +148,9 @@ all_words = [stem(w) for w in all_words if w not in ignore_words]
148
  all_words = sorted(set(all_words))
149
  tags = sorted(set(tags))
150
 
151
- print(len(xy), "patterns")
152
- print(len(tags), "tags:", tags)
153
- print(len(all_words), "unique stemmed words:", all_words)
154
 
155
  # create training data
156
  X_train = []
@@ -173,7 +173,7 @@ learning_rate = 0.001
173
  input_size = len(X_train[0])
174
  hidden_size = 8
175
  output_size = len(tags)
176
- print(input_size, output_size)
177
 
178
  class ChatDataset(Dataset):
179
 
@@ -193,7 +193,7 @@ class ChatDataset(Dataset):
193
  import torch
194
  import torch.nn as nn
195
 
196
- from model import NeuralNet
197
 
198
  dataset = ChatDataset()
199
  train_loader = DataLoader(dataset=dataset,batch_size=batch_size,shuffle=True,num_workers=2)
@@ -226,7 +226,7 @@ for epoch in range(num_epochs):
226
  print (f'Epoch [{epoch+1}/{num_epochs}], Loss: {loss.item():.4f}')
227
 
228
 
229
- print(f'final loss: {loss.item():.4f}')
230
 
231
  data = {
232
  "model_state": model.state_dict(),
@@ -240,7 +240,7 @@ data = {
240
  FILE = "data.pth"
241
  torch.save(data, FILE)
242
 
243
- print(f'training complete. file saved to {FILE}')
244
 
245
  # !nvidia-smi
246
  #https://github.com/python-engineer/pytorch-chatbot
@@ -268,7 +268,7 @@ import json
268
 
269
  import torch
270
 
271
- from model import NeuralNet
272
  #from nltk_utils import bag_of_words, tokenize
273
 
274
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
 
148
  all_words = sorted(set(all_words))
149
  tags = sorted(set(tags))
150
 
151
+ #print(len(xy), "patterns") #commented
152
+ #print(len(tags), "tags:", tags) #commented
153
+ #print(len(all_words), "unique stemmed words:", all_words) #commented
154
 
155
  # create training data
156
  X_train = []
 
173
  input_size = len(X_train[0])
174
  hidden_size = 8
175
  output_size = len(tags)
176
+ #print(input_size, output_size) #commented
177
 
178
  class ChatDataset(Dataset):
179
 
 
193
  import torch
194
  import torch.nn as nn
195
 
196
+ #from model import NeuralNet
197
 
198
  dataset = ChatDataset()
199
  train_loader = DataLoader(dataset=dataset,batch_size=batch_size,shuffle=True,num_workers=2)
 
226
  print (f'Epoch [{epoch+1}/{num_epochs}], Loss: {loss.item():.4f}')
227
 
228
 
229
+ #print(f'final loss: {loss.item():.4f}')#commented
230
 
231
  data = {
232
  "model_state": model.state_dict(),
 
240
  FILE = "data.pth"
241
  torch.save(data, FILE)
242
 
243
+ #print(f'training complete. file saved to {FILE}') #commented
244
 
245
  # !nvidia-smi
246
  #https://github.com/python-engineer/pytorch-chatbot
 
268
 
269
  import torch
270
 
271
+ #from model import NeuralNet
272
  #from nltk_utils import bag_of_words, tokenize
273
 
274
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')