5 releases
0.8.3 | Aug 17, 2024 |
---|---|
0.8.2 | Aug 12, 2024 |
0.8.1 | Aug 10, 2024 |
0.7.3 | Jul 18, 2024 |
0.7.2 | Jul 16, 2024 |
#159 in Machine learning
434 downloads per month
71KB
1.5K
SLoC
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();
Dependencies
~11MB
~220K SLoC