Models
Last updated
Last updated
The following Furiosa classes are available for instantiating a base model class without a specific head.
( model config: PretrainedConfig = None compute_metrics: Optional = None label_names: Optional = None **kwargs )
evaluation_loop
( dataset: Dataset )
Parameters
dataset (datasets.Dataset
) — Dataset to use for the evaluation step.
Run evaluation and returns metrics and predictions.
to
( device: str )
Use the specified device
for inference. For example: “cpu” or “gpu”. device
can be in upper or lower case. To speed up first inference, call .compile()
after .to()
.
The following classes are available for the following computer vision tasks.
( model = None config = None **kwargs )
Parameters
model (furiosa.runtime.model
) — is the main class used to run inference.
device (str
, defaults to "CPU"
) — The device type for which the model will be optimized for. The resulting compiled model will contains nodes specific to this device.
furiosa_config (Optional[Dict]
, defaults to None
) — The dictionnary containing the informations related to the model compilation.
compile (bool
, defaults to True
) — Disable the model compilation during the loading step when set to False
.
FuriosaAI Model with a ImageClassifierOutput for image classification tasks.
This model inherits from optimum.furiosa.FuriosaAIBaseModel
. Check the superclass documentation for the generic methods the library implements for all its model (such as downloading or saving)
forward
( pixel_values: Union **kwargs )
Parameters
Although the recipe for forward pass needs to be defined within this function, one should call the Module
instance afterwards instead of this since the former takes care of running the pre and post processing steps while the latter silently ignores them.
Example of image classification using transformers.pipelines
:
Copied
config (transformers.PretrainedConfig
) — is the Model configuration class with all the parameters of the model. Initializing with a config file does not load the weights associated with the model, only the configuration. Check out the ~furiosa.modeling.FuriosaAIBaseModel.from_pretrained
method to load the model weights.
pixel_values (torch.Tensor
) — Pixel values corresponding to the images in the current batch. Pixel values can be obtained from encoded images using .
The forward method, overrides the __call__
special method.