code: def collab_learner(
      dls,
      n_factors=50,
      use_nn=False,
      emb_szs=None,
      layers=None,
      config=None,
      y_range=None,
      loss_func=None,
      **kwargs,
  ):
      "Create a Learner for collaborative filtering on `dls`."
      emb_szs = get_emb_sz(dls, ifnone(emb_szs, {}))
      if loss_func is None:
          loss_func = MSELossFlat()
      if config is None:
          config = tabular_config()
      if y_range is not None:
          config["y_range"] = y_range
      if layers is None:
          layers = [n_factors]
      if use_nn:
          model = EmbeddingNN(emb_szs=emb_szs, layers=layers, **config)
      else:
          model = EmbeddingDotBias.from_classes(
              n_factors, dls.classes, y_range=y_range
          )
      return Learner(dls, model, loss_func=loss_func, **kwargs)
  
file_path: fastai/fastai/collab.py
imports: from __future__ import annotations
  from .tabular.all import *
label_desc: Use image node_id 1 for calling a global function with example usage: collab_learner(dls, n_factors, use_nn, emb_szs, layers, config, y_range, loss_func) and returns: Learner