该小队挑战排名对F1和EM得分结果。有很多关于 F1 分数的信息(精确率和召回率的函数)。但是 EM 分数是多少?
machine-learning reinforcement-learning stanford-nlp deep-learning tensorflow
通常,变压器分词器将输入编码为字典。
{"input_ids": tf.int32, "attention_mask": tf.int32, "token_type_ids": tf.int32}
Run Code Online (Sandbox Code Playgroud)
为了对大型数据集进行更好的性能处理,最好实现一个管道,其中包括将Dataset.map分词器函数应用于输入数据集的每个元素。与 Tensorflow 教程中所做的完全相同:加载文本。
但是,tf.py_function(用于包装 map python 函数)不支持返回张量字典,如上所示。
例如,如果加载文本中的分词器(编码器)返回以下字典:
{
"input_ids": [ 101, 13366, 2131, 1035, 6819, 2094, 1035, 102 ],
"attention_mask": [ 1, 1, 1, 1, 1, 1, 1, 1 ]
}
Run Code Online (Sandbox Code Playgroud)
如何设置 的Tout参数tf.py_function来获取所需的张量字典:
{
'input_ids': <tf.Tensor: shape=(16,), dtype=int32, numpy = array(
[ 101, 13366, 2131, 1035, 6819, 2094, 1035, 102 ], dtype=int32)>
'attention_mask': <tf.Tensor: shape=(16,), dtype=int32, numpy=array(
[ 1, 1, …Run Code Online (Sandbox Code Playgroud)