Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,14 +27,14 @@ def init():
|
|
27 |
histories = []
|
28 |
#model = None
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
if not is_hugging_face:
|
33 |
-
model = AutoModelForCausalLM.from_pretrained(
|
34 |
model_id, token=huggingface_token ,torch_dtype=dtype,device_map=device
|
35 |
)
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
38 |
if next(model.parameters()).is_cuda:
|
39 |
print("The model is on a GPU")
|
40 |
else:
|
|
|
27 |
histories = []
|
28 |
#model = None
|
29 |
|
30 |
+
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
31 |
model_id, token=huggingface_token ,torch_dtype=dtype,device_map=device
|
32 |
)
|
33 |
+
text_generator = pipeline("text-generation", model=model, tokenizer=tokenizer,torch_dtype=dtype,device_map=device ) #pipeline has not to(device)
|
34 |
+
|
35 |
+
|
36 |
+
if not is_hugging_face:
|
37 |
+
|
38 |
if next(model.parameters()).is_cuda:
|
39 |
print("The model is on a GPU")
|
40 |
else:
|