|
--- |
|
license: cc-by-sa-4.0 |
|
--- |
|
|
|
buffer-cross-001是一个交互式文本相关度预测模型。 |
|
|
|
``` |
|
from transformers import AutoTokenizer, AutoModel |
|
tokenizer = AutoTokenizer.from_pretrained("csdc-atl/buffer-cross-001") |
|
model = AutoModel.from_pretrained("csdc-atl/buffer-cross-001", trust_remote_code=True).cuda() |
|
query = '这是查询' |
|
doc = '这是参考文档' |
|
inputs = cross_tokenizer.encode( |
|
text = query, text_pair=doc, |
|
add_special_tokens=True, |
|
max_length=2048, |
|
return_tensors='pt' |
|
).cuda() |
|
with torch.no_grad(): |
|
output = cross_model(input_ids=inputs) |
|
``` |