code: def split_model(model:nn.Module=None, splits:Collection[Union[nn.Module,ModuleList]]=None):
      "Split `model` according to the layers in `splits`."
      splits = listify(splits)
      if isinstance(splits[0], nn.Module):
          layers = flatten_model(model)
          idxs = [layers.index(first_layer(s)) for s in splits]
          return split_model_idx(model, idxs)
      return [nn.Sequential(*s) for s in splitsf split_model(model:nn.Module=None, splits:Collection[Union[nn.Module,ModuleList]]=None):
      "Split `model` according to the layers in `splits`."
      splits = listify(splits)
      if isinstance(splits[0], nn.Module):
          layers = flatten_model(model)
          idxs = [layers.index(first_layer(s)) for s in splits]
          return split_model_idx(model, idxs)
      return [nn.Sequential(*s) for s in splits]
docs: Split `model` according to the layers in `splits`.