Skip to content

[HELP WANTED] ONNX导出功能开发 / ONNX Export Functionality Development #113

@1985312383

Description

@1985312383

任务类型 / Task Type

请选择任务类型 / Please select the task type:

  • 新功能实现 / New feature implementation
  • 数据集支持 / Dataset support
  • 文档编写 / Documentation
  • 教程制作 / Tutorial creation
  • 测试用例 / Test cases
  • Bug修复 / Bug fixes
  • 代码优化 / Code optimization
  • 其他 / Other

任务描述 / Task Description

背景 / Background

为了支持模型的轻量级部署和跨平台推理,需要为torch-rechub中的模型添加ONNX导出功能。ONNX格式可以让模型在不同的推理引擎中运行,提高部署的灵活性和效率。

目标 / Objectives

  1. 为所有主要模型添加ONNX导出功能
  2. 确保导出的ONNX模型与原PyTorch模型输出一致
  3. 支持动态batch size和序列长度
  4. 提供简单易用的导出接口
  5. 添加ONNX模型验证和测试工具

详细要求 / Detailed Requirements

  • 实现统一的ONNX导出接口,支持dict格式输入
  • 确保导出模型与输入特征维度对齐
  • 支持预设并行数配置
  • 处理动态输入维度的导出
  • 添加导出后的模型验证功能
  • 不破坏现有框架结构
  • 提供详细的使用文档和示例

技能要求 / Required Skills

必需技能 / Required Skills

  • Python编程 / Python programming
  • PyTorch框架 / PyTorch framework
  • ONNX格式理解 / Understanding of ONNX format
  • 模型部署经验 / Model deployment experience
  • 其他: 深度学习模型优化 / Deep learning model optimization

加分技能 / Preferred Skills

  • 深度学习 / Deep learning
  • 机器学习 / Machine learning
  • 推荐系统基础 / Recommender systems basics
  • 模型量化和优化 / Model quantization and optimization
  • 文档写作 / Technical writing
  • 其他: ONNXRuntime使用经验 / ONNXRuntime experience

预期产出 / Expected Deliverables

  • 代码实现 / Code implementation
  • 单元测试 / Unit tests
  • 文档更新 / Documentation updates
  • 使用示例 / Usage examples
  • 其他: ONNX模型验证工具 / ONNX model validation tools

参考资料 / References

相关论文 / Related Papers

代码参考 / Code References

文档资源 / Documentation Resources

难度评估 / Difficulty Level

  • 🟢 初级 (适合新手) / Beginner (Good for newcomers)
  • 🟡 中级 (需要一定经验) / Intermediate (Requires some experience)
  • 🔴 高级 (需要深入理解) / Advanced (Requires deep understanding)

预估工作量 / Estimated Effort

  • 📅 1-3天 / 1-3 days
  • 📅 1周 / 1 week
  • 📅 2-4周 / 2-4 weeks
  • 📅 1个月以上 / More than 1 month

贡献指南 / Contribution Guidelines

开始之前 / Before You Start

  1. 请在评论中表明您的兴趣,避免重复工作 / Please comment to express your interest to avoid duplicate work
  2. 阅读 CONTRIBUTING.md 了解开发流程 / Read CONTRIBUTING.md to understand the development process
  3. 设置开发环境并熟悉项目结构 / Set up the development environment and familiarize yourself with the project structure
  4. 安装ONNX相关依赖: pip install onnx onnxruntime

开发流程 / Development Process

  1. Fork 项目并创建新分支 feature/onnx-export
  2. 研究现有模型结构,识别ONNX导出的挑战点
  3. 实现统一的ONNX导出接口
  4. 逐个模型实现ONNX导出功能
  5. 开发模型验证和测试工具
  6. 编写详细的使用文档和示例
  7. 运行代码格式化: python config/format_code.py
  8. 提交 Pull Request

代码规范 / Code Standards

  • 遵循项目的代码风格 / Follow the project's code style
  • 添加适当的注释和文档字符串 / Add appropriate comments and docstrings
  • 确保所有测试通过 / Ensure all tests pass
  • 更新相关文档 / Update relevant documentation
  • 充分测试ONNX模型的正确性 / Thoroughly test ONNX model correctness

联系方式 / Contact Information

获取帮助 / Getting Help

  • 💬 在此 Issue 下评论提问 / Comment on this issue with questions
  • 📧 联系项目维护者: morningsky
  • 🔗 查看更多 Issues: GitHub Issues

社区支持 / Community Support

  • 📖 查看项目文档和示例 / Check project documentation and examples
  • 🤝 与其他贡献者交流 / Communicate with other contributors
  • ⭐ 关注项目更新 / Follow project updates

额外信息 / Additional Information

重要提醒 / Important Notes:

  • 此功能验证较为复杂,需要充分测试 / This feature requires complex validation and thorough testing
  • 建议分阶段实现,先支持简单模型,再扩展到复杂模型
  • 需要特别注意动态输入维度的处理
  • 确保导出的ONNX模型在不同推理引擎中的兼容性

技术挑战 / Technical Challenges:

  • 处理推荐系统模型中的embedding层导出
  • 支持变长序列输入的ONNX导出
  • 确保数值精度在导出过程中的一致性
  • 优化导出模型的推理性能

测试要求 / Testing Requirements:

  • 对比PyTorch模型和ONNX模型的输出一致性
  • 测试不同batch size和序列长度下的模型表现
  • 验证ONNX模型在ONNXRuntime中的推理速度
  • 提供完整的端到端测试用例

感谢您对 torch-rechub 项目的贡献兴趣!我们期待与您合作。
Thank you for your interest in contributing to torch-rechub! We look forward to working with you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions