HuggingFaceModel¶
-
class
oci.generative_ai.models.HuggingFaceModel(**kwargs)¶ Bases:
oci.generative_ai.models.model_data_source.ModelDataSourceConfiguration 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_MODELstr(object=’’) -> str SOURCE_TYPE_OBJECT_STORAGE_OBJECTstr(object=’’) -> str access_tokenGets the access_token of this HuggingFaceModel. branchGets the branch of this HuggingFaceModel. commitGets the commit of this HuggingFaceModel. model_id[Required] Gets the model_id of this HuggingFaceModel. source_typeGets 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'¶
-
SOURCE_TYPE_OBJECT_STORAGE_OBJECT= 'OBJECT_STORAGE_OBJECT'¶
-
__init__(**kwargs)¶ Initializes a new HuggingFaceModel object with values from keyword arguments. The default value of the
source_typeattribute of this class isHUGGING_FACE_MODELand 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.
-
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
-
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
-
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.
-
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
-
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
-