Instructions to use cimo001/gliner_multi-v2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER
How to use cimo001/gliner_multi-v2.1 with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("cimo001/gliner_multi-v2.1") - Notebooks
- Google Colab
- Kaggle
File size: 1,060 Bytes
336795c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import os
import onnxruntime
def onnxSessionBuild(pathModel):
option = onnxruntime.SessionOptions()
option.log_severity_level = 3
option.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_ALL
option.intra_op_num_threads = max(1, os.cpu_count())
option.inter_op_num_threads = 1
option.enable_cpu_mem_arena = True
option.enable_mem_pattern = True
option.enable_mem_reuse = True
option.execution_mode = onnxruntime.ExecutionMode.ORT_SEQUENTIAL
providerPreferredList = [
"CUDAExecutionProvider",
"OpenVINOExecutionProvider",
"CPUExecutionProvider"
]
providerAvailableList = onnxruntime.get_available_providers()
providerList = [provider for provider in providerPreferredList if provider in providerAvailableList]
inference = onnxruntime.InferenceSession(pathModel, sess_options=option, providers=providerList)
print(f"Provider available: {providerAvailableList}")
print(f"Provider active: {inference.get_providers()}\n")
return inference
|