【发布时间】:2020-07-22 10:15:14
【问题描述】:
我想使用拥抱脸的填充蒙版管道来猜测蒙面标记,然后将猜测的标记提取为单词。这段代码应该这样做:
!pip install -q transformers
model = pipeline('fill-mask')
outcome = model("Kubernetes is a container orchestration <mask>")[0]
#Prints: "Kubernetes is a container orchestration platform"
print(outcome['sequence'])
token = outcome['token']
#Prints: 1761
print(token)
#Prints: Ġplatform
print(model.tokenizer.convert_ids_to_tokens(token))
但我发现它给了我"Ġplatform" 而不是"platform" - 有谁知道这是为什么或这里会发生什么?
【问题讨论】:
标签: python neural-network nlp huggingface-transformers