Spaces:
Running
Running
Create DeepSeek-OCR-vllm/config.py
Browse files
DeepSeek-OCR-master/DeepSeek-OCR-vllm/config.py
CHANGED
|
@@ -1,42 +0,0 @@
|
|
| 1 |
-
# TODO: change modes
|
| 2 |
-
# Tiny: base_size = 512, image_size = 512, crop_mode = False
|
| 3 |
-
# Small: base_size = 640, image_size = 640, crop_mode = False
|
| 4 |
-
# Base: base_size = 1024, image_size = 1024, crop_mode = False
|
| 5 |
-
# Large: base_size = 1280, image_size = 1280, crop_mode = False
|
| 6 |
-
# Gundam: base_size = 1024, image_size = 640, crop_mode = True
|
| 7 |
-
|
| 8 |
-
BASE_SIZE = 1024
|
| 9 |
-
IMAGE_SIZE = 640
|
| 10 |
-
CROP_MODE = True
|
| 11 |
-
MIN_CROPS= 2
|
| 12 |
-
MAX_CROPS= 6 # max:9; If your GPU memory is small, it is recommended to set it to 6.
|
| 13 |
-
MAX_CONCURRENCY = 100 # If you have limited GPU memory, lower the concurrency count.
|
| 14 |
-
NUM_WORKERS = 64 # image pre-process (resize/padding) workers
|
| 15 |
-
PRINT_NUM_VIS_TOKENS = False
|
| 16 |
-
SKIP_REPEAT = True
|
| 17 |
-
MODEL_PATH = 'deepseek-ai/DeepSeek-OCR' # change to your model path
|
| 18 |
-
|
| 19 |
-
# TODO: change INPUT_PATH
|
| 20 |
-
# .pdf: run_dpsk_ocr_pdf.py;
|
| 21 |
-
# .jpg, .png, .jpeg: run_dpsk_ocr_image.py;
|
| 22 |
-
# Omnidocbench images path: run_dpsk_ocr_eval_batch.py
|
| 23 |
-
|
| 24 |
-
INPUT_PATH = ''
|
| 25 |
-
OUTPUT_PATH = ''
|
| 26 |
-
|
| 27 |
-
PROMPT = '<image>\n<|grounding|>Convert the document to markdown.'
|
| 28 |
-
# PROMPT = '<image>\nFree OCR.'
|
| 29 |
-
# TODO commonly used prompts
|
| 30 |
-
# document: <image>\n<|grounding|>Convert the document to markdown.
|
| 31 |
-
# other image: <image>\n<|grounding|>OCR this image.
|
| 32 |
-
# without layouts: <image>\nFree OCR.
|
| 33 |
-
# figures in document: <image>\nParse the figure.
|
| 34 |
-
# general: <image>\nDescribe this image in detail.
|
| 35 |
-
# rec: <image>\nLocate <|ref|>xxxx<|/ref|> in the image.
|
| 36 |
-
# '先天下之忧而忧'
|
| 37 |
-
# .......
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
from transformers import AutoTokenizer
|
| 41 |
-
|
| 42 |
-
TOKENIZER = AutoTokenizer.from_pretrained(MODEL_PATH, trust_remote_code=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|