@@ -269,19 +269,24 @@ class BERT4RecModel(TransformerModelBase[BERT4RecModelConfig]):
269269 How many samples per batch to load during `recommend`.
270270 If you want to change this parameter after model is initialized,
271271 you can manually assign new value to model `recommend_batch_size` attribute.
272- recommend_device : {"cpu", "cuda", "cuda:0", ...}, default ``None``
273- String representation for `torch.device` used for recommendations.
272+ recommend_torch_device : {"cpu", "cuda", "cuda:0", ...}, default ``None``
273+ String representation for `torch.device` used for torch model inference.
274+ When `recommend_use_torch_ranking` is set to ``True`` (default) this device is also used
275+ for items ranking while preparing recommendations using `TorchRanker`.
274276 When set to ``None``, "cuda" will be used if it is available, "cpu" otherwise.
275277 If you want to change this parameter after model is initialized,
276- you can manually assign new value to model `recommend_device ` attribute.
278+ you can manually assign new value to model `recommend_torch_device ` attribute.
277279 recommend_use_torch_ranking : bool, default ``True``
278280 Use `TorchRanker` for items ranking while preparing recommendations.
279- If set to ``False``, use `ImplicitRanker` instead.
281+ When set to ``True`` (default), device specified in `recommend_torch_device` is used
282+ for items ranking.
283+ When set to ``False``, multi-threaded cpu ranking will be used with `ImplicitRanker`. You
284+ can specify numer of threads using `recommend_n_threads` argument.
280285 If you want to change this parameter after model is initialized,
281286 you can manually assign new value to model `recommend_use_torch_ranking` attribute.
282287 recommend_n_threads : int, default 0
283- Number of threads to use for `ImplicitRanker`. Omitted if `recommend_use_torch_ranking` is
284- set to ``True`` (default).
288+ Number of threads to use for cpu items ranking with `ImplicitRanker`. Omitted if
289+ `recommend_use_torch_ranking` is set to ``True`` (default).
285290 If you want to change this parameter after model is initialized,
286291 you can manually assign new value to model `recommend_n_threads` attribute.
287292 data_preparator_kwargs: optional(dict), default ``None``
@@ -333,7 +338,7 @@ def __init__( # pylint: disable=too-many-arguments, too-many-locals
333338 get_val_mask_func : tp .Optional [ValMaskCallable ] = None ,
334339 get_trainer_func : tp .Optional [TrainerCallable ] = None ,
335340 recommend_batch_size : int = 256 ,
336- recommend_device : tp .Optional [str ] = None ,
341+ recommend_torch_device : tp .Optional [str ] = None ,
337342 recommend_use_torch_ranking : bool = True ,
338343 recommend_n_threads : int = 0 ,
339344 data_preparator_kwargs : tp .Optional [InitKwargs ] = None ,
@@ -366,7 +371,7 @@ def __init__( # pylint: disable=too-many-arguments, too-many-locals
366371 verbose = verbose ,
367372 deterministic = deterministic ,
368373 recommend_batch_size = recommend_batch_size ,
369- recommend_device = recommend_device ,
374+ recommend_torch_device = recommend_torch_device ,
370375 recommend_n_threads = recommend_n_threads ,
371376 recommend_use_torch_ranking = recommend_use_torch_ranking ,
372377 train_min_user_interactions = train_min_user_interactions ,
0 commit comments