-
Notifications
You must be signed in to change notification settings - Fork 63
feat: add pdf_reader & tests for MinerUParser #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
35b7b8f
feat: add pdf_reader & tests for MinerUParser
ChenZiHong-Gavin 010b9ae
fix: delete useless code
ChenZiHong-Gavin 7a1457f
feat(graphgen): add vqa configs
ChenZiHong-Gavin 110390d
wip: vqa config
ChenZiHong-Gavin 2b904e7
Update graphgen/graphgen.py
ChenZiHong-Gavin 685f5d2
Update graphgen/generate.py
ChenZiHong-Gavin d00c663
Update tests/integration_tests/models/reader/test_mineru_parser.py
ChenZiHong-Gavin 1d0bcd3
fix: fix docstring
ChenZiHong-Gavin e6e02eb
docs: update webui input files
ChenZiHong-Gavin d88c479
Merge branch 'feat/pdf-reader' of https://github.com/open-sciencelab/…
ChenZiHong-Gavin ce6ce4b
feat: auto pick device for mineru
ChenZiHong-Gavin f487673
Update graphgen/models/generator/vqa_generator.py
ChenZiHong-Gavin 2434f27
Update graphgen/operators/read/read_files.py
ChenZiHong-Gavin 285689b
Update graphgen/configs/atomic_config.yaml
ChenZiHong-Gavin 6d6f160
fix: fix lint problems
ChenZiHong-Gavin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| read: | ||
| input_file: resources/input_examples/pdf_demo.pdf # input file path, support json, jsonl, txt, pdf. See resources/input_examples for examples | ||
| split: | ||
| chunk_size: 1024 # chunk size for text splitting | ||
| chunk_overlap: 100 # chunk overlap for text splitting | ||
| search: # web search configuration | ||
| enabled: false # whether to enable web search | ||
| search_types: ["google"] # search engine types, support: google, bing, uniprot, wikipedia | ||
| quiz_and_judge: # quiz and test whether the LLM masters the knowledge points | ||
| enabled: true | ||
| quiz_samples: 2 # number of quiz samples to generate | ||
| re_judge: false # whether to re-judge the existing quiz samples | ||
| partition: # graph partition configuration | ||
| method: ece # ece is a custom partition method based on comprehension loss | ||
| method_params: | ||
| max_units_per_community: 20 # max nodes and edges per community | ||
| min_units_per_community: 5 # min nodes and edges per community | ||
| max_tokens_per_community: 10240 # max tokens per community | ||
| unit_sampling: max_loss # unit sampling strategy, support: random, max_loss, min_loss | ||
| generate: | ||
| mode: vqa # atomic, aggregated, multi_hop, cot, vqa | ||
| data_format: ChatML # Alpaca, Sharegpt, ChatML |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| from dataclasses import dataclass | ||
| from typing import Any | ||
|
|
||
| from graphgen.bases import BaseGenerator | ||
|
|
||
|
|
||
| @dataclass | ||
| class VQAGenerator(BaseGenerator): | ||
| @staticmethod | ||
| def build_prompt( | ||
| batch: tuple[list[tuple[str, dict]], list[tuple[Any, Any, dict]]] | ||
| ) -> str: | ||
| raise NotImplementedError( | ||
| "VQAGenerator.build_prompt is not implemented. " | ||
| "Please provide an implementation for VQA prompt construction." | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def parse_response(response: str) -> Any: | ||
| raise NotImplementedError( | ||
| "VQAGenerator.parse_response is not implemented. " | ||
| "Please provide an implementation for VQA response parsing." | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| from .csv_reader import CsvReader | ||
| from .json_reader import JsonReader | ||
| from .jsonl_reader import JsonlReader | ||
| from .txt_reader import TxtReader | ||
| from .csv_reader import CSVReader | ||
| from .json_reader import JSONReader | ||
| from .jsonl_reader import JSONLReader | ||
| from .pdf_reader import PDFReader | ||
| from .txt_reader import TXTReader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.