amaresh8053 commited on
Commit
9aba057
·
verified ·
1 Parent(s): 91d21db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -11
app.py CHANGED
@@ -52,17 +52,9 @@ class Vocab:
52
 
53
 
54
  # ------------- load vocab from cache -------------
55
- if not os.path.exists(CACHE_FILE):
56
- raise FileNotFoundError(f"Cache file {CACHE_FILE} not found. Please upload ubuntu_data_cache.pt")
57
-
58
- cache = torch.load(CACHE_FILE, map_location="cpu", weights_only=False)
59
- # train_pairs = cache["train"]
60
- # test_pairs = cache["test"]
61
- vocab = cache["vocab"]
62
-
63
- # safety: rebuild idx2word if needed
64
- if not hasattr(vocab, "idx2word") or len(vocab.idx2word) != len(vocab.word2idx):
65
- vocab.idx2word = {i: w for w, i in vocab.word2idx.items()}
66
 
67
  PAD_IDX = vocab.word2idx["<PAD>"]
68
  SOS_IDX = vocab.word2idx["<SOS>"]
 
52
 
53
 
54
  # ------------- load vocab from cache -------------
55
+ print("Loading vocab...")
56
+ data = torch.load("ubuntu_vocab_only.pt", map_location="cpu", weights_only=False)
57
+ vocab = data["vocab"]
 
 
 
 
 
 
 
 
58
 
59
  PAD_IDX = vocab.word2idx["<PAD>"]
60
  SOS_IDX = vocab.word2idx["<SOS>"]