module HuggingfaceHardware
Shared Hugging Face hardware helpers for model fit and IRC summaries.
Public Instance Methods
Source
# File lib/huggingface_hardware.rb, line 37 def hardware_detected?(hardware) return false unless hardware hardware[:device_count].to_i.positive? || !hardware_label(hardware).nil? end
Source
# File lib/huggingface_hardware.rb, line 7 def hardware_label(hardware) hardware ||= {} name = hardware[:primary_name] || hardware["primary_name"] memory = hardware[:primary_memory_gb] || hardware["primary_memory_gb"] parts = [] parts << name.to_s.strip unless name.to_s.strip.empty? parts << "#{memory}GB VRAM" if memory parts.empty? ? nil : parts.join(" ยท ") end
Source
# File lib/huggingface_hardware.rb, line 17 def vram_to_num_parameters(vram_gb) gb = vram_gb.to_f return nil unless gb.positive? cap = if gb >= 22 "32B" elsif gb >= 14 "14B" elsif gb >= 10 "8B" elsif gb >= 6 "7B" elsif gb >= 3 "3B" else "1B" end "max:#{cap}" end