Update README.md
Browse files
README.md
CHANGED
@@ -65,12 +65,14 @@ import torch
|
|
65 |
|
66 |
from Utils import GPTJBlock, GPTJForCausalLM
|
67 |
|
68 |
-
device =
|
69 |
|
70 |
transformers.models.gptj.modeling_gptj.GPTJBlock = GPTJBlock # monkey-patch GPT-J
|
71 |
|
72 |
-
|
73 |
-
|
|
|
|
|
74 |
|
75 |
|
76 |
prompt = tokenizer("El sentido de la vida es", return_tensors='pt')
|
|
|
65 |
|
66 |
from Utils import GPTJBlock, GPTJForCausalLM
|
67 |
|
68 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
69 |
|
70 |
transformers.models.gptj.modeling_gptj.GPTJBlock = GPTJBlock # monkey-patch GPT-J
|
71 |
|
72 |
+
ckpt = "mrm8488/bertin-gpt-j-6B-ES-8bit"
|
73 |
+
|
74 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(ckpt)
|
75 |
+
model = GPTJForCausalLM.from_pretrained(ckpt, pad_token_id=tokenizer.eos_token_id, low_cpu_mem_usage=True).to(device)
|
76 |
|
77 |
|
78 |
prompt = tokenizer("El sentido de la vida es", return_tensors='pt')
|