import onnxruntime as ort
tokenizer = AutoTokenizer.from_pretrained("xusenlin/uie-base")
session = ort.InferenceSession("path/to/model.onnx")
intput = "张三与B公司签订了一份合同,约定了合同金额为100万元,合同期限为一年。"
schema = ["人名", "公司", "金额", "时间"]
input_ids_tensor, attention_mask, token_type_ids, offsets_mapping = tokenizer(
intput,
schema[0],
return_tensors="pt",
return_offsets_mapping=True,
add_special_tokens=True
)
inputs = {
"input_ids": input_ids_tensor, # shape: [batch_size, sequence_length]"attention_mask": attention_mask, # shape: [batch_size, sequence_length]"token_type_ids": token_type_ids # shape: [batch_size, sequence_length]
}
outputs = session.run(None, inputs)
start_probs, end_probs = outputs
# use offsets_mapping and start_probs, end_probs to get the entities# ...
Runs of bluryar uie-base-ONNX on huggingface.co
30
Total runs
0
24-hour runs
0
3-day runs
3
7-day runs
6
30-day runs
More Information About uie-base-ONNX huggingface.co Model
uie-base-ONNX huggingface.co
uie-base-ONNX huggingface.co is an AI model on huggingface.co that provides uie-base-ONNX's model effect (), which can be used instantly with this bluryar uie-base-ONNX model. huggingface.co supports a free trial of the uie-base-ONNX model, and also provides paid use of the uie-base-ONNX. Support call uie-base-ONNX model through api, including Node.js, Python, http.
uie-base-ONNX huggingface.co is an online trial and call api platform, which integrates uie-base-ONNX's modeling effects, including api services, and provides a free online trial of uie-base-ONNX, you can try uie-base-ONNX online for free by clicking the link below.
bluryar uie-base-ONNX online free url in huggingface.co:
uie-base-ONNX is an open source model from GitHub that offers a free installation service, and any user can find uie-base-ONNX on GitHub to install. At the same time, huggingface.co provides the effect of uie-base-ONNX install, users can directly use uie-base-ONNX installed effect in huggingface.co for debugging and trial. It also supports api for free installation.