prithivMLmods commited on
Commit
57cc3ef
·
verified ·
1 Parent(s): 6587f40

update app

Browse files
Files changed (1) hide show
  1. app.py +1 -32
app.py CHANGED
@@ -122,37 +122,6 @@ if torch.cuda.is_available():
122
 
123
  print("Using device:", device)
124
 
125
- # CACHE_PATH = "./model_cache"
126
- # if not os.path.exists(CACHE_PATH):
127
- # os.makedirs(CACHE_PATH)
128
- #
129
- # model_path_d_local = snapshot_download(
130
- # repo_id='rednote-hilab/dots.ocr',
131
- # local_dir=os.path.join(CACHE_PATH, 'dots.ocr'),
132
- # max_workers=20,
133
- # local_dir_use_symlinks=False
134
- # )
135
- #
136
- # config_file_path = os.path.join(model_path_d_local, "configuration_dots.py")
137
- #
138
- # if os.path.exists(config_file_path):
139
- # with open(config_file_path, 'r') as f:
140
- # input_code = f.read()
141
- #
142
- # lines = input_code.splitlines()
143
- # if "class DotsVLProcessor" in input_code and not any("attributes = " in line for line in lines):
144
- # output_lines = []
145
- # for line in lines:
146
- # output_lines.append(line)
147
- # if line.strip().startswith("class DotsVLProcessor"):
148
- # output_lines.append(" attributes = [\"image_processor\", \"tokenizer\"]")
149
- #
150
- # with open(config_file_path, 'w') as f:
151
- # f.write('\n'.join(output_lines))
152
- # print("Patched configuration_dots.py successfully.")
153
- #
154
- #sys.path.append(model_path_d_local)
155
-
156
  MAX_MAX_NEW_TOKENS = 4096
157
  DEFAULT_MAX_NEW_TOKENS = 2048
158
  MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
@@ -178,7 +147,7 @@ model_x = Qwen2_5_VLForConditionalGeneration.from_pretrained(
178
  ).to(device).eval()
179
 
180
  # Load Dots.OCR from the local, patched directory
181
- MODEL_PATH_D = "prithivMLmods/Dots.OCR-Latest-BF16"
182
  processor_d = AutoProcessor.from_pretrained(MODEL_PATH_D, trust_remote_code=True)
183
  model_d = AutoModelForCausalLM.from_pretrained(
184
  MODEL_PATH_D,
 
122
 
123
  print("Using device:", device)
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  MAX_MAX_NEW_TOKENS = 4096
126
  DEFAULT_MAX_NEW_TOKENS = 2048
127
  MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
 
147
  ).to(device).eval()
148
 
149
  # Load Dots.OCR from the local, patched directory
150
+ MODEL_PATH_D = "prithivMLmods/Dots.OCR-Latest-BF16" # -> alt of [rednote-hilab/dots.ocr]
151
  processor_d = AutoProcessor.from_pretrained(MODEL_PATH_D, trust_remote_code=True)
152
  model_d = AutoModelForCausalLM.from_pretrained(
153
  MODEL_PATH_D,