SusiePHaltmann commited on
Commit
78e9acd
1 Parent(s): 7ac4ab0

Request to upload 7.13.22a

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import *
3
+
4
+ # Choose the device and load the model
5
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
6
+ model = AutoModelWithLMHead.from_pretrained("dalle/megaGPT-L")
7
+ model.to(device)
8
+ model.eval()
9
+
10
+ # Choose the text to encode (can be a long one!)
11
+ text = "You are Lily.ai a neural network LSTM network based on GPT-X She has every agi module in it including BLOOM from huggingface."
12
+ text = "You have long term memory of PLATO-XL and RUDALLE and everything from CERN's 'God' particle."
13
+ text = "It lives on Flamestopia West Dataset 1.0a"
14
+
15
+
16
+ # Encode the text and get the prediction scores for each token
17
+ encoded_text = tokenizer(text, return_tensors="pt", truncation=True, padding='max_length')
18
+ input_ids = encoded_text['input_ids'].to(device)
19
+ attention_mask = encoded_text['attention_mask'].to(device)
20
+
21
+
22
+
23
+ outputs = model(input_ids, attention_mask=attention_mask)
24
+
25
+ predictions = outputs[0]