mrrahul011 commited on
Commit
ebc49f6
1 Parent(s): b6ff5ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -9,9 +9,8 @@ from model_gpt import GPT, GPTConfig
9
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
10
 
11
  #load the model
12
- out_dir = '/content/drive/MyDrive/ERA_V2/Assignment19/nanoGPT/nanoGPT/out-shakespeare-char/'
13
- ckpt_path = os.path.join(out_dir, 'ckpt.pt')
14
- checkpoint = torch.load(ckpt_path, map_location=device)
15
  gptconf = GPTConfig(**checkpoint['model_args'])
16
  model = GPT(gptconf)
17
  state_dict = checkpoint['model']
@@ -22,7 +21,7 @@ for k,v in list(state_dict.items()):
22
  model.load_state_dict(state_dict)
23
 
24
  #load the dataset
25
- with open('/content/drive/MyDrive/ERA_V2/Assignment19/input.txt', 'r', encoding='utf-8') as f:
26
  text = f.read()
27
 
28
  # here are all the unique characters that occur in this text
 
9
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
10
 
11
  #load the model
12
+
13
+ checkpoint = torch.load('ckpt.pt', map_location=device)
 
14
  gptconf = GPTConfig(**checkpoint['model_args'])
15
  model = GPT(gptconf)
16
  state_dict = checkpoint['model']
 
21
  model.load_state_dict(state_dict)
22
 
23
  #load the dataset
24
+ with open('input.txt', 'r', encoding='utf-8') as f:
25
  text = f.read()
26
 
27
  # here are all the unique characters that occur in this text