HuggingFaceModel

class oci.generative_ai.models.HuggingFaceModel(**kwargs)

Bases: ModelDataSource

Configuration for importing a model from Hugging Face. Requires the model ID and a reference to the token stored in a vault for authenticated access.

Attributes:

SOURCE_TYPE_HUGGING_FACE_MODEL

A constant which can be used with the source_type property of a ModelDataSource.

SOURCE_TYPE_OBJECT_STORAGE_OBJECT

A constant which can be used with the source_type property of a ModelDataSource.

access_token

Gets the access_token of this HuggingFaceModel.

branch

Gets the branch of this HuggingFaceModel.

commit

Gets the commit of this HuggingFaceModel.

model_id

[Required] Gets the model_id of this HuggingFaceModel.

source_type

Gets the source_type of this ModelDataSource.

Methods:

__init__(**kwargs)

Initializes a new HuggingFaceModel object with values from keyword arguments.

get_subtype(object_dictionary)

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.

SOURCE_TYPE_HUGGING_FACE_MODEL = 'HUGGING_FACE_MODEL'

A constant which can be used with the source_type property of a ModelDataSource. This constant has a value of “HUGGING_FACE_MODEL”

SOURCE_TYPE_OBJECT_STORAGE_OBJECT = 'OBJECT_STORAGE_OBJECT'

A constant which can be used with the source_type property of a ModelDataSource. This constant has a value of “OBJECT_STORAGE_OBJECT”

__init__(**kwargs)

Initializes a new HuggingFaceModel object with values from keyword arguments. The default value of the source_type attribute of this class is HUGGING_FACE_MODEL and it should not be changed. The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters
  • source_type (str) – The value to assign to the source_type property of this HuggingFaceModel. Allowed values for this property are: “HUGGING_FACE_MODEL”, “OBJECT_STORAGE_OBJECT”

  • model_id (str) – The value to assign to the model_id property of this HuggingFaceModel.

  • access_token (str) – The value to assign to the access_token property of this HuggingFaceModel.

  • branch (str) – The value to assign to the branch property of this HuggingFaceModel.

  • commit (str) – The value to assign to the commit property of this HuggingFaceModel.

property access_token

Gets the access_token of this HuggingFaceModel. Hugging Face access token to authenticate requests for restricted models. This token will be securely stored in OCI Vault.

Returns

The access_token of this HuggingFaceModel.

Return type

str

property branch

Gets the branch of this HuggingFaceModel. The name of the branch in the Hugging Face repository to import the model from. If not specified, “main” will be used by default. If you provide both a branch and a commit hash, the model will be imported from the specified commit.

Returns

The branch of this HuggingFaceModel.

Return type

str

property commit

Gets the commit of this HuggingFaceModel. The commit hash in the Hugging Face repository to import the model from. If both a branch and a commit are provided, the commit hash will be used.

Returns

The commit of this HuggingFaceModel.

Return type

str

static get_subtype(object_dictionary)

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.

property model_id

[Required] Gets the model_id of this HuggingFaceModel. The full model OCID from Hugging Face, typically in the format “org/model-name” (e.g., “meta-llama/Llama-2-7b”).

Returns

The model_id of this HuggingFaceModel.

Return type

str

property source_type

Gets the source_type of this ModelDataSource. Specifies the source type for model import.

Allowed values for this property are: “HUGGING_FACE_MODEL”, “OBJECT_STORAGE_OBJECT”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.

Returns

The source_type of this ModelDataSource.

Return type

str