@@ -25,8 +25,8 @@ use crate::models::{
2525 BertConfig , BertModel , DebertaV2Config , DebertaV2Model , Dense , DenseConfig , DenseLayer ,
2626 DistilBertConfig , DistilBertModel , GTEConfig , GTEModel , Gemma3Config , Gemma3Model ,
2727 JinaBertModel , JinaCodeBertModel , LlamaConfig , MPNetConfig , MPNetModel , MistralConfig , Model ,
28- ModernBertConfig , ModernBertModel , NomicBertModel , NomicConfig , Qwen2Config , Qwen3Config ,
29- Qwen3Model ,
28+ ModernBertConfig , ModernBertModel , NomicBertModel , NomicConfig , Pplx1Config , Pplx1Model ,
29+ Qwen2Config , Qwen3Config , Qwen3Model ,
3030} ;
3131#[ cfg( feature = "cuda" ) ]
3232use crate :: models:: {
@@ -135,16 +135,17 @@ enum Config {
135135 Gte ( GTEConfig ) ,
136136 #[ serde( rename = "mpnet" ) ]
137137 MPNet ( MPNetConfig ) ,
138- #[ allow( dead_code) ]
138+ #[ allow( dead_code) ] // NOTE: As it's only used when `cuda` feature is enabled
139139 Mistral ( MistralConfig ) ,
140140 #[ serde( rename( deserialize = "modernbert" ) ) ]
141141 ModernBert ( ModernBertConfig ) ,
142142 #[ serde( rename( deserialize = "nomic_bert" ) ) ]
143143 NomicBert ( NomicConfig ) ,
144- #[ allow( dead_code) ]
144+ #[ allow( dead_code) ] // NOTE: As it's only used when `cuda` feature is enabled
145145 Qwen2 ( Qwen2Config ) ,
146- #[ allow( dead_code) ]
147146 Qwen3 ( Qwen3Config ) ,
147+ #[ serde( rename( deserialize = "bidirectional_pplx_qwen3" ) ) ]
148+ Pplx1 ( Pplx1Config ) ,
148149 Roberta ( BertConfig ) ,
149150 XlmRoberta ( BertConfig ) ,
150151 #[ allow( dead_code) ]
@@ -319,6 +320,7 @@ impl CandleBackend {
319320 ) )
320321 }
321322 ( Config :: Gemma3 ( config) , Device :: Cpu | Device :: Metal ( _) ) => {
323+ // TODO(alvarobartt): Enable Flash Attention with BF16 once supported on Metal
322324 if dtype != DType :: F32 {
323325 Err ( BackendError :: Start (
324326 "Gemma3 is only supported in fp32 precision" . to_string ( ) ,
@@ -362,6 +364,17 @@ impl CandleBackend {
362364 tracing:: info!( "Starting Qwen3 model on {:?}" , device) ;
363365 Ok ( Box :: new ( Qwen3Model :: load ( vb, & config, model_type) . s ( ) ?) )
364366 }
367+ ( Config :: Pplx1 ( config) , Device :: Cpu | Device :: Metal ( _) ) => {
368+ // TODO(alvarobartt): Enable Flash Attention with BF16 once supported on Metal
369+ if dtype != DType :: F32 {
370+ Err ( BackendError :: Start (
371+ "Pplx1 is only supported in fp32 precision" . to_string ( ) ,
372+ ) )
373+ } else {
374+ tracing:: info!( "Starting Pplx1 model on {:?}" , device) ;
375+ Ok ( Box :: new ( Pplx1Model :: load ( vb, & config, model_type) . s ( ) ?) )
376+ }
377+ }
365378 #[ cfg( feature = "cuda" ) ]
366379 ( Config :: Bert ( config) , Device :: Cuda ( _) ) => {
367380 if dtype == DType :: F16 && use_flash_attn ( & [ FlashAttn :: V1 , FlashAttn :: V2 ] ) {
@@ -440,6 +453,7 @@ impl CandleBackend {
440453 }
441454 #[ cfg( feature = "cuda" ) ]
442455 ( Config :: Gemma3 ( config) , Device :: Cuda ( _) ) => {
456+ // TODO(alvarobartt): Enable Flash Attention with BF16 once supported on CUDA
443457 if dtype != DType :: F32 {
444458 Err ( BackendError :: Start (
445459 "Gemma3 is only supported in fp32 precision" . to_string ( ) ,
@@ -520,6 +534,18 @@ impl CandleBackend {
520534 }
521535 }
522536 #[ cfg( feature = "cuda" ) ]
537+ ( Config :: Pplx1 ( config) , Device :: Cuda ( _) ) => {
538+ // TODO(alvarobartt): Enable Flash Attention with BF16 once supported on CUDA
539+ if dtype != DType :: F32 {
540+ Err ( BackendError :: Start (
541+ "Pplx1 is only supported in fp32 precision" . to_string ( ) ,
542+ ) )
543+ } else {
544+ tracing:: info!( "Starting Pplx1 model on {:?}" , device) ;
545+ Ok ( Box :: new ( Pplx1Model :: load ( vb, & config, model_type) . s ( ) ?) )
546+ }
547+ }
548+ #[ cfg( feature = "cuda" ) ]
523549 ( Config :: Llama ( config) , Device :: Cuda ( _) ) => match config. rope_scaling {
524550 Some ( _) => Err ( BackendError :: Start (
525551 "Rope scaling is not supported for FlashLlama yet" . to_string ( ) ,
0 commit comments