class_docstr: PyTorch Hub interface for classy vision tasks and models.
  
  The task is optional, but a model is guaranteed to be present.  Do
  not use the constructor directly, instead Use from_task() or
  from_model() to instantiate the class.
  
  See the examples folder for an example of how to use this class
  
  Attributes:
      task: If present, task that can be used to train the torchhub model
      model: torchub model
class_docstr_tok: ["PyTorch","Hub","interface","for","classy","vision","tasks","and","models",".","The","task","is","optional",",","but","a","model","is","guaranteed","to","be","present",".","Do","not","use","the","constructor","directly",",","instead","Use","from_task","(",")","or","from_model","(",")","to","instantiate","the","class",".","See","the","examples","folder","for","an","example","of","how","to","use","this","class","Attributes",":","task",":","If","present",",","task","that","can","be","used","to","train","the","torchhub","model","model",":","torchub","model"]
docstr: Constructor for ClassyHubInterface.
  
  Only one of task or model can be specified at construction
  time. If task is specified then task.model is used to populate
  the model attribute.
  
  Do not use the constructor directly, instead use from_task()
  or from_model() to instantiate the class.
  
  Args:
      task: task that can be used to train torchhub model,
          task.model is used to populate the model attribute
      model: torchhub model
docstr_tok: ["Constructor","for","ClassyHubInterface",".","Only","one","of","task","or","model","can","be","specified","at","construction","time",".","If","task","is","specified","then","task.model","is","used","to","populate","the","model","attribute",".","Do","not","use","the","constructor","directly",",","instead","use","from_task","(",")","or","from_model","(",")","to","instantiate","the","class",".","Args",":","task",":","task","that","can","be","used","to","train","torchhub","model",",","task.model","is","used","to","populate","the","model","attribute","model",":","torchhub","model"]
code: def __init__(
      self,
      task: Optional[ClassyTask] = None,
      model: Optional[ClassyModel] = None,
  ) -> None:
      """Constructor for ClassyHubInterface.
  
      Only one of task or model can be specified at construction
      time. If task is specified then task.model is used to populate
      the model attribute.
  
      Do not use the constructor directly, instead use from_task()
      or from_model() to instantiate the class.
  
      Args:
          task: task that can be used to train torchhub model,
              task.model is used to populate the model attribute
          model: torchhub model
      """
      self.task = task
      if task is None:
          assert (
              model is not None
          ), "Need to specify a model if task is None"
          self.model = model
      else:
          assert (
              model is None
          ), "Cannot pass a model if task is not None"
          self.model = task.model
  
file_path: ClassyVision/classy_vision/hub/classy_hub_interface.py
imports: from typing import Any, Callable, Iterator, List, Optional, Union
  import torch
  import torch.nn
  from classy_vision.dataset import ClassyDataset
  from classy_vision.dataset.image_path_dataset import ImagePathDataset
  from classy_vision.dataset.transforms import ClassyTransform
  from classy_vision.dataset.transforms.util import build_field_transform_default_imagenet
  from classy_vision.models import ClassyModel
  from classy_vision.tasks import ClassyTask
label_desc: Use image node_id 1 to create a new ClassyHubInterface object  with example: obj = ClassyHubInterface(task, model)