Class: Xberg::SparseEmbeddingModelTypeCustom

Inherits:
Data
  • Object
show all
Extended by:
T::Sig
Includes:
SparseEmbeddingModelType
Defined in:
lib/xberg/native.rb

Overview

Use a custom SPLADE (BertForMaskedLM) ONNX model from HuggingFace.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#additional_filesObject (readonly)

Returns the value of attribute additional_files

Returns:

  • (Object)

    the current value of additional_files



5060
5061
5062
# File 'lib/xberg/native.rb', line 5060

def additional_files
  @additional_files
end

#max_lengthObject (readonly)

Returns the value of attribute max_length

Returns:

  • (Object)

    the current value of max_length



5060
5061
5062
# File 'lib/xberg/native.rb', line 5060

def max_length
  @max_length
end

#model_fileObject (readonly)

Returns the value of attribute model_file

Returns:

  • (Object)

    the current value of model_file



5060
5061
5062
# File 'lib/xberg/native.rb', line 5060

def model_file
  @model_file
end

#model_idObject (readonly)

Returns the value of attribute model_id

Returns:

  • (Object)

    the current value of model_id



5060
5061
5062
# File 'lib/xberg/native.rb', line 5060

def model_id
  @model_id
end

Class Method Details

.from_hash(hash) ⇒ Object



5086
5087
5088
5089
5090
5091
5092
5093
# File 'lib/xberg/native.rb', line 5086

def self.from_hash(hash)
  new(
    model_id: hash[:model_id] || hash["model_id"],
    model_file: hash[:model_file] || hash["model_file"],
    additional_files: hash[:additional_files] || hash["additional_files"],
    max_length: hash[:max_length] || hash["max_length"]
  )
end

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


5080
# File 'lib/xberg/native.rb', line 5080

def custom? = true

#plugin?Boolean

Returns:

  • (Boolean)


5082
5083
5084
# File 'lib/xberg/native.rb', line 5082

def plugin? = false
# @param hash [Hash] deserialized from the native extension
# @return [self]

#preset?Boolean

Returns:

  • (Boolean)


5078
# File 'lib/xberg/native.rb', line 5078

def preset? = false