taprosoft
commited on
Commit
·
2f4a14c
1
Parent(s):
7d03afc
fix: optimization
Browse files- app.py +4 -3
- backends/smoldocling.py +2 -2
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
# Install poppler-utils
|
2 |
import os
|
3 |
-
import subprocess
|
4 |
|
5 |
os.system("apt-get update")
|
6 |
os.system("apt-get install --no-install-recommends -y poppler-utils tesseract-ocr")
|
7 |
os.system("pip3 install --upgrade pip wheel setuptools")
|
8 |
-
os.system(
|
|
|
|
|
9 |
|
10 |
|
11 |
import time
|
@@ -392,7 +393,7 @@ with gr.Blocks(
|
|
392 |
outputs=visualization_sub_tabs,
|
393 |
)
|
394 |
|
395 |
-
demo.queue(default_concurrency_limit=
|
396 |
show_error=True,
|
397 |
max_file_size="50mb",
|
398 |
)
|
|
|
1 |
# Install poppler-utils
|
2 |
import os
|
|
|
3 |
|
4 |
os.system("apt-get update")
|
5 |
os.system("apt-get install --no-install-recommends -y poppler-utils tesseract-ocr")
|
6 |
os.system("pip3 install --upgrade pip wheel setuptools")
|
7 |
+
os.system(
|
8 |
+
"FLASH_ATTENTION_SKIP_CUDA_BUILD=true pip3 install flash-attn --no-build-isolation"
|
9 |
+
)
|
10 |
|
11 |
|
12 |
import time
|
|
|
393 |
outputs=visualization_sub_tabs,
|
394 |
)
|
395 |
|
396 |
+
demo.queue(default_concurrency_limit=4).launch(
|
397 |
show_error=True,
|
398 |
max_file_size="50mb",
|
399 |
)
|
backends/smoldocling.py
CHANGED
@@ -10,7 +10,7 @@ from PIL import Image
|
|
10 |
from vllm import LLM, SamplingParams
|
11 |
|
12 |
# Configuration
|
13 |
-
MAX_PAGES =
|
14 |
MODEL_PATH = "ds4sd/SmolDocling-256M-preview"
|
15 |
PROMPT_TEXT = "Convert page to Docling."
|
16 |
|
@@ -21,7 +21,7 @@ chat_template = f"<|im_start|>User:<image>{PROMPT_TEXT}<end_of_utterance>\nAssis
|
|
21 |
|
22 |
sampling_params = SamplingParams(
|
23 |
temperature=0.0,
|
24 |
-
max_tokens=4096,
|
25 |
)
|
26 |
|
27 |
|
|
|
10 |
from vllm import LLM, SamplingParams
|
11 |
|
12 |
# Configuration
|
13 |
+
MAX_PAGES = 2
|
14 |
MODEL_PATH = "ds4sd/SmolDocling-256M-preview"
|
15 |
PROMPT_TEXT = "Convert page to Docling."
|
16 |
|
|
|
21 |
|
22 |
sampling_params = SamplingParams(
|
23 |
temperature=0.0,
|
24 |
+
max_tokens=4096 * 2,
|
25 |
)
|
26 |
|
27 |
|