@@ -193,42 +193,105 @@ For any questions, please check [FAQ](https://github.com/open-sciencelab/GraphGe
193193 ` ` `
194194 - Set the following environment variables:
195195 ` ` ` bash
196- # Synthesizer is the model used to construct KG and generate data
197- SYNTHESIZER_MODEL=your_synthesizer_model_name
198- SYNTHESIZER_BASE_URL=your_base_url_for_synthesizer_model
199- SYNTHESIZER_API_KEY=your_api_key_for_synthesizer_model
200- # Trainee is the model used to train with the generated data
201- TRAINEE_MODEL=your_trainee_model_name
202- TRAINEE_BASE_URL=your_base_url_for_trainee_model
203- TRAINEE_API_KEY=your_api_key_for_trainee_model
196+ # Tokenizer
197+ TOKENIZER_MODEL=
198+
199+ # LLM
200+ # Support different backends: http_api, openai_api, ollama_api, ollama, huggingface, tgi, sglang, tensorrt
201+ # Synthesizer is the model used to construct KG and generate data
202+ # Trainee is the model used to train with the generated data
203+
204+ # http_api / openai_api
205+ SYNTHESIZER_BACKEND=openai_api
206+ SYNTHESIZER_MODEL=gpt-4o-mini
207+ SYNTHESIZER_BASE_URL=
208+ SYNTHESIZER_API_KEY=
209+ TRAINEE_BACKEND=openai_api
210+ TRAINEE_MODEL=gpt-4o-mini
211+ TRAINEE_BASE_URL=
212+ TRAINEE_API_KEY=
213+
214+ # azure_openai_api
215+ # SYNTHESIZER_BACKEND=azure_openai_api
216+ # The following is the same as your "Deployment name" in Azure
217+ # SYNTHESIZER_MODEL=<your-deployment-name>
218+ # SYNTHESIZER_BASE_URL=https://<your-resource-name>.openai.azure.com/openai/deployments/<your-deployment-name>/chat/completions
219+ # SYNTHESIZER_API_KEY=
220+ # SYNTHESIZER_API_VERSION=<api-version>
221+
222+ # # ollama_api
223+ # SYNTHESIZER_BACKEND=ollama_api
224+ # SYNTHESIZER_MODEL=gemma3
225+ # SYNTHESIZER_BASE_URL=http://localhost:11434
226+ #
227+ # Note: TRAINEE with ollama_api backend is not supported yet as ollama_api does not support logprobs.
228+
229+ # # huggingface
230+ # SYNTHESIZER_BACKEND=huggingface
231+ # SYNTHESIZER_MODEL=Qwen/Qwen2.5-0.5B-Instruct
232+ #
233+ # TRAINEE_BACKEND=huggingface
234+ # TRAINEE_MODEL=Qwen/Qwen2.5-0.5B-Instruct
235+
236+ # # sglang
237+ # SYNTHESIZER_BACKEND=sglang
238+ # SYNTHESIZER_MODEL=Qwen/Qwen2.5-0.5B-Instruct
239+ # SYNTHESIZER_TP_SIZE=1
240+ # SYNTHESIZER_NUM_GPUS=1
241+
242+ # TRAINEE_BACKEND=sglang
243+ # TRAINEE_MODEL=Qwen/Qwen2.5-0.5B-Instruct
244+ # SYNTHESIZER_TP_SIZE=1
245+ # SYNTHESIZER_NUM_GPUS=1
246+
247+ # # vllm
248+ # SYNTHESIZER_BACKEND=vllm
249+ # SYNTHESIZER_MODEL=Qwen/Qwen2.5-0.5B-Instruct
250+ # SYNTHESIZER_NUM_GPUS=1
251+
252+ # TRAINEE_BACKEND=vllm
253+ # TRAINEE_MODEL=Qwen/Qwen2.5-0.5B-Instruct
254+ # TRAINEE_NUM_GPUS=1
204255 ` ` `
205- 2. (Optional) Customize generation parameters in ` graphgen/configs/ ` folder .
256+ 2. (Optional) Customize generation parameters in ` config.yaml ` .
206257
207258 Edit the corresponding YAML file, e.g.:
208259
209260 ` ` ` yaml
210- # configs/cot_config.yaml
211- input_file: resources/input_examples/jsonl_demo.jsonl
212- output_data_type: cot
213- tokenizer: cl100k_base
261+ # examples/generate/generate_aggregated_qa/aggregated_config.yaml
262+ global_params:
263+ working_dir: cache
264+ graph_backend: kuzu # graph database backend, support: kuzu, networkx
265+ kv_backend: rocksdb # key-value store backend, support: rocksdb, json_kv
266+
267+ nodes:
268+ - id: read_files # id is unique in the pipeline, and can be referenced by other steps
269+ op_name: read
270+ type: source
271+ dependencies: []
272+ params:
273+ input_path:
274+ - examples/input_examples/jsonl_demo.jsonl # input file path, support json, jsonl, txt, pdf. See examples/input_examples for examples
275+
214276 # additional settings...
215277 ` ` `
216278
2172793. Generate data
218280
219281 Pick the desired format and run the matching script:
220-
221- | Format | Script to run | Notes |
222- | --------------| ------------------------------------------------| -------------------------------------------------------------------|
223- | ` cot` | ` bash scripts/generate/generate_cot.sh` | Chain-of-Thought Q\& A pairs |
224- | ` atomic` | ` bash scripts/generate/generate_atomic.sh` | Atomic Q\& A pairs covering basic knowledge |
225- | ` aggregated` | ` bash scripts/generate/generate_aggregated.sh` | Aggregated Q\& A pairs incorporating complex, integrated knowledge |
226- | ` multi-hop` | ` bash scripts/generate/generate_multihop.sh` | Multi-hop reasoning Q\& A pairs |
282+
283+ | Format | Script to run | Notes |
284+ | ------------ | ---------------------------------------------------------------------- | -------------------------------------------------------------------------- |
285+ | ` cot` | ` bash examples/generate/generate_cot_qa/generate_cot.sh` | Chain-of-Thought Q\& A pairs |
286+ | ` atomic` | ` bash examples/generate/generate_atomic_qa/generate_atomic.sh` | Atomic Q\& A pairs covering basic knowledge |
287+ | ` aggregated` | ` bash examples/generate/generate_aggregated_qa/generate_aggregated.sh` | Aggregated Q\& A pairs incorporating complex, integrated knowledge |
288+ | ` multi-hop` | ` examples/generate/generate_multi_hop_qa/generate_multi_hop.sh` | Multi-hop reasoning Q\& A pairs |
289+ | ` vqa` | ` bash examples/generate/generate_vqa/generate_vqa.sh` | Visual Question Answering pairs combining visual and textual understanding |
227290
228291
2292924. Get the generated data
230293 ` ` ` bash
231- ls cache/data/graphgen
294+ ls cache/output
232295 ` ` `
233296
234297# ## Run with Docker
0 commit comments