Commit
·
eb0cb71
1
Parent(s):
61da180
Update app.py
Browse files
app.py
CHANGED
@@ -20,9 +20,9 @@ device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
20 |
# device_map = infer_auto_device_map(model, dtype="float16")
|
21 |
# st.write(device_map)
|
22 |
|
23 |
-
@st.cache
|
24 |
def load_model():
|
25 |
-
model = AutoModelForCausalLM.from_pretrained("bryanmildort/gpt_neo_notes", low_cpu_mem_usage=True, load_in_8bit=True)
|
26 |
# model.to(device)
|
27 |
tokenizer = AutoTokenizer.from_pretrained("bryanmildort/gpt_neo_notes")
|
28 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
|
|
20 |
# device_map = infer_auto_device_map(model, dtype="float16")
|
21 |
# st.write(device_map)
|
22 |
|
23 |
+
@st.cache(allow_output_mutation=True)
|
24 |
def load_model():
|
25 |
+
model = AutoModelForCausalLM.from_pretrained("bryanmildort/gpt_neo_notes", low_cpu_mem_usage=True, load_in_8bit=True, device_map='auto')
|
26 |
# model.to(device)
|
27 |
tokenizer = AutoTokenizer.from_pretrained("bryanmildort/gpt_neo_notes")
|
28 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|