feat: Add Python 3.10 compatibility and modern library support#2187
Open
tamio0800 wants to merge 4 commits intoRUCAIBox:masterfrom
Open
feat: Add Python 3.10 compatibility and modern library support#2187tamio0800 wants to merge 4 commits intoRUCAIBox:masterfrom
tamio0800 wants to merge 4 commits intoRUCAIBox:masterfrom
Conversation
Add comprehensive Docker environment and fix compatibility issues for modern Python/library versions. - Add Docker environment with Python 3.10 support - Add docker-compose.yml for easy development workflow - Add comprehensive troubleshooting guide and documentation - Add test scripts for environment validation - Fix numpy 2.0 compatibility issues (4 files affected) * Replace deprecated np.float_, np.int_, np.bool_, np.long_ aliases * Update configurator.py, metrics.py, hyper_tuning.py, layers.py - Fix scipy dok_matrix._update compatibility (7 models affected) * Add fallback for removed _update method in newer scipy versions * Affects NGCF, LightGCN, NCL, GCMC, SpectralCF, KGIN, MCCLK - Fix PyTorch 2.6 torch.load compatibility (8 files affected) * Add weights_only=False for full model checkpoint loading * Update trainer.py, quick_start.py, and 6 pretrained models - Fix ray tune import conflicts * Implement lazy import to avoid unnecessary dependencies - Add .dockerignore for optimized Docker builds - Update .gitignore to exclude Docker-related files - Use editable install (pip install -e .) for development workflow - Add volume mounts for real-time code changes - Verify model training, saving, loading, and inference - Test multiple model types: general, sequential, knowledge-aware - Confirm evaluation metrics calculation works correctly All changes maintain backward compatibility while enabling use with modern Python 3.10 and latest library versions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds comprehensive Python 3.10 compatibility and modernizes RecBole to work with current library versions, addressing multiple compatibility issues that prevent RecBole from running in modern Python environments.
Changes Made
🔧 Core Compatibility Fixes
numpy 2.0 compatibility: Fixed deprecated type aliases (
np.float_,np.int_,np.bool_,np.long_)recbole/config/configurator.pywith conditional compatibility settingsrecbole/evaluator/metrics.pydtype specificationsrecbole/trainer/hyper_tuning.pyandrecbole/model/layers.pyscipy compatibility: Fixed removed
dok_matrix._update()methodPyTorch 2.6 compatibility: Fixed
torch.load()weights_only parameterweights_only=Falsefor full model checkpoint loadingray tune optimization: Implemented lazy import to avoid dependency conflicts
🐳 Infrastructure Improvements
docker-compose.ymlfor easy development workflow.gitignoreand added.dockerignoreTesting
Backward Compatibility
All changes maintain full backward compatibility while enabling use with modern Python 3.10 and latest library versions.
Impact
Related Issues
Addresses compatibility issues with modern Python environments that currently prevent RecBole from running on Python 3.10+.
Note: This PR includes comprehensive testing and maintains all existing functionality while adding modern compatibility support.
概覽
此 PR 新增了完整的 Python 3.10 相容性,並將 RecBole 現代化以支援最新的函式庫版本,解決了多個相容性問題,使 RecBole 能在現代 Python 環境中正常運行。
修改內容
🔧 核心相容性修正
numpy 2.0 相容性:修復了已棄用的型別別名(
np.float_、np.int_、np.bool_、np.long_)recbole/config/configurator.py中新增條件式相容性設定recbole/evaluator/metrics.py的 dtype 規範recbole/trainer/hyper_tuning.py與recbole/model/layers.pyscipy 相容性:修正已移除的
dok_matrix._update()方法PyTorch 2.6 相容性:修正
torch.load()的weights_only參數weights_only=False以支援完整模型檢查點載入ray tune 優化:實作 lazy import 以避免相依性衝突
🐳 基礎架構改善
docker-compose.yml以簡化開發流程.gitignore並新增.dockerignore測試
向下相容性
所有修改皆維持完整的向下相容性,同時允許在 Python 3.10 與最新函式庫版本下使用。
影響
相關議題
解決了現代 Python 環境的相容性問題,目前這些問題會阻止 RecBole 在 Python 3.10+ 上執行。
注意:此 PR 已包含完整測試,並在維持所有既有功能的同時,新增了對現代環境的相容性支援。