summaryrefslogtreecommitdiff
path: root/candle-transformers
diff options
context:
space:
mode:
authorJoan Fontanals <jfontanalsmartinez@gmail.com>2024-08-01 06:59:20 -0500
committerGitHub <noreply@github.com>2024-08-01 13:59:20 +0200
commit2e9c010609c0516c85f35f829ea4f0e29820100f (patch)
tree9711b545e049bf91d79527dca82612fb9a7e7f9a /candle-transformers
parentac51f477eb354c319e604a5a4edc846e9ebc598f (diff)
downloadcandle-2e9c010609c0516c85f35f829ea4f0e29820100f.tar.gz
candle-2e9c010609c0516c85f35f829ea4f0e29820100f.tar.bz2
candle-2e9c010609c0516c85f35f829ea4f0e29820100f.zip
Jina Bert Example fix and more configuration (#2191)
* fix: fix jina bert example logic * feat: enable jina embeddings de * feat: allow more flexibility on Jina Bert
Diffstat (limited to 'candle-transformers')
-rw-r--r--candle-transformers/src/models/jina_bert.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/candle-transformers/src/models/jina_bert.rs b/candle-transformers/src/models/jina_bert.rs
index 7e3c3887..97bc1b25 100644
--- a/candle-transformers/src/models/jina_bert.rs
+++ b/candle-transformers/src/models/jina_bert.rs
@@ -47,6 +47,36 @@ impl Config {
position_embedding_type: PositionEmbeddingType::Alibi,
}
}
+
+ pub fn new(
+ vocab_size: usize,
+ hidden_size: usize,
+ num_hidden_layers: usize,
+ num_attention_heads: usize,
+ intermediate_size: usize,
+ hidden_act: candle_nn::Activation,
+ max_position_embeddings: usize,
+ type_vocab_size: usize,
+ initializer_range: f64,
+ layer_norm_eps: f64,
+ pad_token_id: usize,
+ position_embedding_type: PositionEmbeddingType,
+ ) -> Self {
+ Config {
+ vocab_size,
+ hidden_size,
+ num_hidden_layers,
+ num_attention_heads,
+ intermediate_size,
+ hidden_act,
+ max_position_embeddings,
+ type_vocab_size,
+ initializer_range,
+ layer_norm_eps,
+ pad_token_id,
+ position_embedding_type,
+ }
+ }
}
#[derive(Clone, Debug)]