Pytorch Lightning框架

Pytorch Lightning框架

bash 复制代码
root@dsw-398300-6795fbc6cd-6752k:/mnt/workspace/bert-bilstm-in-sentiment-classification# python BiLSTM.py 
2024-07-21 20:42:10.214152: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-07-21 20:42:10.251708: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-07-21 20:42:10.870408: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
test++++++++++A
GPU available: True (cuda), used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
Some weights of the model checkpoint at ./model/bert-base-chinese were not used when initializing BertModel: ['cls.seq_relationship.bias', 'cls.predictions.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.seq_relationship.weight', 'cls.predictions.transform.dense.weight']
- This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
test+_++++++++++++B
/opt/conda/lib/python3.8/site-packages/pytorch_lightning/callbacks/model_checkpoint.py:616: UserWarning: Checkpoint directory /mnt/workspace/bert-bilstm-in-sentiment-classification/model/checkpoints exists and is not empty.
  rank_zero_warn(f"Checkpoint directory {dirpath} exists and is not empty.")
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]

  | Name      | Type             | Params
-----------------------------------------------
0 | model     | BiLSTMClassifier | 125 M 
1 | criterion | CrossEntropyLoss | 0     
-----------------------------------------------
23.6 M    Trainable params
102 M     Non-trainable params
125 M     Total params
503.553   Total estimated model params size (MB)
/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/connectors/data_connector.py:236: PossibleUserWarning: The dataloader, train_dataloader, does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` (try 8 which is the number of cpus on this machine) in the `DataLoader` init to improve performance.
  rank_zero_warn(
Epoch 4: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 487/487 [01:30<00:00,  5.38it/s, loss=0.171, v_num=8, train_loss_step=0.128, train_loss_epoch=0.185]`Trainer.fit` stopped: `max_epochs=5` reached.                                                                                                                                                                                                                                                                                
Epoch 4: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 487/487 [01:30<00:00,  5.38it/s, loss=0.171, v_num=8, train_loss_step=0.128, train_loss_epoch=0.185]
GPU available: True (cuda), used: False
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py:1764: PossibleUserWarning: GPU available but not used. Set `accelerator` and `devices` using `Trainer(accelerator='gpu', devices=1)`.
  rank_zero_warn(
Testing DataLoader 0: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 98/98 [06:36<00:00,  4.05s/it]
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃        Test metric        ┃       DataLoader 0        ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│            acc            │    0.9047619104385376     │
│          avg_f1           │    0.9017320871353149     │
│       avg_precision       │    0.9123411178588867     │
│        avg_recall         │    0.9047619104385376     │
│         f1_class0         │     0.826066792011261     │
│         f1_class1         │    0.9289177060127258     │
│           loss            │    0.2378724366426468     │
│     precision_class0      │    0.8918467164039612     │
│     precision_class1      │    0.9114090204238892     │
│       recall_class0       │    0.7939081788063049     │
│       recall_class1       │    0.9530112743377686     │
└───────────────────────────┴───────────────────────────┘
[{'loss': 0.2378724366426468, 'recall_class0': 0.7939081788063049, 'recall_class1': 0.9530112743377686, 'precision_class0': 0.8918467164039612, 'precision_class1': 0.9114090204238892, 'f1_class0': 0.826066792011261, 'f1_class1': 0.9289177060127258, 'acc': 0.9047619104385376, 'avg_recall': 0.9047619104385376, 'avg_precision': 0.9123411178588867, 'avg_f1': 0.9017320871353149}]
root@dsw-398300-6795fbc6cd-6752k:/mnt/workspace/bert-bilstm-in-sentiment-classification# 
相关推荐
开发者每周简报10 分钟前
微软的AI转型故事
人工智能·microsoft
dundunmm13 分钟前
机器学习之scikit-learn(简称 sklearn)
python·算法·机器学习·scikit-learn·sklearn·分类算法
古希腊掌管学习的神13 分钟前
[机器学习]sklearn入门指南(1)
人工智能·python·算法·机器学习·sklearn
一道微光27 分钟前
Mac的M2芯片运行lightgbm报错,其他python包可用,x86_x64架构运行
开发语言·python·macos
普密斯科技42 分钟前
手机外观边框缺陷视觉检测智慧方案
人工智能·计算机视觉·智能手机·自动化·视觉检测·集成测试
四口鲸鱼爱吃盐1 小时前
Pytorch | 利用AI-FGTM针对CIFAR10上的ResNet分类器进行对抗攻击
人工智能·pytorch·python
lishanlu1361 小时前
Pytorch分布式训练
人工智能·ddp·pytorch并行训练
是娜个二叉树!1 小时前
图像处理基础 | 格式转换.rgb转.jpg 灰度图 python
开发语言·python
互联网杂货铺1 小时前
Postman接口测试:全局变量/接口关联/加密/解密
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·postman
日出等日落1 小时前
从零开始使用MaxKB打造本地大语言模型智能问答系统与远程交互
人工智能·语言模型·自然语言处理