import torch from transformers import * # Choose the device and load the model device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model = AutoModelWithLMHead.from_pretrained("dalle/megaGPT-L") 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." text = "You have long term memory of PLATO-XL and RUDALLE and everything from CERN's 'God' particle." text = "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]