Class: DurableHuggingfaceHub::Types::ModelInfo
- Includes:
- Loadable
- Defined in:
- lib/durable_huggingface_hub/types/model_info.rb
Overview
Information about a model repository on HuggingFace Hub.
This structure represents metadata about a model, including its ID, tags, files, statistics, and configuration.
Instance Attribute Summary collapse
-
#author ⇒ String?
readonly
Author/organization name.
-
#card_data ⇒ Hash?
readonly
Model card metadata.
-
#config ⇒ Hash?
readonly
Model configuration data.
-
#created_at ⇒ Time?
readonly
Repository creation timestamp.
-
#disabled ⇒ Boolean?
readonly
Whether the repository is disabled.
-
#downloads ⇒ Integer?
readonly
Total number of downloads.
-
#gated ⇒ Boolean, ...
readonly
Gated access status (false, “auto”, “manual”).
-
#id ⇒ String
readonly
Model repository ID (e.g., “bert-base-uncased”).
-
#last_modified ⇒ Time?
readonly
Timestamp of last modification.
-
#library_name ⇒ String?
readonly
Primary library (e.g., “transformers”, “diffusers”).
-
#likes ⇒ Integer?
readonly
Number of likes/stars.
-
#pipeline_tag ⇒ String?
readonly
Primary pipeline/task tag (e.g., “text-classification”).
-
#private ⇒ Boolean?
readonly
Whether the repository is private.
-
#sha ⇒ String?
readonly
Git commit SHA of the current revision.
-
#siblings ⇒ Array<Hash>?
readonly
List of files in the repository.
-
#tags ⇒ Array<String>
readonly
Tags associated with the model.
Instance Method Summary collapse
-
#disabled? ⇒ Boolean
Checks if the repository is disabled.
-
#file_names ⇒ Array<String>
Returns the list of file names in the repository.
-
#gated? ⇒ Boolean
Checks if the repository is gated.
-
#has_tag?(tag) ⇒ Boolean
Checks if the model has a specific tag.
-
#inspect ⇒ String
Returns a detailed inspection string.
-
#public? ⇒ Boolean
Checks if the repository is public.
-
#to_s ⇒ String
Returns a short description of the model.
Instance Attribute Details
#author ⇒ String? (readonly)
Returns Author/organization name.
82 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 82 attribute :author, Types::OptionalString.default(nil) |
#card_data ⇒ Hash? (readonly)
Returns Model card metadata.
90 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 90 attribute :card_data, Types::OptionalHash.default(nil) |
#config ⇒ Hash? (readonly)
Returns Model configuration data.
78 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 78 attribute :config, Types::OptionalHash.default(nil) |
#created_at ⇒ Time? (readonly)
Returns Repository creation timestamp.
86 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 86 attribute :created_at, Types::OptionalTimestamp.default(nil) |
#disabled ⇒ Boolean? (readonly)
Returns Whether the repository is disabled.
62 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 62 attribute :disabled, Types::OptionalBool.default(nil) |
#downloads ⇒ Integer? (readonly)
Returns Total number of downloads.
66 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 66 attribute :downloads, Types::OptionalInteger.default(nil) |
#gated ⇒ Boolean, ... (readonly)
Returns Gated access status (false, “auto”, “manual”).
58 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 58 attribute :gated, Types::OptionalGated.default(nil) |
#id ⇒ String (readonly)
Returns Model repository ID (e.g., “bert-base-uncased”).
30 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 30 attribute :id, Types::RepoId |
#last_modified ⇒ Time? (readonly)
Returns Timestamp of last modification.
38 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 38 attribute :last_modified, Types::OptionalTimestamp.default(nil) |
#library_name ⇒ String? (readonly)
Returns Primary library (e.g., “transformers”, “diffusers”).
74 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 74 attribute :library_name, Types::OptionalString.default(nil) |
#likes ⇒ Integer? (readonly)
Returns Number of likes/stars.
70 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 70 attribute :likes, Types::OptionalInteger.default(nil) |
#pipeline_tag ⇒ String? (readonly)
Returns Primary pipeline/task tag (e.g., “text-classification”).
46 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 46 attribute :pipeline_tag, Types::OptionalString.default(nil) |
#private ⇒ Boolean? (readonly)
Returns Whether the repository is private.
54 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 54 attribute :private, Types::OptionalBool.default(nil) |
#sha ⇒ String? (readonly)
Returns Git commit SHA of the current revision.
34 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 34 attribute :sha, Types::OptionalString.default(nil) |
#siblings ⇒ Array<Hash>? (readonly)
Returns List of files in the repository.
50 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 50 attribute :siblings, Types::OptionalFileSiblings.default(nil) |
#tags ⇒ Array<String> (readonly)
Returns Tags associated with the model.
42 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 42 attribute :tags, Types::StringArray.default([].freeze) |
Instance Method Details
#disabled? ⇒ Boolean
Checks if the repository is disabled.
131 132 133 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 131 def disabled? disabled == true end |
#file_names ⇒ Array<String>
Returns the list of file names in the repository.
95 96 97 98 99 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 95 def file_names return [] if siblings.nil? siblings.map { |s| s[:rfilename] || s["rfilename"] }.compact end |
#gated? ⇒ Boolean
Checks if the repository is gated.
119 120 121 122 123 124 125 126 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 119 def gated? case gated when true, "auto", "manual" true else false end end |
#has_tag?(tag) ⇒ Boolean
Checks if the model has a specific tag.
105 106 107 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 105 def has_tag?(tag) .include?(tag) end |
#inspect ⇒ String
Returns a detailed inspection string.
148 149 150 151 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 148 def inspect "#<#{self.class.name} id=#{id.inspect} sha=#{sha&.[](0, 7).inspect} " \ "tags=#{.size} files=#{siblings&.size || 0}>" end |
#public? ⇒ Boolean
Checks if the repository is public.
112 113 114 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 112 def public? !private end |
#to_s ⇒ String
Returns a short description of the model.
138 139 140 141 142 143 |
# File 'lib/durable_huggingface_hub/types/model_info.rb', line 138 def to_s parts = [id] parts << "(#{pipeline_tag})" if pipeline_tag parts << "[#{library_name}]" if library_name parts.join(" ") end |