Crates.io | candle-crf |
lib.rs | candle-crf |
version | 0.8.5 |
source | src |
created_at | 2024-07-16 14:40:07.853191 |
updated_at | 2024-10-15 12:41:30.532854 |
description | porting pytorch-crf to candle |
homepage | |
repository | https://github.com/kigichang/candle-crf |
max_upload_size | |
id | 1305125 |
size | 82,794 |
Candle CRF ports pytorch-crf to Huggingface Candle.
Pytorch CRF
crf = CRF(num_tags, batch_first=false)
Candle CRF
let crf = CRF::new(num_tags, false, &candle_core::Device::Cpu).unwrap();
Pytorch CRF
llh = crf(emissions, tags, mask)
Candle CRF
let llh = crf
.forward(&emissions, &tags, Some(&mask), Reduction::default())
.unwrap();
Pytorch CRF
best_tags = crf.decode(emissions, mask)
Candle CRF
let best_tags = crf.decode(&emissions, Some(&mask)).unwrap();