Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
import os
|
2 |
-
|
3 |
os.system("git clone https://github.com/TimDettmers/bitsandbytes.git")
|
4 |
os.system("cd bitsandbytes/ && pip install -r requirements-dev.txt && cmake -DCOMPUTE_BACKEND=cuda -S . && make && pip install .")
|
5 |
# Check if GPU is available
|
6 |
import gradio as gr
|
7 |
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
8 |
import torch
|
|
|
9 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
10 |
print(f"Using device: {device}")
|
11 |
-
|
|
|
12 |
if device.type == "cuda":
|
13 |
bnb_config = BitsAndBytesConfig(
|
14 |
load_in_4bit=True,
|
|
|
1 |
import os
|
2 |
+
os.system("pip3 install torch==2.2.1 torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu121")
|
3 |
os.system("git clone https://github.com/TimDettmers/bitsandbytes.git")
|
4 |
os.system("cd bitsandbytes/ && pip install -r requirements-dev.txt && cmake -DCOMPUTE_BACKEND=cuda -S . && make && pip install .")
|
5 |
# Check if GPU is available
|
6 |
import gradio as gr
|
7 |
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
|
8 |
import torch
|
9 |
+
|
10 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
11 |
print(f"Using device: {device}")
|
12 |
+
model_name = "ruslanmv/Medical-Llama3-8B"
|
13 |
+
device_map = 'auto'
|
14 |
if device.type == "cuda":
|
15 |
bnb_config = BitsAndBytesConfig(
|
16 |
load_in_4bit=True,
|