该模型是 neuralmind/bert-large-portuguese-cased 在 lener_br 数据集上的微调版本。 它在评估集上取得了以下结果:
from openmind import pipeline, is_torch_npu_available
from openmind import AutoTokenizer, AutoModelForCausalLM
from openmind_hub import snapshot_download
import torch.nn.functional as F
from torch import Tensor
import openmind
import torch
import argparse
import time
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
type=str,
help="Path to model",
default="jeffding/bertimbau-large-lener_br-openmind",
)
args = parser.parse_args()
return args
def main():
args = parse_args()
model_path = args.model_name_or_path
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
start_time = time.time()
classifier = pipeline(task="text-classification", model=model_path, top_k=None, device=device)
sentences = ["I am not having a great day"]
model_outputs = classifier(sentences)
print(model_outputs[0])
end_time = time.time()
print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")
if __name__ == "__main__":
main()需要更多信息
需要更多信息
需要更多信息
训练过程中使用了以下超参数:
| 训练损失 | 轮次 | 步数 | 验证损失 | 精确率 | 召回率 | F1值 | 准确率 |
|---|---|---|---|---|---|---|---|
| 0.0674 | 1.0 | 1957 | 0.1349 | 0.7617 | 0.8710 | 0.8127 | 0.9594 |
| 0.0443 | 2.0 | 3914 | 0.1867 | 0.6862 | 0.9194 | 0.7858 | 0.9575 |
| 0.0283 | 3.0 | 5871 | 0.1185 | 0.8206 | 0.8766 | 0.8477 | 0.9678 |
| 0.0226 | 4.0 | 7828 | 0.1405 | 0.8072 | 0.8978 | 0.8501 | 0.9708 |
| 0.0141 | 5.0 | 9785 | 0.1898 | 0.7224 | 0.9194 | 0.8090 | 0.9629 |
| 0.01 | 6.0 | 11742 | 0.1655 | 0.9062 | 0.8856 | 0.8958 | 0.9741 |
| 0.012 | 7.0 | 13699 | 0.1271 | 0.8965 | 0.9198 | 0.9080 | 0.9801 |
| 0.0091 | 8.0 | 15656 | 0.1919 | 0.8890 | 0.8886 | 0.8888 | 0.9719 |
| 0.0042 | 9.0 | 17613 | 0.1725 | 0.8977 | 0.8985 | 0.8981 | 0.9744 |
| 0.0043 | 10.0 | 19570 | 0.1530 | 0.8878 | 0.9034 | 0.8955 | 0.9761 |
| 0.0042 | 11.0 | 21527 | 0.1635 | 0.8792 | 0.9108 | 0.8947 | 0.9774 |
| 0.0033 | 12.0 | 23484 | 0.2009 | 0.8155 | 0.9138 | 0.8619 | 0.9719 |
| 0.0008 | 13.0 | 25441 | 0.1766 | 0.8737 | 0.9135 | 0.8932 | 0.9755 |
| 0.0005 | 14.0 | 27398 | 0.1868 | 0.8616 | 0.9129 | 0.8865 | 0.9743 |
| 0.0014 | 15.0 | 29355 | 0.1910 | 0.8694 | 0.9101 | 0.8893 | 0.9746 |