Spaces:
Running
on
Zero
Running
on
Zero
MaziyarPanahi
commited on
Commit
•
91c00b7
1
Parent(s):
cae47a4
Update app.py (#5)
Browse files- Update app.py (c87ec9644a320e9ac07345acd0b2133e896dc515)
app.py
CHANGED
@@ -8,6 +8,9 @@ from PIL import Image
|
|
8 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
9 |
from transformers import TextIteratorStreamer
|
10 |
|
|
|
|
|
|
|
11 |
PLACEHOLDER = """
|
12 |
<div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
|
13 |
<h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">microsoft/Phi-3-vision-128k-instruct</h1>
|
@@ -17,6 +20,8 @@ user_prompt = '<|user|>\n'
|
|
17 |
assistant_prompt = '<|assistant|>\n'
|
18 |
prompt_suffix = "<|end|>\n"
|
19 |
|
|
|
|
|
20 |
model_id = "microsoft/Phi-3-vision-128k-instruct"
|
21 |
|
22 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
|
|
8 |
from transformers import AutoProcessor, AutoModelForCausalLM
|
9 |
from transformers import TextIteratorStreamer
|
10 |
|
11 |
+
import subprocess
|
12 |
+
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
13 |
+
|
14 |
PLACEHOLDER = """
|
15 |
<div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
|
16 |
<h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">microsoft/Phi-3-vision-128k-instruct</h1>
|
|
|
20 |
assistant_prompt = '<|assistant|>\n'
|
21 |
prompt_suffix = "<|end|>\n"
|
22 |
|
23 |
+
|
24 |
+
|
25 |
model_id = "microsoft/Phi-3-vision-128k-instruct"
|
26 |
|
27 |
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|