code: def language_model_learner(
      dls,
      arch,
      config=None,
      drop_mult=1.0,
      backwards=False,
      pretrained=True,
      pretrained_fnames=None,
      **kwargs,
  ):
      "Create a `Learner` with a language model from `dls` and `arch`."
      vocab = _get_text_vocab(dls)
      model = get_language_model(
          arch, len(vocab), config=config, drop_mult=drop_mult
      )
      meta = _model_meta[arch]
      learn = LMLearner(
          dls,
          model,
          loss_func=CrossEntropyLossFlat(),
          splitter=meta["split_lm"],
          **kwargs,
      )
      url = "url_bwd" if backwards else "url"
      if pretrained or pretrained_fnames:
          if pretrained_fnames is not None:
              fnames = [
                  learn.path / learn.model_dir / f"{fn}.{ext}"
                  for fn, ext in zip(pretrained_fnames, ["pth", "pkl"])
              ]
          else:
              if url not in meta:
                  warn(
                      "There are no pretrained weights for that architecture yet!"
                  )
                  return learn
              model_path = untar_data(meta[url], c_key="model")
              try:
                  fnames = [
                      list(model_path.glob(f"*.{ext}"))[0]
                      for ext in ["pth", "pkl"]
                  ]
              except IndexError:
                  print(
                      f"The model in {model_path} is incomplete, download again"
                  )
                  raise
          learn = learn.load_pretrained(*fnames)
      return learn
  
imports: from __future__ import annotations
  from ..basics import *
  from .core import *
  from .data import *
  from .models.core import *
  from .models.awdlstm import *
  from ..callback.rnn import *
  from ..callback.progress import *
  from .models.core import _model_meta
label_desc: Use image node_id 9 for calling a global function with example usage: language_model_learner(dls, arch, config, drop_mult, backwards, pretrained, pretrained_fnames) and returns: learn, learn