docformer_fit: Docformer model

View source: R/supervised_model.R

docformer_fitR Documentation

Docformer model

Description

Fits the DocFormer: End-to-End Transformer for Document Understanding model

Usage

docformer_fit(x, ...)

## Default S3 method:
docformer_fit(x, ...)

## S3 method for class 'docformer_tensor'
docformer_fit(x, config = docformer_config(), ...)

Arguments

x

Depending on the context:

  • A image filename.

  • A document filename.

  • A folder containing either images or documents.

The model currently support for image any image type that {magick} package can read. The model currently support for document any pdf type that {pdftool} package can read.

...

Model hyperparameters. Any hyperparameters set here will update those set by the config argument. See docformer_config() for a list of all possible hyperparameters.

config

A set of hyperparameters created using the docformer_config function. If no argument is supplied, this will use the default values in docformer_config().

y

A data frame

docformer_model

A previously fitted DocFormer model object to continue the fitting on. if NULL (the default) a brand new model is initialized.

from_epoch

When a docformer_model is provided, restore the network weights from a specific epoch. Default is last available checkpoint for restored model, or last epoch for in-memory model.

Value

A DocFormer model object of class docformer_fit It can be used for serialization, predictions, or further fitting.

Fitting a pre-trained model

When providing a parent docformer_model parameter, the model fitting resumes from that model weights at the following epoch:

  • last fitted epoch for a model already in torch context

  • Last model checkpoint epoch for a model loaded from file

  • the epoch related to a checkpoint matching or preceding the from_epoch value if provided The model fitting metrics append on top of the parent metrics in the returned TabNet model.

Examples

docformer_model <- docformer_fit(x)

cregouby/docformer documentation built on May 27, 2023, 11:19 p.m.