Rust + Candle port of GLiNER2 entity extraction (not the original GLiNER).
- Download a model (example):
hf download fastino/gliner2-large-v1 --local-dir ./model
- Run inference:
cargo run --release -- \
--model-dir ./model \
--text "Apple was founded by Steve Jobs in Cupertino." \
--entities "person,organization,location"
- This project targets the
fastino/gliner2-*model family. - CPU performance improves significantly with
--release. - GPU/accelerated backends are supported by Candle, but not configured here by default.
--model-dirPath to a directory containingconfig.json,encoder_config/config.json, andmodel.safetensors.--textInput text.--entitiesComma-separated list of entity types.--thresholdOptional score threshold (default in code).--list-weights NLists the first N weight keys (debug).
src/model.rsModel load, forward, predictsrc/processor.rsTokenization and input buildingsrc/span_rep.rsSpan representationsrc/count_lstm.rsCount-aware structure embeddingsrc/inference.rsPost-processing and span extractionsrc/main.rsCLI
MIT