【NLP】医学搜索Query相关性判断【阿里云:天池比赛】

比赛地址:【NLP】医学搜索Query相关性判断
https://tianchi.aliyun.com/competition/entrance/532001/introduction?spm=a2c22.12281925.0.0.684a71371ZOgK4V1版本:
分数:0.8258方案:BERT 通用模型
预训练模型:bert-base-chinese训练结果:
Val P: 0.758,  Val R: 76.6730%,  Val F1: 0.7595,  Val Acc: 81.7135%,  Time: 0:01:28V2版本:
分数:0.8534方案:BERT 行业模型
预训练模型:ernie-health-chinese训练结果:
loss: 0.50159, accu: 0.82927V3版本:使用V2的代码,只要在参数中换个模型名称:ernie-3.0-xbase-zh
方案:BERT 更大的模型
预训练模型:ernie-3.0-xbase-zh训练结果:
loss: 0.4193, accu: 0.85303V4版本:
方案:BERT 多模型融合:为各个模型配置权重,预测结果=各个模型(结果*权重)相加求和
分数:0.8703
排名:60(本次)/23398(团体或个人)运行脚本:
python train_main.py# 安装paddlenlp
#windows版本paddlenlp==2.6.0
python -m pip install paddlenlp==2.6.0 -f https://www.paddlepaddle.org.cn/whl/paddlenlp.html# 安装paddle-gpu
#windows版本paddlepaddle==2.6.1
python -m pip install paddlepaddle==2.6.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
#python -m pip install paddlepaddle-gpu==2.6.1 -i https://pypi.tuna.tsinghua.edu.cn/simpleV1+V2源码如下:

NLP医学搜索Query相关性判断【阿里云:天池比赛】包括V1+V2+V33个版本的代码资源-CSDN文库

V2核心代码:参考:医学搜索Query相关性判断【Baseline】 - 飞桨AI Studio星河社区

多模型融合:

# 模型的定义
from paddlenlp.transformers import AutoModelForSequenceClassification, AutoTokenizer# 直接从训练好的模型路径载入
params_paths = ['/home/aistudio/data/data224188/model/ernie-3.0-xbase-zh_7_260','/home/aistudio/data/data224188/model/ernie-health-chinese_1', '/home/aistudio/data/data224188/model/roberta-wwm-ext-large_3',]aotu_model = [True, True, True]model_list = []
tokenizer_list = []
for i, params_path in enumerate(params_paths):if aotu_model[i]:model = AutoModelForSequenceClassification.from_pretrained(params_path, num_classes=3)else:model = CustomModel(params_path, num_classes=3)tokenizer = AutoTokenizer.from_pretrained(params_path, padding=True, max_length=128, truncation=True)model_list.append(model)tokenizer_list.append(tokenizer)# 测试集处理
import copytest_data_loader_list = []
for tokenizer in tokenizer_list:# 测试集数据预处理,利用分词器将文本转化为整数序列new_dataset = copy.deepcopy(test_data)trans_func_test = functools.partial(preprocess_function, tokenizer=tokenizer, max_seq_length=128, is_test=True)test_ds_trans = new_dataset.map(trans_func_test)# 进行采样组batchcollate_fn_test = DataCollatorWithPadding(tokenizer)test_batch_sampler = BatchSampler(test_ds_trans, batch_size=8, shuffle=False)test_data_loader = DataLoader(dataset=test_ds_trans, batch_sampler=test_batch_sampler, collate_fn=collate_fn_test)test_data_loader_list.append(test_data_loader)# 模型预测分类结果
import paddle.nn.functional as F# 设置权重
weight_list = [0.50, 0.11, 0.15]results = []
for model in model_list:model.eval()for batch_id, all_batches in enumerate(zip(*test_data_loader_list)):for model_id, batch in enumerate(all_batches):if model_id==0:logits = model_list[model_id](batch['input_ids'], batch['token_type_ids'])logits *= weight_list[0]else:this_logits = model_list[model_id](batch['input_ids'], batch['token_type_ids'])logits += this_logits * weight_list[model_id]probs = F.softmax(logits, axis=-1)idx = paddle.argmax(probs, axis=1).numpy()idx = idx.tolist()preds = [str(i) for i in idx]results.extend(preds)

配置或参数:

import osfrom paddlenlp.transformers import AutoTokenizer# 获取当前脚本所在的目录
current_path = os.path.dirname(os.path.abspath(__file__))# 获取当前脚本所在的项目根目录
root_path = os.path.dirname(current_path)print("项目根目录路径:", root_path)run_env = os.getenv('ENV', 'NULL')print("当前环境:", run_env)model_root_dir = '/data/nfs/baozhi/models'data_root_dir = 'data/'class Config(object):"""配置参数"""def __init__(self):self.hidden_size = 768self.batch_size = 64# 训练时使用# ***** epochs轮数 *****self.train_epochs = 10self.seed = 123self.lr = 5e-5self.other_lr = 3e-4self.early_stop = 20  # 验证多少次,loss没有上升,提前结束训练# 超参数设置self.log_steps = 10 * int(128 / self.batch_size)  # 多少个step展示一次训练结果self.eval_steps = 10 * int(128 / self.batch_size)  # 每隔几步评估模型,同时保存模型# 分类标签数量self.num_tags = 3self.dataloader_num_workers = 4self.max_length = 128self.dropout = 0.1# 如果不存在该文件,需要解压缩company.rar文件self.data_dir = data_root_dirself.log_dir = data_root_dir + "logs/"self.output_dir = data_root_dir + "/output_data/"self.output_redict = data_root_dir + "/output_data/predict.json"# 本地环境if run_env == 'local':self.model_path = "ernie-3.0-xbase-zh"else:self.model_path = "ernie-3.0-xbase-zh"self.tokenizer = AutoTokenizer.from_pretrained(self.model_path, padding=True, max_length=self.max_length,truncation=True)print('confs end...')print(self.tokenizer)

训练:

import loggingimport torch
from sklearn.metrics import accuracy_score, f1_score, classification_reportfrom eval import evaluatelogger = logging.getLogger(__name__)
import torch.nn.functional as F
import paddle
import os
from visualdl import LogWriter
import json
from confs import Config
# 开始训练
import time
import paddle.nn.functional as F
from paddlenlp.transformers import AutoModelForSequenceClassification# 根据概率排序
def sort_list(data_list, min=0.5, size=3):ids = []data_dict = {}if not data_list or len(data_list) < 1:return idsfor index, item in enumerate(data_list[0]):if item and type(item) == float:data_dict[index] = itemsort_result = sorted(data_dict.items(), key=lambda kv: (kv[1], kv[0]), reverse=True)for index, value in sort_result:if len(ids) >= size:breakif value > min:ids.append(index)return idsclass Trainer:def __init__(self, args: Config, train_loader, dev_loader, test_loader):self.checkpoint = Noneself.args = argsself.device_type = 'cpu'# self.device_type2 = 'gpu' if torch.cuda.is_available() else 'cpu'self.device = torch.device(self.device_type)self.model = AutoModelForSequenceClassification.from_pretrained(args.model_path, num_classes=args.num_tags, dropout=args.dropout)# Adam优化器、交叉熵损失函数、accuracy评价指标self.optimizer = paddle.optimizer.AdamW(learning_rate=self.args.lr, parameters=self.model.parameters())self.criterion = paddle.nn.loss.CrossEntropyLoss()# 设置类别的Loss权重self.class_weight = paddle.to_tensor([1.3, 1.0, 1.0], dtype='float32')self.criterion = paddle.nn.loss.CrossEntropyLoss(weight=self.class_weight)self.train_loader = train_loaderself.dev_loader = dev_loaderself.test_loader = test_loader# self.model.to(self.device)def get_params(self):checkpoint = self.checkpointreturn self.model, self.optimizer, checkpoint['epoch'], checkpoint['loss']def load_ckp(self, model, optimizer, check_point_path):if self.device.type == 'cpu':checkpoint = torch.load(check_point_path, map_location=torch.device('cpu'))print('checkpoint use cpu')else:checkpoint = torch.load(check_point_path)print('checkpoint use gpu')self.checkpoint = checkpointmodel.load_state_dict(checkpoint['state_dict'])optimizer.load_state_dict(checkpoint['optimizer'])epoch = checkpoint['epoch']loss = checkpoint['loss']return model, optimizer, epoch, lossdef save_ckp(self, state, checkpoint_path):torch.save(state, checkpoint_path)"""def save_ckp(self, state, is_best, checkpoint_path, best_model_path):tmp_checkpoint_path = checkpoint_pathtorch.save(state, tmp_checkpoint_path)if is_best:tmp_best_model_path = best_model_pathshutil.copyfile(tmp_checkpoint_path, tmp_best_model_path)"""# def evaluate( model, class_list, data_iter, test=False):#     model.eval()#     loss_total = 0#     predict_all = np.array([], dtype=int)#     labels_all = np.array([], dtype=int)#     with torch.no_grad():#         for texts, labels in data_iter:#             outputs = model(texts)#             loss = F.cross_entropy(outputs, labels)#             loss_total += loss#             labels = labels.data.cpu().numpy()#             predic = torch.max(outputs.data, 1)[1].cpu().numpy()#             labels_all = np.append(labels_all, labels)#             predict_all = np.append(predict_all, predic)#     p = metrics.precision_score(labels_all, predict_all, average='macro')#     r = metrics.recall_score(labels_all, predict_all, average='macro')#     f1 = metrics.f1_score(labels_all, predict_all, average='macro')#     acc = metrics.accuracy_score(labels_all, predict_all)#     if test:#         report = metrics.classification_report(labels_all, predict_all, target_names=class_list, digits=4)#         confusion = metrics.confusion_matrix(labels_all, predict_all)#         # return acc, loss_total / len(data_iter), report, confusion, predict_all#         return p, r, f1, acc, loss_total / len(data_iter), report, confusion, predict_all#     # return acc, loss_total / len(data_iter)#     return p, r, f1, acc, loss_total / len(data_iter)def train(self):# 冻结模型# ernie.poolername_list = []for name, param in self.model.named_parameters():name_list.append(name)if not name.startswith('classifier') and not name.startswith('roberta.pooler'):param.requires_grad = Falseelse:param.requires_grad = Trueprint(name_list[-10:])# 超参数设置lr = self.args.lr  # 学习率epochs = self.args.train_epochs  # 训练轮次early_stop = self.args.early_stop  # 验证多少次,loss没有上升,提前结束训练save_dir = self.args.output_dir  # 训练过程中保存模型参数的文件夹log_dir = self.args.log_dir  # VisaulDL的保存路径twriter = LogWriter(log_dir)metric = paddle.metric.Accuracy()# rdrop_loss = paddlenlp.losses.RDropLoss()  # R-Drop数据增广stop_trainning = Falsebest_train_dev_error = 1eval_times = 0best_loss = 1000.best_acc = 0best_step = 0global_step = 0  # 迭代次数tic_train = time.time()# 可以看一下整个模型的结构print(self.model)for epoch in range(self.args.train_epochs):if stop_trainning:breakfor step, batch in enumerate(self.train_loader):self.model.train()print(step)# input_ids, token_type_ids, labels, attention_mask = batch['input_ids'], batch['token_type_ids'], batch['labels'], batch['attention_mask']input_ids, token_type_ids, labels = batch['input_ids'], batch['token_type_ids'], batch['labels']# 计算模型输出、损失函数值、分类概率值、准确率logits = self.model(input_ids, token_type_ids)# logits = self.model(input_ids, attention_mask, token_type_ids)loss = self.criterion(logits, labels)probs = F.softmax(logits, axis=1)correct = metric.compute(probs, labels)metric.update(correct)acc = metric.accumulate()# # R-Drop数据增强# logits_2 = model(input_ids, token_type_ids)  # 因为dropout层的存在,每个时刻的模型的输出都不同# kl_loss = rdrop_loss(logits, logits_2)# loss = loss + kl_loss# 每迭代10次,打印损失函数值、准确率、计算速度global_step += 1if global_step % self.args.log_steps == 0:print("global step %d, epoch: %d, batch: %d, loss: %.5f, accu: %.5f, speed: %.2f step/s"% (global_step, epoch, step, loss, acc,10 / (time.time() - tic_train)))tic_train = time.time()# VisualDL 推流twriter.add_scalar('loss', loss, global_step)twriter.add_scalar('train acc', acc, global_step)# 反向梯度回传,更新参数loss.backward()self.optimizer.step()self.optimizer.clear_grad()# 评估当前训练的模型、保存当前最佳模型参数和分词器的词表等if global_step % self.args.eval_steps == 0:if not os.path.exists(save_dir):os.makedirs(save_dir)print("global step", global_step, end=' ')acc_eval, loss_eval = evaluate(self.model, self.criterion, metric, self.dev_loader)# VisualDL 推流twriter.add_scalar('eval acc', acc_eval, global_step)twriter.add_scalar('eval loss', loss_eval, global_step)eval_times += 1if eval_times > early_stop:print('-----------------Early Stopping-----------------')stop_trainning = Truebreak# 保存模型if acc_eval > best_acc and loss_eval < best_loss:best_acc = acc_evalbest_loss = loss_evalbest_step = global_stepself.model.save_pretrained(save_dir)self.args.tokenizer.save_pretrained(save_dir)print('save model to {}'.format(save_dir))eval_times = 0# 这里是保存一些,虽然loss和acc没有同时升高,但是train acc和eval acc都比较可观的模型if acc_eval > 0.84 and acc > 0.90:best_train_dev_error = abs(acc - acc_eval)new_save_dir = save_dir[:-1] + '_' + str(global_step) + '/'if not os.path.exists(new_save_dir):os.makedirs(new_save_dir)print('new save model to {}'.format(new_save_dir))self.model.save_pretrained(new_save_dir)self.args.tokenizer.save_pretrained(new_save_dir)def dev(self):self.model.eval()total_loss = 0.0dev_outputs = []dev_targets = []with torch.no_grad():for dev_step, dev_data in enumerate(self.dev_loader):token_ids = dev_data['input_ids'].to(self.device)attention_masks = dev_data['attention_mask'].to(self.device)token_type_ids = dev_data['token_type_ids'].to(self.device)labels = dev_data['labels'].to(self.device)outputs = self.model(token_ids, attention_masks, token_type_ids)self.model.zero_grad()loss = F.cross_entropy(outputs, labels)# val_loss = val_loss + ((1 / (dev_step + 1))) * (loss.item() - val_loss)total_loss += loss.item()outputs1 = torch.max(outputs, 1)[1]dev_outputs.extend(outputs1.tolist())dev_targets.extend(labels.cpu().detach().numpy().tolist())return total_loss, dev_outputs, dev_targetsdef test(self, checkpoint_path):model = self.modeloptimizer = self.optimizermodel, optimizer, epoch, loss = self.load_ckp(model, optimizer, checkpoint_path)model.eval()model.to(self.device)total_loss = 0.0test_outputs = []test_targets = []index = 0test_examples = self.test_loader.dataset.examplesresult_examples = []with torch.no_grad():for test_step, test_data in enumerate(self.test_loader):token_ids = test_data['input_ids'].to(self.device)attention_masks = test_data['attention_mask'].to(self.device)token_type_ids = test_data['token_type_ids'].to(self.device)outputs = model(token_ids, attention_masks, token_type_ids)self.model.zero_grad()outputs1 = torch.max(outputs, 1)[1].cpu()outputs1 = outputs1.cpu().detach().numpy().tolist()test_outputs.extend(outputs1)for item in outputs1:example = test_examples[index]example.label = str(item)index += 1result_examples.append({"id": example.guid, "query1":example.text_a, "query2": example.text_b, "label": example.label})for example in test_examples:result_examples.append({"id": example.guid, "query1": example.text_a, "query2": example.text_b, "label": example.label})with open(self.args.output_redict, 'w', encoding='utf-8') as f:f.write(json.dumps(result_examples, ensure_ascii=False))assert len(test_outputs) == len(test_examples)print(len(test_examples))def predict(self, tokenizer, text, id2label, max_seq_len):model, optimizer, epoch, loss = self.get_params()model.eval()model.to(self.device)with torch.no_grad():inputs = tokenizer.encode_plus(text=text,add_special_tokens=True,max_length=max_seq_len,truncation='longest_first',padding="max_length",return_token_type_ids=True,return_attention_mask=True,return_tensors='pt')token_ids = inputs['input_ids'].to(self.device)attention_masks = inputs['attention_mask'].to(self.device)token_type_ids = inputs['token_type_ids'].to(self.device)outputs = model(token_ids, attention_masks, token_type_ids)self.model.zero_grad()outputs1 = torch.max(outputs, 1)[1]if len(outputs1) != 0:return outputs1[0]else:return Nonedef get_metrics(self, outputs, targets):accuracy = accuracy_score(targets, outputs)micro_f1 = f1_score(targets, outputs, average='micro')macro_f1 = f1_score(targets, outputs, average='macro')return accuracy, micro_f1, macro_f1def get_classification_report(self, outputs, targets, labels):# confusion_matrix = multilabel_confusion_matrix(targets, outputs)report = classification_report(targets, outputs, target_names=labels)return report

数据处理:

# 分词,batch化
import functools
import numpy as npfrom paddle.io import DataLoader, BatchSampler
from paddlenlp.data import DataCollatorWithPadding# 定义数据集
from paddlenlp.datasets import MapDatasetfrom PIL import Image
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
import numpy as np
import sys
import matplotlib.pyplot as plt
import os
import pickle
from visualdl import LogWriter
from tqdm import tqdm
import json
import copyclass MyDataset(paddle.io.Dataset):def __init__(self, mode='train'):super(MyDataset, self).__init__()self.mode = modeif mode == 'train':self.data_path = 'data/KUAKE-QQR_train.json'if mode == 'dev':self.data_path = 'data/KUAKE-QQR_dev.json'if mode == 'test':self.data_path = 'data/KUAKE-QQR_test.json'with open(self.data_path, 'r', encoding='utf-8') as input_data:self.json_content = json.load(input_data)self.data = []for block in self.json_content:sample = {}sample['record_id'] = block['id']sample['query1'] = block['query1']sample['query2'] = block['query2']sample['label'] = block['label']if sample['label'] == 'NA':continueself.data.append(sample)def __getitem__(self, idx):query1 = self.data[idx]['query1']query2 = self.data[idx]['query2']label = self.data[idx]['label']return self.data[idx]def __len__(self):return len(self.data)def label_num(self):# 返回该数据集下各个label的个数label_0, label_1, label_2 = 0, 0, 0for sample in self.data:if sample['label'] == '0':label_0 += 1if sample['label'] == '1':label_1 += 1if sample['label'] == '2':label_2 += 1return (label_0, label_1, label_2)# 数据预处理函数,利用分词器将文本转化为整数序列
def preprocess_function(examples, tokenizer, max_seq_length, is_test=False):result = tokenizer(text=examples["query1"], text_pair=examples["query2"], max_length=max_seq_length)if not is_test:if examples["label"] == '0':result["labels"] = 0elif examples["label"] == '1':result["labels"] = 1elif examples["label"] == '2':result["labels"] = 2else:print(examples)# result["labels"] = int(examples["label"])else:result['id'] = int(examples["record_id"][1:])  # record_id = 's1'return resultdef gen_data_load(train_data: MapDataset,  tokenizer, batch_size: int, max_length:int, shuffle=False):trans_func = functools.partial(preprocess_function, tokenizer=tokenizer, max_seq_length=max_length)train_data_cp = copy.deepcopy(train_data).map(trans_func)print(train_data_cp[0])# collate_fn函数构造,将不同长度序列充到批中数据的最大长度,再将数据堆叠collate_fn = DataCollatorWithPadding(tokenizer, padding=True)# 定义BatchSampler,选择批大小和是否随机乱序,进行DataLoadertrain_batch_sampler = BatchSampler(train_data_cp, batch_size=batch_size, shuffle=shuffle)# 数据集定义train_data_loader = DataLoader(dataset=train_data_cp, batch_sampler=train_batch_sampler,collate_fn=collate_fn)for _, data in enumerate(train_data_loader, start=1):print("gen_data_load:pp")print(data)breakprint("gen_data_load end...")return train_data_loader

评估:


import numpy as np
def evaluate(model, criterion, metric, data_loader, phase="dev"):model.eval()metric.reset()losses = []for batch in data_loader:input_ids, token_type_ids, labels = batch['input_ids'], batch['token_type_ids'], batch['labels']logits = model(input_ids=input_ids, token_type_ids=token_type_ids)loss = criterion(logits, labels)losses.append(loss.numpy())correct = metric.compute(logits, labels)metric.update(correct)accu = metric.accumulate()print("eval {} loss: {:.5}, accu: {:.5}".format(phase,np.mean(losses), accu))model.train()metric.reset()return accu, np.mean(losses)

程序入口:

import loggingfrom bert_trainer import Trainer
from confs import Configlogger = logging.getLogger(__name__)import os
# 训练数据数量
# 定义数据集
from paddlenlp.datasets import MapDataset
from preprocess import MyDataset, gen_data_loadif __name__ == '__main__':label2id = {"0": 0, "1": 1, "2": 2}id2label = {0: "0", 1: "1", 2: "2"}config = Config()config.num_tags = len(label2id.keys())print(config)train_flag = Truetest_flag = Truepredict_flag = False# initialize tokenizertokenizer = config.tokenizer# 训练和验证print('initialize dataloader')train_data = MyDataset()test_data = MyDataset('test')dev_data = MyDataset('dev')# 转换为paddleNPL专用的数据集格式train_data = MapDataset(train_data)test_data = MapDataset(test_data)dev_data = MapDataset(dev_data)print("gen_data_load start...")train_loader = gen_data_load(train_data, config.tokenizer, config.batch_size, config.max_length, shuffle=True)dev_loader = gen_data_load(dev_data, config.tokenizer, config.batch_size, config.max_length, shuffle=False)test_loader = gen_data_load(test_data, config.tokenizer, config.batch_size, config.max_length, shuffle=False)if train_flag:print("train...")trainer = Trainer(config, train_loader, dev_loader, dev_loader)trainer.train()if test_flag:# 测试print('========进行测试========')trainer = Trainer(config, None, None, test_loader)checkpoint_path = os.path.join(config.output_dir, 'best.pt')trainer.test(checkpoint_path)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/471840.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Go开发指南- Goroutine

目录&#xff1a; (1)Go开发指南-Hello World (2)Go开发指南-Gin与Web开发 (3)Go开发指南-Goroutine Goroutine 在java中我们要实现并发编程的时候&#xff0c;通常要自己维护一个线程池&#xff0c;并且需要去包装任务、调度任务和维护上下文切换。这个过程需要消耗大量的精…

解决failed to execute PosixPath(‘dot‘) 或者GraphViz‘s executables not found

在网上找了很多方法都没解决&#xff0c;所以写一篇文章帮助和我遇到同样问题的人 解决方法&#xff1a; 因为python解释器会解释转移字符&#xff0c;因此在环境变量中把\bin换成\\bin即可 解决过程&#xff1a; 系统&#xff1a;win10 已安装pip install graphviz&#xff0…

力扣 LeetCode 541. 反转字符串II(Day4:字符串)

解题思路&#xff1a; i可以成段成段的跳&#xff0c;而不是简单的i class Solution {public String reverseStr(String s, int k) {char[] ch s.toCharArray();// 1. 每隔 2k 个字符的前 k 个字符进行反转for (int i 0; i < ch.length; i 2 * k) {// 2. 剩余字符小于 …

官方压测工具memtier-benchmark压测redis

1 概述 memtier_benchmark是一种高吞吐量的性能基准测试工具&#xff0c;主要用于Redis和Memcached。它是 Redis官方开发团队开发的&#xff0c;旨在生成各种流量模式&#xff0c;以便测试和优化以上两个数据库的性能。 memtier_benchmark的一些关键特点如下&#xff1a; 多…

用 Python 从零开始创建神经网络(三):添加层级(Adding Layers)

添加层级&#xff08;Adding Layers&#xff09; 引言1. Training Data2. Dense Layer Class 引言 我们构建的神经网络变得越来越受人尊敬&#xff0c;但目前我们只有一层。当神经网络具有两层或更多隐藏层时&#xff0c;它们变成了“深度”网络。目前我们只有一层&#xff0c…

MFC工控项目实例三十实现一个简单的流程

启动按钮夹紧 密闭&#xff0c;时间0到平衡 进气&#xff0c;时间1到进气关&#xff0c;时间2到平衡关 检测&#xff0c;时间3到平衡 排气&#xff0c;时间4到夹紧开、密闭开、排气关。 相关代码 void CSEAL_PRESSUREDlg::OnTimer_2(UINT nIDEvent_2) {// if (nIDEvent_21 &am…

Java I/O(输入/输出)——针对实习面试

目录 Java I/O&#xff08;输入/输出&#xff09;什么是Java I/O流&#xff1f;字节流和字符流有什么区别&#xff1f;什么是缓冲流&#xff1f;为什么要使用缓冲流&#xff1f;Java I/O中的设计模式有哪些&#xff1f;什么是BIO&#xff1f;什么是NIO&#xff1f;什么是AIO&am…

Exploring Defeasible Reasoning in Large Language Models: A Chain-of-Thought A

文章目录 题目摘要简介准备工作数据集生成方法实验结论 题目 探索大型语言模型中的可废止推理&#xff1a;思路链 论文地址&#xff1a;http://collegepublications.co.uk/downloads/LNGAI00004.pdf#page136 摘要 许多大型语言模型 (LLM) 经过大量高质量数据语料库的训练&…

数据结构--数组

一.线性和非线性 线性&#xff1a;除首尾外只有一个唯一的前驱和后继。eg&#xff1a;数组&#xff0c;链表等。 非线性&#xff1a;不是线性的就是非线性。 二.数组是什么&#xff1f; 数组是一个固定长度的存储相同数据类型的数据结构&#xff0c;数组中的元素被存储在一…

MySQL技巧之跨服务器数据查询:基础篇-更新语句如何写

MySQL技巧之跨服务器数据查询&#xff1a;基础篇-更新语句如何写 上一篇已经描述&#xff1a;借用微软的SQL Server ODBC 即可实现MySQL跨服务器间的数据查询。 而且还介绍了如何获得一个在MS SQL Server 可以连接指定实例的MySQL数据库的连接名: MY_ODBC_MYSQL 以及用同样的…

Unity教程(十八)战斗系统 攻击逻辑

Unity开发2D类银河恶魔城游戏学习笔记 Unity教程&#xff08;零&#xff09;Unity和VS的使用相关内容 Unity教程&#xff08;一&#xff09;开始学习状态机 Unity教程&#xff08;二&#xff09;角色移动的实现 Unity教程&#xff08;三&#xff09;角色跳跃的实现 Unity教程&…

前端学习八股资料CSS(二)

更多详情&#xff1a;爱米的前端小笔记&#xff0c;更多前端内容&#xff0c;等你来看&#xff01;这些都是利用下班时间整理的&#xff0c;整理不易&#xff0c;大家多多&#x1f44d;&#x1f49b;➕&#x1f914;哦&#xff01;你们的支持才是我不断更新的动力&#xff01;找…

云计算研究实训室建设方案

一、引言 随着云计算技术的迅速发展和广泛应用&#xff0c;职业院校面临着培养云计算领域专业人才的迫切需求。本方案旨在构建一个先进的云计算研究实训室&#xff0c;为学生提供一个集理论学习、实践操作、技术研发与创新于一体的综合性学习平台&#xff0c;以促进云计算技术…

通过Python 调整Excel行高、列宽

在Excel中&#xff0c;默认的行高和列宽可能不足以完全显示某些单元格中的内容&#xff0c;特别是当内容较长时。通过调整行高和列宽&#xff0c;可以确保所有数据都能完整显示&#xff0c;避免内容被截断。合理的行高和列宽可以使表格看起来更加整洁和专业&#xff0c;尤其是在…

【代码审计】常见漏洞专项审计-业务逻辑漏洞审计

❤️博客主页&#xff1a; iknow181 &#x1f525;系列专栏&#xff1a; 网络安全、 Python、JavaSE、JavaWeb、CCNP &#x1f389;欢迎大家点赞&#x1f44d;收藏⭐评论✍ 0x01 漏洞介绍 1、 原理 业务逻辑漏洞是一类特殊的安全漏洞&#xff0c;业务逻辑漏洞属于设计漏洞而非实…

Wordpress常用配置,包括看板娘跨域等

一个Wordpress的博客已经搭建完成了&#xff0c;那么为了让它看起来更有人间烟火气一点&#xff0c;有一些常用的初始配置&#xff0c;这里整理一下。 修改页脚 页脚这里默认会显示Powered by Wordpress&#xff0c;还有一个原因是这里要加上备案信息。在主题里找到页脚&…

数据库范式、MySQL 架构、算法与树的深入解析

一、数据库范式 在数据库设计中&#xff0c;范式是一系列规则&#xff0c;用于确保数据的组织和存储具有良好的结构、完整性以及最小化的数据冗余。如果不遵循范式设计&#xff0c;数据可能会以平铺式罗列&#xff0c;仅使用冒号、分号等简单分隔。这种方式存在诸多弊端&#…

Taro React-Native IOS 打包发布

http网络请求不到 配置 fix react-native facebook::flipper::SocketCertificateProvider‘ (aka ‘int‘) is not a function or func_rn运行debug提示flipper-CSDN博客 Xcode 15&#xff08;iOS17&#xff09;编译适配报错_no template named function in namespace std-CS…

基于yolov8、yolov5的车型检测识别系统(含UI界面、训练好的模型、Python代码、数据集)

摘要&#xff1a;车型识别在交通管理、智能监控和车辆管理中起着至关重要的作用&#xff0c;不仅能帮助相关部门快速识别车辆类型&#xff0c;还为自动化交通监控提供了可靠的数据支撑。本文介绍了一款基于YOLOv8、YOLOv5等深度学习框架的车型识别模型&#xff0c;该模型使用了…

从python源码到可自动更新软件

相关阅读 标题链接如何打包python程序为exebczl【auto-py-to-exe 可视化打包python到exe】51CTO ZATA 1. python源码 打包时需要特别注意的源码编写规范 除了基本的 Python 编码规范之外,在准备程序进行打包时,还需要特别注意以下几点: 1.1 依赖管理 确保 requirements.t…