Skip to content

Conversation

@zerolovesea
Copy link

Pull Request / 拉取请求

What does this PR do? / 这个PR做了什么?

增加 batch 内负采样支持

Briefly describe your changes / 简要描述您的更改

增加了in batch neg sampling,适配了trainer,并增加了单元测试

Type of Change / 变更类型

  • 🐛 Bug fix / Bug修复
  • ✨ New model/feature / 新模型/功能
  • 📝 Documentation / 文档
  • 🔧 Maintenance / 维护

Related Issues / 相关Issues

Fixes #(issue number) / 修复 #(issue编号)

#111

How to Test / 如何测试

python tests/test_inbatch_sampling.py

Checklist / 检查清单

  • Code follows project style (ran python config/format_code.py) / 代码遵循项目风格(运行了格式化脚本)
  • Added tests for new functionality / 为新功能添加了测试
  • Updated documentation if needed / 如需要已更新文档
  • All tests pass locally / 所有测试在本地通过

Additional Notes / 附加说明

Any other information for reviewers / 给审查者的其他信息

yangzhou23 added 2 commits November 27, 2025 21:10
- add in_batch_negative_sampling helper
- cover in-batch sampling with unit tests
- ensure Matching tutorial runs with the new sampler
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 85.50725% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.74%. Comparing base (c30a1ab) to head (26caef9).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
torch_rechub/trainers/match_trainer.py 84.84% 5 Missing ⚠️
torch_rechub/utils/match.py 88.88% 3 Missing ⚠️
torch_rechub/basic/loss_func.py 77.77% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #128      +/-   ##
==========================================
- Coverage   36.39%   35.74%   -0.66%     
==========================================
  Files          52       53       +1     
  Lines        3283     3500     +217     
==========================================
+ Hits         1195     1251      +56     
- Misses       2088     2249     +161     
Flag Coverage Δ
unittests 35.74% <85.50%> (-0.66%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@1985312383 1985312383 added the enhancement New feature or request label Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants