nextrec 0.4.14__py3-none-any.whl → 0.4.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nextrec/__version__.py +1 -1
- nextrec/basic/model.py +13 -0
- nextrec/cli.py +12 -0
- nextrec/data/dataloader.py +16 -0
- {nextrec-0.4.14.dist-info → nextrec-0.4.15.dist-info}/METADATA +8 -5
- {nextrec-0.4.14.dist-info → nextrec-0.4.15.dist-info}/RECORD +9 -9
- {nextrec-0.4.14.dist-info → nextrec-0.4.15.dist-info}/WHEEL +0 -0
- {nextrec-0.4.14.dist-info → nextrec-0.4.15.dist-info}/entry_points.txt +0 -0
- {nextrec-0.4.14.dist-info → nextrec-0.4.15.dist-info}/licenses/LICENSE +0 -0
nextrec/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.4.
|
|
1
|
+
__version__ = "0.4.15"
|
nextrec/basic/model.py
CHANGED
|
@@ -1420,6 +1420,11 @@ class BaseModel(FeatureSet, nn.Module):
|
|
|
1420
1420
|
# Create DataLoader based on data type
|
|
1421
1421
|
if isinstance(data, DataLoader):
|
|
1422
1422
|
data_loader = data
|
|
1423
|
+
if num_workers != 0:
|
|
1424
|
+
logging.warning(
|
|
1425
|
+
"[Predict Warning] num_workers parameter is ignored when data is already a DataLoader. "
|
|
1426
|
+
"The DataLoader's existing num_workers configuration will be used."
|
|
1427
|
+
)
|
|
1423
1428
|
elif isinstance(data, (str, os.PathLike)):
|
|
1424
1429
|
rec_loader = RecDataLoader(
|
|
1425
1430
|
dense_features=self.dense_features,
|
|
@@ -1578,6 +1583,14 @@ class BaseModel(FeatureSet, nn.Module):
|
|
|
1578
1583
|
else:
|
|
1579
1584
|
data_loader = data
|
|
1580
1585
|
|
|
1586
|
+
if hasattr(data_loader, 'num_workers') and data_loader.num_workers > 0:
|
|
1587
|
+
if hasattr(data_loader.dataset, '__class__') and 'Streaming' in data_loader.dataset.__class__.__name__:
|
|
1588
|
+
logging.warning(
|
|
1589
|
+
f"[Predict Streaming Warning] Detected DataLoader with num_workers={data_loader.num_workers} "
|
|
1590
|
+
"and streaming dataset. This may cause data duplication! "
|
|
1591
|
+
"When using streaming mode, set num_workers=0 to avoid reading data multiple times."
|
|
1592
|
+
)
|
|
1593
|
+
|
|
1581
1594
|
suffix = ".csv" if save_format == "csv" else ".parquet"
|
|
1582
1595
|
target_path = resolve_save_path(
|
|
1583
1596
|
path=save_path,
|
nextrec/cli.py
CHANGED
|
@@ -21,6 +21,7 @@ Author: Yang Zhou, zyaztec@gmail.com
|
|
|
21
21
|
import argparse
|
|
22
22
|
import logging
|
|
23
23
|
import pickle
|
|
24
|
+
import resource
|
|
24
25
|
import sys
|
|
25
26
|
import time
|
|
26
27
|
from pathlib import Path
|
|
@@ -625,6 +626,17 @@ def predict_model(predict_config_path: str) -> None:
|
|
|
625
626
|
def main() -> None:
|
|
626
627
|
"""Parse CLI arguments and dispatch to train or predict mode."""
|
|
627
628
|
|
|
629
|
+
# Increase file descriptor limit to avoid "Too many open files" error
|
|
630
|
+
# when using DataLoader with multiple workers
|
|
631
|
+
try:
|
|
632
|
+
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
633
|
+
target_limit = 65535
|
|
634
|
+
if soft < target_limit:
|
|
635
|
+
resource.setrlimit(resource.RLIMIT_NOFILE, (min(target_limit, hard), hard))
|
|
636
|
+
except (ValueError, OSError):
|
|
637
|
+
# If we can't set the limit, continue anyway
|
|
638
|
+
pass
|
|
639
|
+
|
|
628
640
|
root = logging.getLogger()
|
|
629
641
|
if not root.handlers:
|
|
630
642
|
handler = logging.StreamHandler(sys.stdout)
|
nextrec/data/dataloader.py
CHANGED
|
@@ -210,6 +210,15 @@ class RecDataLoader(FeatureSet):
|
|
|
210
210
|
DataLoader instance.
|
|
211
211
|
"""
|
|
212
212
|
|
|
213
|
+
# Enforce num_workers=0 for streaming mode to prevent data duplication
|
|
214
|
+
if streaming and num_workers > 0:
|
|
215
|
+
logging.warning(
|
|
216
|
+
f"[RecDataLoader Warning] num_workers={num_workers} is not compatible with streaming=True. "
|
|
217
|
+
"Each worker would create its own data stream, causing data duplication. "
|
|
218
|
+
"Forcing num_workers=0."
|
|
219
|
+
)
|
|
220
|
+
num_workers = 0
|
|
221
|
+
|
|
213
222
|
if isinstance(data, DataLoader):
|
|
214
223
|
return data
|
|
215
224
|
elif isinstance(data, (str, os.PathLike)):
|
|
@@ -363,6 +372,13 @@ class RecDataLoader(FeatureSet):
|
|
|
363
372
|
logging.info(
|
|
364
373
|
"[RecDataLoader Info] Streaming mode enforces batch_size=1; tune chunk_size to control memory/throughput."
|
|
365
374
|
)
|
|
375
|
+
if num_workers > 0:
|
|
376
|
+
logging.warning(
|
|
377
|
+
f"[RecDataLoader Warning] num_workers={num_workers} is not compatible with streaming mode. "
|
|
378
|
+
"Each worker would create its own data stream, causing data duplication. "
|
|
379
|
+
"Forcing num_workers=0."
|
|
380
|
+
)
|
|
381
|
+
num_workers = 0
|
|
366
382
|
dataset = FileDataset(
|
|
367
383
|
file_paths=file_paths,
|
|
368
384
|
dense_features=self.dense_features,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nextrec
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.15
|
|
4
4
|
Summary: A comprehensive recommendation library with match, ranking, and multi-task learning models
|
|
5
5
|
Project-URL: Homepage, https://github.com/zerolovesea/NextRec
|
|
6
6
|
Project-URL: Repository, https://github.com/zerolovesea/NextRec
|
|
@@ -63,10 +63,13 @@ Description-Content-Type: text/markdown
|
|
|
63
63
|
|
|
64
64
|
<div align="center">
|
|
65
65
|
|
|
66
|
+
[](https://pepy.tech/projects/nextrec)
|
|
66
67
|

|
|
67
68
|

|
|
69
|
+
|
|
68
70
|

|
|
69
|
-

|
|
72
|
+
|
|
70
73
|
|
|
71
74
|
中文文档 | [English Version](README_en.md)
|
|
72
75
|
|
|
@@ -99,7 +102,7 @@ NextRec是一个基于PyTorch的现代推荐系统框架,旨在为研究工程
|
|
|
99
102
|
|
|
100
103
|
## NextRec近期进展
|
|
101
104
|
|
|
102
|
-
- **21/12/2025** 在v0.4.
|
|
105
|
+
- **21/12/2025** 在v0.4.15中加入了对[GradNorm](/nextrec/loss/grad_norm.py)的支持,通过compile的`loss_weight='grad_norm'`进行配置
|
|
103
106
|
- **12/12/2025** 在v0.4.9中加入了[RQ-VAE](/nextrec/models/representation/rqvae.py)模块。配套的[数据集](/dataset/ecommerce_task.csv)和[代码](tutorials/notebooks/zh/使用RQ-VAE构建语义ID.ipynb)已经同步在仓库中
|
|
104
107
|
- **07/12/2025** 发布了NextRec CLI命令行工具,它允许用户根据配置文件进行一键训练和推理,我们提供了相关的[教程](/nextrec_cli_preset/NextRec-CLI_zh.md)和[教学代码](/nextrec_cli_preset)
|
|
105
108
|
- **03/12/2025** NextRec获得了100颗🌟!感谢大家的支持
|
|
@@ -241,11 +244,11 @@ nextrec --mode=train --train_config=path/to/train_config.yaml
|
|
|
241
244
|
nextrec --mode=predict --predict_config=path/to/predict_config.yaml
|
|
242
245
|
```
|
|
243
246
|
|
|
244
|
-
> 截止当前版本0.4.
|
|
247
|
+
> 截止当前版本0.4.15,NextRec CLI支持单机训练,分布式训练相关功能尚在开发中。
|
|
245
248
|
|
|
246
249
|
## 兼容平台
|
|
247
250
|
|
|
248
|
-
当前最新版本为0.4.
|
|
251
|
+
当前最新版本为0.4.15,所有模型和测试代码均已在以下平台通过验证,如果开发者在使用中遇到兼容问题,请在issue区提出错误报告及系统版本:
|
|
249
252
|
|
|
250
253
|
| 平台 | 配置 |
|
|
251
254
|
|------|------|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
nextrec/__init__.py,sha256=_M3oUqyuvQ5k8Th_3wId6hQ_caclh7M5ad51XN09m98,235
|
|
2
|
-
nextrec/__version__.py,sha256=
|
|
3
|
-
nextrec/cli.py,sha256=
|
|
2
|
+
nextrec/__version__.py,sha256=yHOqz5A9VYGVIjRAkE5ZWR9IpLeDo8sygF-I11UMLv0,23
|
|
3
|
+
nextrec/cli.py,sha256=JUprwpoVbT4tXsGgMpj9Y_5yYByQXYMliMdWd38ReKo,24441
|
|
4
4
|
nextrec/basic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
nextrec/basic/activation.py,sha256=uzTWfCOtBSkbu_Gk9XBNTj8__s241CaYLJk6l8nGX9I,2885
|
|
6
6
|
nextrec/basic/callback.py,sha256=nn1f8FG9c52vJ-gvwteqPbk3-1QuNS1vmhBlkENdb0I,14636
|
|
@@ -8,13 +8,13 @@ nextrec/basic/features.py,sha256=GyCUzGPuizUofrZSSOdqHK84YhnX4MGTdu7Cx2OGhUA,465
|
|
|
8
8
|
nextrec/basic/layers.py,sha256=ZM3Nka3e2cit3e3peL0ukJCMgKZK1ovNFfAWvVOwlos,28556
|
|
9
9
|
nextrec/basic/loggers.py,sha256=Zh1A5DVAFqlGglyaQ4_IMgvFbWAcXX5H3aHbCWA82nE,6524
|
|
10
10
|
nextrec/basic/metrics.py,sha256=saNgM7kuHk9xqDxZF6x33irTaxeXCU-hxYTUQauuGgg,23074
|
|
11
|
-
nextrec/basic/model.py,sha256=
|
|
11
|
+
nextrec/basic/model.py,sha256=WGdGBK0oI8amRIor48xqIMij9UwrSkOMs0LhFczalzY,103710
|
|
12
12
|
nextrec/basic/session.py,sha256=UOG_-EgCOxvqZwCkiEd8sgNV2G1sm_HbzKYVQw8yYDI,4483
|
|
13
13
|
nextrec/data/__init__.py,sha256=YZQjpty1pDCM7q_YNmiA2sa5kbujUw26ObLHWjMPjKY,1194
|
|
14
14
|
nextrec/data/batch_utils.py,sha256=0bYGVX7RlhnHv_ZBaUngjDIpBNw-igCk98DgOsF7T6o,2879
|
|
15
15
|
nextrec/data/data_processing.py,sha256=lKXDBszrO5fJMAQetgSPr2mSQuzOluuz1eHV4jp0TDU,5538
|
|
16
16
|
nextrec/data/data_utils.py,sha256=0Ls1cnG9lBz0ovtyedw5vwp7WegGK_iF-F8e_3DEddo,880
|
|
17
|
-
nextrec/data/dataloader.py,sha256=
|
|
17
|
+
nextrec/data/dataloader.py,sha256=0JYoQk5MXCwtbj-h8X38SOsb4YPJQawASCatuPNgTw4,19561
|
|
18
18
|
nextrec/data/preprocessor.py,sha256=K-cUP-YdlQx1VJ2m1CXuprncpjDJe2ERVO5xCSoxHKI,44470
|
|
19
19
|
nextrec/loss/__init__.py,sha256=ZCgsfyR5YAecv6MdOsnUjkfacvZg2coQVjuKAfPvmRo,923
|
|
20
20
|
nextrec/loss/grad_norm.py,sha256=91Grspx95Xu_639TkL_WZRX1xt5QOTZCzBeJWbUGPiE,8385
|
|
@@ -71,8 +71,8 @@ nextrec/utils/embedding.py,sha256=akAEc062MG2cD7VIOllHaqtwzAirQR2gq5iW7oKpGAU,14
|
|
|
71
71
|
nextrec/utils/feature.py,sha256=rsUAv3ELyDpehVw8nPEEsLCCIjuKGTJJZuFaWB_wrPk,633
|
|
72
72
|
nextrec/utils/model.py,sha256=3B85a0IJCggI26dxv25IX8R_5yQPo7wXI0JIAns6bkQ,1727
|
|
73
73
|
nextrec/utils/torch_utils.py,sha256=AKfYbSOJjEw874xsDB5IO3Ote4X7vnqzt_E0jJny0o8,13468
|
|
74
|
-
nextrec-0.4.
|
|
75
|
-
nextrec-0.4.
|
|
76
|
-
nextrec-0.4.
|
|
77
|
-
nextrec-0.4.
|
|
78
|
-
nextrec-0.4.
|
|
74
|
+
nextrec-0.4.15.dist-info/METADATA,sha256=fNo7--haI7VdwCBY-FXqtrDXTK6pVrkMde-opJJsLjg,21298
|
|
75
|
+
nextrec-0.4.15.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
76
|
+
nextrec-0.4.15.dist-info/entry_points.txt,sha256=NN-dNSdfMRTv86bNXM7d3ZEPW2BQC6bRi7QP7i9cIps,45
|
|
77
|
+
nextrec-0.4.15.dist-info/licenses/LICENSE,sha256=2fQfVKeafywkni7MYHyClC6RGGC3laLTXCNBx-ubtp0,1064
|
|
78
|
+
nextrec-0.4.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|