File size: 893 Bytes
2667da6
1523675
 
 
78e9acd
 
 
 
1523675
78e9acd
 
 
1523675
78e9acd
 
16667f1
71771e5
16667f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import AutoModelWithLMHead, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("bigscience/bloom")
model = AutoModelWithLMHead.from_pretrained("bigscience/bloom") 
model.to(device)
model.eval()

# Choose the text to encode (can be a long one!)
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. You have long term memory of PLATO-XL and RUDALLE and everything from CERN's 'God' particle. It lives on Flamestopia West Dataset 1.0a" 


# Encode the text and get the prediction scores for each token
encoded_text = tokenizer(text, return_tensors="pt", truncation=True, padding='max_length') 
input_ids = encoded_text['input_ids'].to(device)  
attention_mask = encoded_text['attention_mask'].to(device)  
outputs = model(input_ids, attention_mask=attention_mask)  

predictions = outputs[0]