Alexandre-Numind commited on
Commit
a408e76
·
verified ·
1 Parent(s): 1a7a373

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -15,8 +15,8 @@ from nuextract_logging import log_event
15
 
16
 
17
  MAX_INPUT_SIZE = 100_000
18
- MAX_NEW_TOKENS = 8_000
19
- MAX_WINDOW_SIZE = 1_000
20
 
21
  markdown_description = """
22
  <!DOCTYPE html>
@@ -74,7 +74,7 @@ def predict_chunk(text, template, current, model, tokenizer):
74
  input_llm = f"<|input|>\n### Template:\n{template}\n### Current:\n{current}\n### Text:\n{text}\n\n<|output|>" + "{"
75
  input_ids = tokenizer(input_llm, return_tensors="pt", truncation=True, max_length=MAX_INPUT_SIZE).to("cuda")
76
  output = tokenizer.decode(model.generate(**input_ids, max_new_tokens=MAX_NEW_TOKENS, do_sample=False)[0], skip_special_tokens=True)
77
-
78
  return clean_json_text(output.split("<|output|>")[1])
79
 
80
  def sliding_window_prediction(template, text, model, tokenizer, window_size=4000, overlap=128):
 
15
 
16
 
17
  MAX_INPUT_SIZE = 100_000
18
+ MAX_NEW_TOKENS = 4_000
19
+ MAX_WINDOW_SIZE = 10_000
20
 
21
  markdown_description = """
22
  <!DOCTYPE html>
 
74
  input_llm = f"<|input|>\n### Template:\n{template}\n### Current:\n{current}\n### Text:\n{text}\n\n<|output|>" + "{"
75
  input_ids = tokenizer(input_llm, return_tensors="pt", truncation=True, max_length=MAX_INPUT_SIZE).to("cuda")
76
  output = tokenizer.decode(model.generate(**input_ids, max_new_tokens=MAX_NEW_TOKENS, do_sample=False)[0], skip_special_tokens=True)
77
+ print(output)
78
  return clean_json_text(output.split("<|output|>")[1])
79
 
80
  def sliding_window_prediction(template, text, model, tokenizer, window_size=4000, overlap=128):