sparrow-parse 0.3.10__tar.gz → 0.3.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/PKG-INFO +1 -1
  2. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/setup.py +1 -1
  3. sparrow-parse-0.3.11/sparrow_parse/__init__.py +1 -0
  4. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/extractors/vllm_extractor.py +30 -30
  5. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/vllm/mlx_inference.py +1 -1
  6. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse.egg-info/PKG-INFO +1 -1
  7. sparrow-parse-0.3.10/sparrow_parse/__init__.py +0 -1
  8. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/README.md +0 -0
  9. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/setup.cfg +0 -0
  10. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/__main__.py +0 -0
  11. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/extractors/__init__.py +0 -0
  12. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/helpers/__init__.py +0 -0
  13. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/helpers/pdf_optimizer.py +0 -0
  14. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/processors/__init__.py +0 -0
  15. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/processors/table_structure_processor.py +0 -0
  16. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/vllm/__init__.py +0 -0
  17. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/vllm/huggingface_inference.py +0 -0
  18. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/vllm/inference_base.py +0 -0
  19. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/vllm/inference_factory.py +0 -0
  20. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse/vllm/local_gpu_inference.py +0 -0
  21. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse.egg-info/SOURCES.txt +0 -0
  22. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse.egg-info/dependency_links.txt +0 -0
  23. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse.egg-info/entry_points.txt +0 -0
  24. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse.egg-info/requires.txt +0 -0
  25. {sparrow-parse-0.3.10 → sparrow-parse-0.3.11}/sparrow_parse.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sparrow-parse
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: Sparrow Parse is a Python package (part of Sparrow) for parsing and extracting information from documents.
5
5
  Home-page: https://github.com/katanaml/sparrow/tree/main/sparrow-data/parse
6
6
  Author: Andrej Baranovskij
@@ -8,7 +8,7 @@ with open("requirements.txt", "r", encoding="utf-8") as fh:
8
8
 
9
9
  setup(
10
10
  name="sparrow-parse",
11
- version="0.3.10",
11
+ version="0.3.11",
12
12
  author="Andrej Baranovskij",
13
13
  author_email="andrejus.baranovskis@gmail.com",
14
14
  description="Sparrow Parse is a Python package (part of Sparrow) for parsing and extracting information from documents.",
@@ -0,0 +1 @@
1
+ __version__ = '0.3.11'
@@ -55,33 +55,33 @@ if __name__ == "__main__":
55
55
 
56
56
  extractor = VLLMExtractor()
57
57
 
58
- # # export HF_TOKEN="hf_"
59
- # config = {
60
- # "method": "mlx", # Could be 'huggingface', 'mlx' or 'local_gpu'
61
- # "model_name": "mlx-community/Qwen2-VL-72B-Instruct-4bit",
62
- # # "hf_space": "katanaml/sparrow-qwen2-vl-7b",
63
- # # "hf_token": os.getenv('HF_TOKEN'),
64
- # # Additional fields for local GPU inference
65
- # # "device": "cuda", "model_path": "model.pth"
66
- # }
67
- #
68
- # # Use the factory to get the correct instance
69
- # factory = InferenceFactory(config)
70
- # model_inference_instance = factory.get_inference_instance()
71
- #
72
- # input_data = [
73
- # {
74
- # "file_path": "/Users/andrejb/Work/katana-git/sparrow/sparrow-ml/llm/data/bonds_table.png",
75
- # "text_input": "retrieve all data. return response in JSON format"
76
- # }
77
- # ]
78
- #
79
- # # Now you can run inference without knowing which implementation is used
80
- # results_array, num_pages = extractor.run_inference(model_inference_instance, input_data, generic_query=False,
81
- # debug_dir=None,
82
- # debug=True,
83
- # mode=None)
84
- #
85
- # for i, result in enumerate(results_array):
86
- # print(f"Result for page {i + 1}:", result)
87
- # print(f"Number of pages: {num_pages}")
58
+ # export HF_TOKEN="hf_"
59
+ config = {
60
+ "method": "mlx", # Could be 'huggingface', 'mlx' or 'local_gpu'
61
+ "model_name": "mlx-community/Qwen2-VL-72B-Instruct-4bit",
62
+ # "hf_space": "katanaml/sparrow-qwen2-vl-7b",
63
+ # "hf_token": os.getenv('HF_TOKEN'),
64
+ # Additional fields for local GPU inference
65
+ # "device": "cuda", "model_path": "model.pth"
66
+ }
67
+
68
+ # Use the factory to get the correct instance
69
+ factory = InferenceFactory(config)
70
+ model_inference_instance = factory.get_inference_instance()
71
+
72
+ input_data = [
73
+ {
74
+ "file_path": "/Users/andrejb/Work/katana-git/sparrow/sparrow-ml/llm/data/oracle_10k_2014_q1_small.pdf",
75
+ "text_input": "retrieve table, description, latest_amount, previous_amount. return response in JSON format, by strictly following this JSON schema: {\"table\": [{\"description\": \"str\", \"latest_amount\": 0, \"previous_amount\": 0}]}"
76
+ }
77
+ ]
78
+
79
+ # Now you can run inference without knowing which implementation is used
80
+ results_array, num_pages = extractor.run_inference(model_inference_instance, input_data, generic_query=False,
81
+ debug_dir=None,
82
+ debug=True,
83
+ mode=None)
84
+
85
+ for i, result in enumerate(results_array):
86
+ print(f"Result for page {i + 1}:", result)
87
+ print(f"Number of pages: {num_pages}")
@@ -52,7 +52,7 @@ class MLXInference(ModelInference):
52
52
  formatted_json = json.loads(cleaned_text)
53
53
  return json.dumps(formatted_json, indent=2)
54
54
  except json.JSONDecodeError as e:
55
- print(f"Failed to parse JSON: {e}")
55
+ print(f"Failed to parse JSON in MLX inference backend: {e}")
56
56
  return output_text
57
57
 
58
58
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sparrow-parse
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: Sparrow Parse is a Python package (part of Sparrow) for parsing and extracting information from documents.
5
5
  Home-page: https://github.com/katanaml/sparrow/tree/main/sparrow-data/parse
6
6
  Author: Andrej Baranovskij
@@ -1 +0,0 @@
1
- __version__ = '0.3.10'
File without changes
File without changes