Class: ModelEntry
- Inherits:
-
Object
- Object
- ModelEntry
- Defined in:
- lib/toy/io/model_index.rb
Instance Attribute Summary collapse
-
#family ⇒ Object
readonly
:qwen2 / :llama / etc.
-
#n_params ⇒ Object
readonly
approx parameter count.
-
#name ⇒ Object
readonly
friendly name shown to the user.
-
#path ⇒ Object
readonly
absolute path to the GGUF.
-
#size_b ⇒ Object
readonly
file size in bytes.
-
#source ⇒ Object
readonly
“hf”, “ollama”, “lmstudio”, “local”.
Instance Method Summary collapse
-
#initialize(name, path, family, n_params, size_b, source) ⇒ ModelEntry
constructor
A new instance of ModelEntry.
- #params_summary ⇒ Object
- #size_summary ⇒ Object
Constructor Details
#initialize(name, path, family, n_params, size_b, source) ⇒ ModelEntry
Returns a new instance of ModelEntry.
35 36 37 38 39 40 41 42 |
# File 'lib/toy/io/model_index.rb', line 35 def initialize(name, path, family, n_params, size_b, source) @name = name @path = path @family = family @n_params = n_params @size_b = size_b @source = source end |
Instance Attribute Details
#family ⇒ Object (readonly)
:qwen2 / :llama / etc. (from Arch.from_gguf)
30 31 32 |
# File 'lib/toy/io/model_index.rb', line 30 def family @family end |
#n_params ⇒ Object (readonly)
approx parameter count
31 32 33 |
# File 'lib/toy/io/model_index.rb', line 31 def n_params @n_params end |
#name ⇒ Object (readonly)
friendly name shown to the user
28 29 30 |
# File 'lib/toy/io/model_index.rb', line 28 def name @name end |
#path ⇒ Object (readonly)
absolute path to the GGUF
29 30 31 |
# File 'lib/toy/io/model_index.rb', line 29 def path @path end |
#size_b ⇒ Object (readonly)
file size in bytes
32 33 34 |
# File 'lib/toy/io/model_index.rb', line 32 def size_b @size_b end |
#source ⇒ Object (readonly)
“hf”, “ollama”, “lmstudio”, “local”
33 34 35 |
# File 'lib/toy/io/model_index.rb', line 33 def source @source end |
Instance Method Details
#params_summary ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/toy/io/model_index.rb', line 44 def params_summary if @n_params >= 1_000_000_000 ((@n_params.to_f / 1_000_000_000.0 * 10.0).round.to_f / 10.0).to_s + "B" elsif @n_params >= 1_000_000 (@n_params / 1_000_000).to_s + "M" else @n_params.to_s end end |
#size_summary ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/toy/io/model_index.rb', line 54 def size_summary if @size_b >= 1_000_000_000 ((@size_b.to_f / 1_000_000_000.0 * 10.0).round.to_f / 10.0).to_s + " GB" else (@size_b / 1_000_000).to_s + " MB" end end |