Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recbole 1.2.0 ❄️ #1

Merged
merged 11 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0001-update-colorlog-pinning.patch eol=crlf
0002-update-randomstate-to-default_rng-for-hyperopt.patch eol=crlf
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
About <pkg_name>-feedstock
About recbole-feedstock
=======================

Feedstock license: [BSD-3-Clause](LICENSE)

Home: <home_url>
Home: https://recbole.io

Package license: <pkg_license>
Package license: MIT

Summary: <pkg_summary>
Summary: RecBole is developed based on Python and PyTorch for reproducing and developing recommendation algorithms in a unified, comprehensive and efficient framework for research purpose. In the first version, our library includes 53 recommendation algorithms, covering four major categories: General Recommendation, Sequential Recommendation, Context-aware Recommendation and Knowledge-based Recommendation.


Current release info
====================

| Name | Downloads | Version | Platforms |
| --- | --- | --- | --- |
| [![Conda Recipe](https://img.shields.io/badge/recipe-<pkg_name>-green.svg)](https://anaconda.org/anaconda/<pkg_name>) | [![Conda Downloads](https://img.shields.io/conda/dn/anaconda/<pkg_name>.svg)](https://anaconda.org/anaconda/<pkg_name>) | [![Conda Version](https://img.shields.io/conda/vn/anaconda/<pkg_name>.svg)](https://anaconda.org/anaconda/<pkg_name>) | [![Conda Platforms](https://img.shields.io/conda/pn/anaconda/<pkg_name>.svg)](https://anaconda.org/anaconda/<pkg_name>) |
| [![Conda Recipe](https://img.shields.io/badge/recipe-recbole-green.svg)](https://anaconda.org/anaconda/recbole) | [![Conda Downloads](https://img.shields.io/conda/dn/anaconda/recbole.svg)](https://anaconda.org/anaconda/recbole) | [![Conda Version](https://img.shields.io/conda/vn/anaconda/recbole.svg)](https://anaconda.org/anaconda/recbole) | [![Conda Platforms](https://img.shields.io/conda/pn/anaconda/recbole.svg)](https://anaconda.org/anaconda/recbole) |

Installing <pkg_name>
Installing recbole
==================

Installing `<pkg_name>` from the main channel can be achieved by:
Installing `recbole` from the main channel can be achieved by:

```
conda install <pkg_name>
conda install recbole
```

It is possible to list all of the versions of `<pkg_name>` available on your platform with `conda`:
It is possible to list all of the versions of `recbole` available on your platform with `conda`:

```
conda search <pkg_name>
conda search recbole
```
2 changes: 2 additions & 0 deletions abs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
upload_channels:
- sfe1ed40
15 changes: 0 additions & 15 deletions pull_request_template.md

This file was deleted.

139 changes: 124 additions & 15 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,154 @@
{% set name = "<PLEASE ADD PKG NAME>" %}
{% set version = "<PLEASE ADD PKG VERSION>" %}
{% set name = "recbole" %}
{% set version = "1.2.0" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: <sha256>
- url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/recbole-{{ version }}.tar.gz
sha256: 132a8a706462b26bed82d409b67fbc09e90b3a49b607c7ba76c2f1718d8ddc17
patches:
- patches/0001-update-colorlog-pinning.patch
- patches/0002-update-randomstate-to-default_rng-for-hyperopt.patch
# use github release archive for tests
- url: https://github.com/RUCAIBox/RecBole/archive/refs/tags/v{{ version }}.tar.gz
sha256: 1bc77a567083884b41ddd652b9b35078a0c3554c39ca38ab825ab2681eef138e
folder: gh_src

build:
number: 0
# s390x: kmeans-pytorch (numba) unavailable
# py>=312: ray unavailable

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to build ray so you can get 3.12? I suppose this depends on whether snowflake wants to pay for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danpetry we are on hold for this one (see ticket). We do have ray in our pipeline, if it's out before we get the OK for this one then I will remove the skip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ray-tune does not have yet py==3.12 variant.

ray-tune                       2.6.3 py310hca03da5_2  pkgs/main
ray-tune                       2.6.3 py311hca03da5_2  pkgs/main
ray-tune                       2.6.3  py38hca03da5_2  pkgs/main
ray-tune                       2.6.3  py39hca03da5_2  pkgs/main

skipping py==312 because this ticket was on hold waiting for feedback for too long already.

skip: True # [py<38 or py>311 or s390x]
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
skip: True # [py<38]

requirements:
build:
- patch # [not win]
- m2-patch # [win]
host:
- python
- pip
- setuptools
- wheel
run:
- python
- pytorch >=1.10.0
- numpy >=1.17.2
# Introduced upper pinning for scipy because of
# https://github.com/RUCAIBox/RecBole/issues/2034
# https://github.com/RUCAIBox/RecBole/issues/2090
# similar to any other like
# https://github.com/mmaelicke/scikit-gstat/issues/178
# it can be removed when issues are closed.
- scipy >=1.6.0,<1.13.0a0
- pandas >=1.3.0
- tqdm >=4.48.2
# colorlog pinning relaxed to lower bound instead of exact
# (we have more recent version and it seems to work).
- colorlog >=4.7.2
- colorama 0.4.4
- scikit-learn >=0.23.2
- pyyaml >=5.1.0
- tensorboard >=2.5.0
- thop >=0.1.1.post2207130030
- tabulate >=0.8.10
- plotly >=4.0.0
- texttable >=0.9.0
- psutil >=5.9.0
# ray-tune is needed:
# https://github.com/RUCAIBox/RecBole/blob/v1.2.0/recbole/quick_start/quick_start.py#L20
# https://github.com/RUCAIBox/RecBole/blob/v1.2.0/conda/meta.yaml#L44
- ray-tune >=1.13.0,<=2.6.3
run_constrained:
# originally ==0.2.5 adapted with a patch
# to work with the more recent version we
# have (0.2.7)
- hyperopt >=0.2.5

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be run_constrained? It's an extras_require

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is,

the suggested smoke test from upstream uses it, though (see my comment in the issue here: RUCAIBox/RecBole#2105).

unfortunately, I did not receive any answer also for the rest of the seemingly optional dependencies (see comment a few lines before, and also in the above issue link).

Therefore, I moved all of those optional deps except some that we do not have to run.

Copy link
Contributor Author

@lorepirri lorepirri Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recbole upstream replied that the following dependencies are optional:

torch-scatter, dgl and kmeans-pytorch are all optional.

ref: RUCAIBox/RecBole#2105 (comment)

Therefore, I am moving the optional dependencies in run_constrained.


# skip tests KGIN and MCCLK recommenders (they use
# torch-scatter, optional and unavailable)
{% set tests_to_skip = "test_kgin" %}
{% set tests_to_skip = tests_to_skip + " or test_mcclk" %}
# skip tests KGAT recommenders (they use dgl, optional and unavailable)
{% set tests_to_skip = tests_to_skip + " or test_kgat" %}
# faiss-cpu not available for some MKL issue for py 3.8 on osx-64
# https://github.com/AnacondaRecipes/faiss-split-feedstock/blob/main/recipe/meta.yaml#L112
# also, this problem occurs for osx-64 on "from . import _swigfaiss" then "_mkl_blas_caxpy"
# is not found:
# https://github.com/facebookresearch/faiss/issues/1755
# https://discourse.cmake.org/t/mkl-64lp-versus-64ilp-difficulties/1223
{% set tests_to_skip = tests_to_skip + " or test_NCL" %} # [osx and x86_64]
{% set tests_to_skip = tests_to_skip + " or TestSequentialRecommender" %} # [osx or (linux and aarch64)]


test:
imports:
- {{ name.replace('-', '.') }}
- recbole
requires:
- pip
- pytest
- hyperopt
# The following dependencies are specified in the CI
# and they are optional.
# We contacted the upstream authors and they seem optional:
# https://github.com/RUCAIBox/RecBole/issues/2105#issuecomment-2559262386
# Most of the recommenders are available optionally
# except KGAT (missing 'dgl'), KGIN, and MCCLK (missing
# 'torch-scatter').
# https://github.com/RUCAIBox/RecBole/blob/v1.2.0/.github/workflows/python-package.yml#L36-L51
- kmeans-pytorch
- xgboost
- lightgbm
- faiss-cpu
- networkx
- protobuf #3.19.0
source_files:
- gh_src/run_recbole.py
- gh_src/tests
commands:
- pip check
- cd gh_src
# Smoke test from the CI
# https://github.com/RUCAIBox/RecBole/blob/v1.2.0/.github/workflows/python-package.yml#L55
- python run_recbole.py --model=BPR --epochs=2
# Tests run as specified in run_test.sh
# https://github.com/RUCAIBox/RecBole/blob/v1.2.0/run_test.sh#L7C1-L7C48
# "python -m pytest" is used instead of "pytest"
# As suggested in
# https://github.com/RUCAIBox/RecBole/blob/v1.2.0/.github/workflows/python-package.yml#L52
- python -m pytest -vv tests/config/test_config.py
- python -m pytest -vv tests/config/test_overall.py
# config tests
- python tests/config/test_command_line.py --use_gpu=False --valid_metric=Recall@10 --metrics="['Recall']" --epochs=200 --learning_rate=0.3
# evaluation_setting tests
- python -m pytest -vv tests/evaluation_setting
# model tests
- python -m pytest -vv tests/model/test_model_auto.py -k "not ({{ tests_to_skip }})"
# disabled: requires manual intervention
# - python -m pytest -vv tests/model/test_model_manual.py
# data tests
- python -m pytest -vv tests/data/test_dataset.py
- python -m pytest -vv tests/data/test_dataloader.py
# hyper_tuning tests
- python -m pytest -vv tests/hyper_tuning/test_hyper_tuning.py

about:
home: <PLEASE ADD HOME URL>
summary: <PLEASE ADD SUMMARY>
home: https://recbole.io
summary: A unified, comprehensive and efficient recommendation library
license: MIT
license_family: MIT
license_file: LICENSE
description: |
<PLEASE ADD DESCRIPTION>
license: <PLEASE ADD LICENSE>
license_family: <PLEASE ADD LICENSE_FAMILY>
license_file: <PLEASE_ADD_LICENSE_FILE>
dev_url: <PLEASE ADD DEV URL>
doc_url: <PLEASE ADD DOC URL>
RecBole is developed based on Python and PyTorch for reproducing and developing
recommendation algorithms in a unified, comprehensive and efficient framework
for research purpose. In the first version, our library includes 53 recommendation
algorithms, covering four major categories: General Recommendation, Sequential
Recommendation, Context-aware Recommendation and Knowledge-based Recommendation.
doc_url: https://recbole.io/docs
dev_url: https://github.com/RUCAIBox/RecBole

extra:
recipe-maintainers:
- Jrice1317
- lorepirri
25 changes: 25 additions & 0 deletions recipe/patches/0001-update-colorlog-pinning.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From dc6746147b2d24edb5b0049698facea040c55186 Mon Sep 17 00:00:00 2001
From: Lorenzo Pirritano <[email protected]>
Date: Fri, 1 Nov 2024 11:16:58 +0100
Subject: [PATCH 1/2] update colorlog pinning

---
setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 9fa8cba..8c1334b 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ install_requires = [
"scipy>=1.6.0",
"pandas>=1.4.0",
"tqdm>=4.48.2",
- "colorlog==4.7.2",
+ "colorlog>=4.7.2",
"colorama==0.4.4",
"scikit_learn>=0.23.2",
"pyyaml>=5.1.0",
--
2.39.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 609847dbc848e8d8f9babc3534e34dc74d6d78b1 Mon Sep 17 00:00:00 2001
From: Lorenzo Pirritano <[email protected]>
Date: Fri, 1 Nov 2024 16:06:00 +0100
Subject: [PATCH 2/2] update RandomState to default_rng for hyperopt

NB this patch file must have CRLF line endings because the source file
that patches has CRLF line endings. This is achieved in .gitattributes

Fixes:
'numpy.random.mtrand.RandomState' object has no attribute 'integers'

For using new hyperopt 0.2.7 rather than the one set by upstream 0.2.5.

See: https://github.com/hyperopt/hyperopt/issues/838

---
recbole/trainer/hyper_tuning.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/recbole/trainer/hyper_tuning.py b/recbole/trainer/hyper_tuning.py
index ee1cfd6..cad9a65 100644
--- a/recbole/trainer/hyper_tuning.py
+++ b/recbole/trainer/hyper_tuning.py
@@ -113,7 +113,7 @@ def exhaustive_search(new_ids, domain, trials, seed, nbMaxSucessiveFailures=1000
]
)

- rng = np.random.RandomState(seed)
+ rng = np.random.default_rng(seed)
rval = []
for _, new_id in enumerate(new_ids):
newSample = False
--
2.39.1