Spaces:
Running
on
Zero
Running
on
Zero
VictorSanh
commited on
Commit
•
92f5f56
1
Parent(s):
dc6da18
fixes
Browse files- app_dialogue.py +10 -7
app_dialogue.py
CHANGED
@@ -1,7 +1,14 @@
|
|
1 |
-
import copy
|
2 |
import os
|
3 |
-
import spaces
|
4 |
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
import time
|
6 |
import torch
|
7 |
|
@@ -14,15 +21,11 @@ import gradio as gr
|
|
14 |
from transformers import AutoProcessor, TextIteratorStreamer
|
15 |
from transformers import Idefics2ForConditionalGeneration
|
16 |
|
17 |
-
# Install flash attention
|
18 |
-
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
19 |
-
# Install private transformers fork which is the only place where idefics2 has been integrated at the time being
|
20 |
-
subprocess.run(f"pip install git+https://VictorSanh:{os.environ['TRANSFORMERS_NEW_MODEL_ADDITION_TOKEN']}@github.com/huggingface/new-model-addition.git@fae11925a79d34fb0a9d6562941cacc177bd3f53", shell=True)
|
21 |
|
22 |
DEVICE = torch.device("cuda")
|
23 |
MODELS = {
|
24 |
"idefics2-8b (sft)": Idefics2ForConditionalGeneration.from_pretrained(
|
25 |
-
"/
|
26 |
torch_dtype=torch.bfloat16,
|
27 |
_attn_implementation="flash_attention_2",
|
28 |
trust_remote_code=True,
|
|
|
|
|
1 |
import os
|
|
|
2 |
import subprocess
|
3 |
+
|
4 |
+
# Install flash attention
|
5 |
+
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
6 |
+
# Install private transformers fork which is the only place where idefics2 has been integrated at the time being
|
7 |
+
subprocess.run(f"pip install git+https://VictorSanh:{os.environ['TRANSFORMERS_NEW_MODEL_ADDITION_TOKEN']}@github.com/huggingface/new-model-addition.git@fae11925a79d34fb0a9d6562941cacc177bd3f53", shell=True)
|
8 |
+
|
9 |
+
|
10 |
+
import copy
|
11 |
+
import spaces
|
12 |
import time
|
13 |
import torch
|
14 |
|
|
|
21 |
from transformers import AutoProcessor, TextIteratorStreamer
|
22 |
from transformers import Idefics2ForConditionalGeneration
|
23 |
|
|
|
|
|
|
|
|
|
24 |
|
25 |
DEVICE = torch.device("cuda")
|
26 |
MODELS = {
|
27 |
"idefics2-8b (sft)": Idefics2ForConditionalGeneration.from_pretrained(
|
28 |
+
"HuggingFaceM4/idefics2-8b",
|
29 |
torch_dtype=torch.bfloat16,
|
30 |
_attn_implementation="flash_attention_2",
|
31 |
trust_remote_code=True,
|