Commit Graph

143 Commits

Author SHA1 Message Date
xming 76e341feef Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-11 10:49:59 +08:00
xhrxgr b8747edf27 fix: 量化配置未传递给 LLaMA-Factory 导致退化为全精度加载
- 新增 QuantizationArgs 配置类,与 LLaMA-Factory QuantizationArguments 对齐
- 移除 load_in_4bit/load_in_8bit(由 quantization_bit 内部处理)
- 新增 quantization_method 支持多种量化后端(bnb, gptq, awq 等)
- 修复 dict_to_argv 跳过 None 值,避免 HfArgumentParser 报错
- 使用 exclude_none=True 防止空字段传递给 run_exp()
- 训练和推理时自动展平嵌套的量化配置
2026-05-10 18:26:09 +08:00
xming 9e892b9da7 Merge branch 'master' into fix/issue-115-check-api-server-before-test 2026-05-03 15:11:02 +08:00
Octopus e6325fd8b7 refactor: derive API server URL from client.base_url for error message
Address Sourcery review feedback - use client.base_url instead of
hardcoding http://127.0.0.1:8005 so the error message stays in sync
if the base URL configuration changes.
2026-04-24 13:02:10 +08:00
octo-patch d8d2c673f4 fix: check API server availability before running test-model (fixes #115)
Add _check_api_server() that probes GET /v1/models before the test loop
starts. When the server is not running, the user now gets a clear error
message with the exact command to start it instead of a cryptic
connection-refused traceback.

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
2026-04-24 12:19:52 +08:00
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 446df58a6c refactor(infer): streamline online model scoring and error handling
- Replaced the previous batch processing logic with a more robust implementation that utilizes guided decoding for improved result parsing.
- Enhanced error logging for failed parsing attempts, providing clearer warnings for issues encountered during inference.
- Updated the score mapping to utilize the new parsed results structure, ensuring accurate score assignment to QA pairs.
2026-01-04 18:14:57 +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 fca6ca1c55 feat(data): enhance conversation message processing in QA generation
- Added logic to handle the "<begin_chat>" marker in user messages, allowing for improved context in conversation flows.
- Updated the message processing to include the assistant's response when the user initiates a chat, ensuring more coherent QA pairs.
- Refactored the handling of conversation messages to maintain clarity and structure in the generated QA data.
2026-01-04 15:47:14 +08:00
xming521 bbe08f0c77 feat(data): enhance chat member relationship handling in QA generation
- Updated the `qa_generator.py` to include a new mechanism for managing chat member relationships, allowing the addition of contextual information about the relationship between users in conversations.
- Refactored the CSV loading function to support loading user relationship data from a `users.json` file, improving the context provided during QA generation.
- Added a new configuration option `add_relation` to the dataset settings, enabling users to toggle this feature.
- Updated the `.gitignore` to exclude additional data directories and cache files for better repository hygiene.
- Bumped version to 0.3.03 in `pyproject.toml` to reflect these changes.
2025-11-01 17:11:26 +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 a887d122af feat(data): include new sticker types in skip list
Expands the list of message types to be skipped or ignored by the application.
This ensures proper handling for user-uploaded GIF stickers and a new sticker
type identified as 'sticker2', preventing potential processing errors.
2025-08-28 22:12:59 +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 41167f6d29 fix(dataset): fix #192 standardize dataset naming and cleaning workflow
Refactors dataset management to consistently append '-vl' for vision-language
datasets and dynamically name cleaned datasets (e.g., 'dataset-cleaned').

Enforces vLLM as a strict dependency for LLM-based data cleaning, exiting if
unavailable. Integrates 'enable_thinking' option for LLM cleaning and enables
cleaning by default in relevant test configurations.

Adds torchvision dependency for vision models and streamlines the cleaning call
in training to centralize decision-making.
2025-08-16 22:51:29 +08:00
xming521 cc34bea317 fix(data): classify gif as animated stickers
Ensures that files with a .gif extension are correctly identified and
categorized as animated expressions or stickers based on the platform.
This improves the accuracy of media type classification during data
processing.
2025-08-15 15:31:45 +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 6b134ea703 feat(dataset): handle image data in LLM cleaning
Updates pre-commit hooks.

Previously, the cleaning pipeline was entirely disabled for datasets

containing image messages.

Image conversations now receive a default score, bypassing text-focused

LLM cleaning. This enables partial cleaning for mixed datasets and

prevents pipeline failures.
2025-08-11 11:03:14 +08:00
xming521 ff0015a2ba performance : some improve 2025-08-09 21:35:43 +08:00
xming521 533b0fa678 refactor(data): converts QA item ID to string
Ensures the ID field for generated QA items is always a string. This provides type consistency for downstream consumers.
2025-07-29 11:28:23 +08:00
xming521 09897a8daf fix(dataset): Data processing results have no images. 2025-07-16 15:18:56 +08:00
xming521 785ad1472a remove wechat 2025-07-16 11:21:11 +08:00
xming521 2a7cb5f30d refactor(data): simplify datetime format
Removes the year from the datetime string included in the system prompt. This makes the prompt more concise.
2025-07-14 17:31:54 +08:00
xming521 66e7fdbeb4 test(PII) add tests for PII 2025-07-14 17:26:44 +08:00
xming521 7ce7fcd47a fix(dataset): fix blocked words filter
Adds a blocked words filter to the dataset creation process.
This prevents undesirable words from appearing in the generated
datasets, enhancing data quality and safety.
A test case is added to verify the filter is working correctly.

Also, skips "text" type in qa_generator to avoid duplicated filter.
2025-07-14 13:38:19 +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 5f34b4561e feat(dataset): adds option to include time
Adds a configuration option to include the current
datetime in the system prompt of the generated dataset.
This allows models to be aware of the temporal context
of the conversations.
2025-07-09 23:15:51 +08:00
xming521 e96853d0fb refactor(dataset): removes newline characters from messages
This commit addresses an issue where newline characters
within text messages were causing problems in downstream
processing. It removes these characters to ensure that
the messages are processed correctly.
2025-07-08 18:31:30 +08:00
xming521 5b47d9b9ab refactor: unifies combined content separator
Consolidates the separator for combined content to a newline character, removing language-specific branching.
This simplifies the logic and ensures consistency across different languages.
2025-07-08 16:52:47 +08:00
xming521 f0476b05e7 feat(tg): add sticker parameter to include_type
Adds support for processing stickers in Telegram chat data.

- Includes 'sticker' as a valid DataModality.
- Allows the option to include sticker emojis as message content.
2025-07-06 10:38:28 +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 9a26852c55 更新README文档。 2025-07-02 10:53:10 +08:00
xming521 2b13b70b3e 更新README文档,添加Telegram数据导出说明,修改数据预处理配置说明,调整示例配置文件中的语言设置和参数 2025-07-01 21:35:58 +08:00
xming521 38113a2524 翻译注释日志为英文 2025-07-01 20:00:34 +08:00
xming521 256a601d9f 在qa_generator.py中设置VLLM_WORKER_MULTIPROC_METHOD环境变量为"spawn";删除train_pt.py文件。 2025-06-30 20:42:39 +08:00
xming521 16ec7178d7 更新README文档,翻译部分内容为英文并调整格式; 翻译注释 和 日志。 2025-06-30 20:02:25 +08:00
xming521 c94f789868 更新README文档,替换测试数据路径为新的评估数据文件。 2025-06-29 20:27:52 +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 b265edf2fc 更新依赖项,将commentjson替换为pyjson5;优化README文档,修正项目文档链接;添加聊天平台适配表格以支持不同平台的消息类型。 2025-06-26 15:10:09 +08:00
xming521 05c419c34b 优化Telegram解析器;重构配置模型,统一基类为BaseConfigModel,调整多个配置类以支持额外字段的处理策略。 2025-06-25 11:41:59 +08:00
xming521 fc89b802a5 更新版本号至0.2.25,优化README文档,修正数据处理逻辑以支持Telegram平台,添加图像复制功能,改进消息类型处理。 2025-06-25 10:50:42 +08:00