Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,10 @@
|
|
1 |
import os
|
2 |
-
|
3 |
-
os.system("pip install git+https://github.com/huggingface/optimum.git")
|
4 |
-
os.system("pip install git+https://github.com/huggingface/transformers.git")
|
5 |
-
os.system("pip install --upgrade accelerate")
|
6 |
-
os.system("pip install bitsandbytes")
|
7 |
import gradio as gr
|
8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
9 |
import re
|
10 |
import os
|
11 |
import torch
|
12 |
-
import bitsandbytes
|
13 |
|
14 |
hf_token = os.environ.get('hf_token')
|
15 |
|
@@ -19,8 +14,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
19 |
model_path,
|
20 |
#device_map="auto",
|
21 |
#torch_dtype="auto",
|
22 |
-
trust_remote_code=True
|
23 |
-
load_in_8bit=True
|
24 |
)
|
25 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
26 |
|
|
|
1 |
import os
|
2 |
+
os.system("pip install -q flash_attn==2.7.4.post1 transformers==4.49.0 accelerate>=0.26.0")
|
|
|
|
|
|
|
|
|
3 |
import gradio as gr
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
5 |
import re
|
6 |
import os
|
7 |
import torch
|
|
|
8 |
|
9 |
hf_token = os.environ.get('hf_token')
|
10 |
|
|
|
14 |
model_path,
|
15 |
#device_map="auto",
|
16 |
#torch_dtype="auto",
|
17 |
+
trust_remote_code=True
|
|
|
18 |
)
|
19 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
20 |
|