Class: Candle::VLM
- Inherits:
-
Object
- Object
- Candle::VLM
- Defined in:
- lib/candle/vlm.rb
Class Method Summary collapse
Instance Method Summary collapse
- #ask(image_path, question, max_length: 256) ⇒ Object
- #describe(image_path, max_length: 256) ⇒ Object
- #inspect ⇒ Object
Class Method Details
.from_pretrained(model_id, device: nil, **options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/candle/vlm.rb', line 6 def from_pretrained(model_id, device: nil, **) device_obj = case device when "cpu" then Candle::Device.cpu when "metal" then Candle::Device. when "cuda" then Candle::Device.cuda when Candle::Device then device when nil then nil else Candle::Device.best end _create(model_id, device_obj) end |
Instance Method Details
#ask(image_path, question, max_length: 256) ⇒ Object
23 24 25 |
# File 'lib/candle/vlm.rb', line 23 def ask(image_path, question, max_length: 256) _ask(image_path, question, max_length) end |
#describe(image_path, max_length: 256) ⇒ Object
19 20 21 |
# File 'lib/candle/vlm.rb', line 19 def describe(image_path, max_length: 256) _describe(image_path, max_length) end |
#inspect ⇒ Object
27 28 29 |
# File 'lib/candle/vlm.rb', line 27 def inspect "#<Candle::VLM model_id=#{model_id.inspect} device=#{device}>" end |