Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -36,9 +36,17 @@ device = "cuda" # for GPU usage or "cpu" for CPU usage
|
|
36 |
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
37 |
model = AutoModelForCausalLM.from_pretrained(
|
38 |
MODEL,
|
39 |
-
torch_dtype=torch.
|
|
|
40 |
device_map="auto")
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
|
44 |
@spaces.GPU()
|
|
|
36 |
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
37 |
model = AutoModelForCausalLM.from_pretrained(
|
38 |
MODEL,
|
39 |
+
torch_dtype=torch.float16,
|
40 |
+
low_cpu_mem_usage=True,
|
41 |
device_map="auto")
|
42 |
|
43 |
+
pipeline = transformers.pipeline(
|
44 |
+
"text-generation",
|
45 |
+
model=model_id,
|
46 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
47 |
+
device_map="auto",
|
48 |
+
)
|
49 |
+
|
50 |
|
51 |
|
52 |
@spaces.GPU()
|