docstr: Saves the internal model weights to a file.
  
  :param file: The name of the file. Should have a .pth file extension.
  :type file: str
  
  **Example**::
  
      >>> from detecto.core import Model
  
      >>> model = Model(['tree', 'bush', 'leaf'])
      >>> model.save('model_weights.pth')
docstr_tok: ["Saves","the","internal","model","weights","to","a","file",".",":","param","file",":","The","name","of","the","file",".","Should","have","a",".pth","file","extension",".",":","type","file",":","str","*","*","Example","*","*",":",":",">",">",">","from","detecto.core","import","Model",">",">",">","model","=","Model","(","[","'tree","'",",","'bush","'",",","'leaf","'","]",")",">",">",">","model.save","(","'model_weights.pth","'",")"]
code: def save(self, file):
      """Saves the internal model weights to a file.
  
      :param file: The name of the file. Should have a .pth file extension.
      :type file: str
  
      **Example**::
  
          >>> from detecto.core import Model
  
          >>> model = Model(['tree', 'bush', 'leaf'])
          >>> model.save('model_weights.pth')
      """
  
      torch.save(self._model.state_dict(), file)
  
imports: import os
  import pandas
  import random
  import torch
  import torchvision
  from detecto.config import config
  from detecto.utils import default_transforms, filter_top_predictions, xml_to_csv, _is_iterable, read_image
  from torchvision import transforms
  from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
  from tqdm import tqdm
label_desc: Use image node_id 7 for calling the Model obj's underlying member method code with example usage: obj.save(file) without return types