47 Commits

Author SHA1 Message Date
xming521 ab863cf134 refactor(infer): enhance guided decoding parameter handling
- Updated the guided decoding parameter logic to support dynamic imports, improving compatibility with different configurations.
- Simplified the creation of guided decoding parameters by introducing a helper function.
- Modified the retry mechanism in the OpenAI API call to retry on all exceptions, enhancing robustness in error handling.
2026-03-29 11:25:18 +08:00
xming521 27d877aad3 refactor(infer): improve guided decoding error handling in online inference
- Replaced the previous parsing logic with enhanced error handling for JSON extraction from LLM outputs.
- Introduced detailed logging for failed requests and unexpected result types, improving traceability of issues during inference.
- Updated the import statement to reflect the new utility function for JSON extraction.
2026-01-04 18:07:37 +08:00
xming521 1107500c41 chore: update dependencies and configuration
- Updated Python version requirement in `pyproject.toml` to 3.12.
- Adjusted dependency specifications for `llamafactory`, `torch`, `torchvision`, and `torchaudio` to include version constraints.
2026-01-04 16:15:15 +08:00
xming521 5669838a91 refactor(infer): improve LLM result parsing error logs
Enhance error messages when JSON parsing of LLM outputs fails in
offline inference. The system now dynamically extracts relevant
text snippets based on the response object type (e.g., RequestOutput,
ChatCompletion), making error logs more informative.

Additionally, suppress verbose debug/info logs from the OpenAI client
and httpx to reduce console noise during online inference.

Update the 'WC-exp' submodule and add 'models_final/*' to .gitignore
for repository hygiene.
2025-09-03 13:31:06 +08:00
xming521 c1c7530630 feat(infer): add guided decoding for online and offline models
Introduces a unified utility to parse and validate JSON-structured outputs
from both vLLM and OpenAI API inference results using Pydantic models.
This enables guided decoding for the OnlineLLM.chat method.
The existing guided decoding logic in vllm_infer is refactored to use
this new shared utility, improving consistency and error handling across
inference modes.
2025-08-29 16:03:57 +08:00
xming521 a0829d2098 feat(cleaning): add batch processing for online LLM
Introduce a ThreadPoolExecutor in the OnlineLLM class to enable
concurrent API calls, significantly boosting throughput for LLM operations.
Refactor the OlineLLMCleaningStrategy to leverage this new batching
capability, allowing multiple data points to be processed in parallel.

Increase the default `clean_batch_size` in settings and enhance
`n_process`/`batch_size` for PII detection to optimize for the new
concurrency. Simplify prompt management by removing a dedicated prompt
for online LLM cleaning. Add context manager support to OnlineLLM for
reliable resource cleanup. Ensure LLM chat responses explicitly request
JSON format.
2025-08-28 21:30:05 +08:00
xming521 5dcaad0e10 perf(infer): clear cuda cache after inference
Adds a call to empty the CUDA cache immediately after the LLM object is deleted, ensuring prompt release of GPU memory. This helps prevent out-of-memory issues and improves resource utilization for subsequent operations.
2025-08-17 15:18:37 +08:00
xming521 e90f05c12a refactor(data): improve data cleaning robustness
Allow `vllm_infer` to return `None` for failed JSON parsing results,
clarifying the sequence index for such failures. This enables
`LLMCleaningStrategy` to robustly align parsed LLM scores with original data,
correctly handling examples where JSON parsing failed by assigning a default
score of 0.

Adds an option to disable data cleaning during training setup.
2025-08-17 14:30:17 +08:00
xming521 a3f39495de feat(core): enable configurable thinking and cleaning
Introduces a new 'enable_thinking' configuration for LLM interactions.
This allows dynamic control of thinking behavior in both offline inference
and the data cleaning process. When thinking is enabled for cleaning,
the maximum number of new tokens is increased to accommodate longer
reasoning outputs.

Also reduces the repetition penalty in the cleaning strategy for
improved response diversity and skips data entries containing images
during the LLM cleaning process to avoid irrelevant processing.
2025-08-11 15:34:27 +08:00
xming521 ff0015a2ba performance : some improve 2025-08-09 21:35:43 +08:00
xming521 66e7fdbeb4 test(PII) add tests for PII 2025-07-14 17:26:44 +08:00
xming521 49d62b3fda performance(PII): add batch PII detection
Implements batch processing for PII detection to improve
performance. Also, fixes a bug in the PII detection logic
and updates the installation instructions in the README.
2025-07-14 12:55:01 +08:00
xming521 3993d34a8e Revert "refactor(PII): Initializes engines in ChinesePIIDetector"
This reverts commit 94402cfcc4.
2025-07-10 21:07:31 +08:00
xming521 94402cfcc4 refactor(PII): Initializes engines in ChinesePIIDetector
Initializes the analyzer engines within the
ChinesePIIDetector class, ensuring proper
setup and custom recognizer loading during object
instantiation. This enhances the PII detection
process for Chinese-specific contexts.
2025-07-10 21:00:06 +08:00
xming521 3e7892fc76 feat(infer): add retry mechanism to API calls
Adds retry logic for OpenAI and image description API calls
to improve resilience against transient errors and rate
limiting. Implements exponential backoff with configurable
parameters.
2025-07-10 19:29:23 +08:00
xming521 a24442b78d feat(PII): enhance PII detection for Chinese
Improves PII detection for Chinese language data by:

- Adding a Chinese-specific PII detector that inherits from
  the base PII detector.
- Incorporating custom recognizers for common Chinese PII
  patterns (e.g., phone numbers, ID cards).
- Filtering out irrelevant country-specific entities when
  processing Chinese text.
- Adding unicode escape id recognizer.

These changes ensure more accurate and comprehensive
identification of sensitive information in Chinese datasets.
2025-07-10 12:10:09 +08:00
xming521 a3120fca43 更新README文档,修正平台支持表格中的内容,调整评分标准的描述,增加逻辑性和相关性评判的说明;在online_infer.py中添加TODO注释以实现线程池并发处理。 2025-07-05 15:21:39 +08:00
xming521 d113218e42 更新README文档;修改清理策略中的评分解析逻辑。 2025-07-04 20:51:38 +08:00
xming521 16ec7178d7 更新README文档,翻译部分内容为英文并调整格式; 翻译注释 和 日志。 2025-06-30 20:02:25 +08:00
xming521 2f9cc52955 更新pyproject.toml以添加pip依赖;优化README文档,增强数据预处理说明;调整日志系统配置,支持从配置文件读取日志等级;重构PII检测器,简化代码并添加自定义识别器;更新数据处理逻辑以支持多语言和隐私过滤。 2025-06-27 23:05:45 +08:00
xming521 6df8c5cf2f 使用presidio进行隐私过滤 ; 添加语言支持配置;优化日志系统,hook标准logging到loguru。 2025-06-26 22:54:45 +08:00
xming521 aeedf9eefb 优化vllm_infer函数,添加失败索引返回,改进JSON解析逻辑;在QaPairScore中设置评分范围,更新清理策略以处理解析失败的情况。 2025-06-22 20:20:53 +08:00
xming521 0ef327b4a5 更新配置文件,优化vllm_infer函数的参数传递逻辑。 2025-06-21 16:13:17 +08:00
xming521 81999f861a 在offline_infer.py中添加从文本中提取JSON内容的功能,并优化vllm_infer函数的结果解析;在strategies.py中修正vllm_infer的输出处理逻辑。 2025-06-21 13:50:17 +08:00
pre-commit-ci[bot] 3e0f08c7cb 🎈 auto fixes by pre-commit hooks 2025-06-21 03:21:06 +00:00
xming521 7066730201 优化vllm_infer函数,移除无用的guided_decoding参数,并在length_cdf.py中添加计算文本token长度的功能。 2025-06-21 11:20:23 +08:00
xming521 f3c2fa6ef7 更新pyproject.toml中的vllm依赖版本至0.9.1;离线推理改为chat方式调用。 2025-06-14 21:38:35 +08:00
xming521 19e1fde810 更新数据清理策略中的max_new_tokens和enable_thinking参数以优化推理过程。 2025-06-14 11:40:31 +08:00
xming521 4ca715768e 新增enable_thinking参数以支持推理过程中的思考功能;更新repetition_penalty和max_new_tokens配置以优化数据清理策略。 2025-06-13 21:36:06 +08:00
xming521 55fdfe2520 新增vllm_args配置,更新测试模型参数配置,允许自定义测试数据路径。 2025-06-13 18:27:24 +08:00
xming521 45a579716f fix ci 2025-06-13 12:05:29 +08:00
pre-commit-ci[bot] cf30258091 🎈 auto fixes by pre-commit hooks 2025-06-09 03:27:38 +00:00
niuben 5085a34fe3 实现在线LLM清洗数据 2025-05-22 20:04:45 +08:00
niuben bcf89d22e9 实现在线LLM清洗数据 2025-05-22 19:50:57 +08:00
xming521 42585eb663 更新版本号至 0.2.21,并在离线推理中添加 GPU 内存利用率参数。 2025-05-18 22:28:51 +08:00
xming521 2db76b0968 在 qa_generator.py 中添加 vLLM 可用性检查并调整数据清洗逻辑;在 log.py 中设置日志级别为 INFO。 2025-05-17 23:04:56 +08:00
xming521 f4fa2df82e Merge remote-tracking branch 'origin/master' into dev 2025-05-17 20:18:58 +08:00
Hanyu 33fb27811a 优化CSV文件读取
- 增加CSV文件排序功能,按文件名中起始序号排序
- 添加启用vllm的 bitsandbytes 量化加载的注释选项
2025-05-17 14:11:55 +08:00
xming521 4478cfbaa0 在 strategies.py 中添加对 vLLM 可用性的检查,并根据可用性选择推理引擎。暂不可用 2025-05-16 13:19:44 +08:00
xming521 b16bd303e3 更新.gitignore以忽略输出文件,更新README.md以优化文本描述,修改vllm_infer.py和strategies.py以支持自定义禁用词配置。 2025-05-11 19:37:08 +08:00
xming521 528de9970b 固定length_cdf 单卡运行;去掉vllm_infer.py并行推理。 2025-05-05 22:48:45 +08:00
xming521 91286029e1 fix vllm 2025-05-05 21:29:28 +08:00
xming521 5a48ab4ceb 修改vllm_infer.py以支持禁用\n,调整strategies.py以引入重复惩罚参数。 2025-05-05 20:35:24 +08:00
xming521 631c1731ed 重构vllm_infer.py以支持新的输入类型和引入引导解码参数,新增QaPairScore模型以支持评分功能,实现大模型对数据评分。 2025-05-04 22:52:09 +08:00
xming521 035d138d8d 更新pyproject.toml版本至0.2.2,优化vllm_infer函数以支持前缀缓存,调整qa_generator.py以处理结果并保存为JSON格式。 2025-05-01 23:04:37 +08:00
xming521 20904b0202 更新vllm依赖版本至0.8.2 2025-05-01 19:39:15 +08:00
xming521 9827a24929 更新依赖项版本,提升torch和torchaudio至2.6.0,更新openai至1.52.0 相应更新test_model,调整pytorch源为cu124。 2025-04-29 22:47:02 +08:00