candle-crf

Crates.iocandle-crf
lib.rscandle-crf
version0.8.6
sourcesrc
created_at2024-07-16 14:40:07.853191
updated_at2024-11-28 08:10:54.104291
descriptionporting pytorch-crf to candle
homepage
repositoryhttps://github.com/kigichang/candle-crf
max_upload_size
id1305125
size82,794
kigi (kigichang)

documentation

README

Candle CRF

Candle CRF ports pytorch-crf to Huggingface Candle.

Initialization

  • Pytorch CRF

    crf = CRF(num_tags, batch_first=false)
    
  • Candle CRF

    let crf = CRF::new(num_tags, false, &candle_core::Device::Cpu).unwrap();
    

Forward

  • Pytorch CRF

    llh = crf(emissions, tags, mask)
    
  • Candle CRF

    let llh = crf
            .forward(&emissions, &tags, Some(&mask), Reduction::default())
            .unwrap();
    

Decode

  • Pytorch CRF

    best_tags = crf.decode(emissions, mask)
    
  • Candle CRF

    let best_tags = crf.decode(&emissions, Some(&mask)).unwrap();
    
Commit count: 27

cargo fmt