hf_load_AutoModel_for_task: Import a pre-trained AutoModel object for a specific task.

View source: R/transformers.R

hf_load_AutoModel_for_taskR Documentation

Import a pre-trained AutoModel object for a specific task.

Description

Use this function when you need to load an AutoModel for a specific task separate to a pipeline. The model's config should come ready-equipped for a specific task according to what you input as model_type.

Usage

hf_load_AutoModel_for_task(
  model_type = "AutoModelForSequenceClassification",
  model_id,
  use_auth_token = NULL
)

Arguments

model_type

The AutoModel's type passed as a string e.g. c("AutoModelForQuestionAnswering", "AutoModelForTokenClassification", "AutoModelForSequenceClassification")

model_id

The model's name or id on the Hugging Face hub

use_auth_token

For private models, copy and paste your auth token in as a string.

Value

an AutoModel object for a specific task

See Also

https://huggingface.co/transformers/v3.0.2/model_doc/auto.html

Examples

## Not run: 
model <- hf_load_AutoModel_for_task(
  "AutoModelForSequenceClassification",
  "distilbert-base-uncased-finetuned-sst-2-english"
)

## End(Not run)

huggingfaceR documentation built on Aug. 30, 2026, 1:06 a.m.