【PyTorch】语言模型/Language model

2023-11-16

1 模型描述

(1)语言模型的定义,来自于维基百科

  • 统计式的语言模型是一个几率分布。语言模型提供上下文来区分听起来相似的单词和短语。例如,短语“再给我两份葱,让我把记忆煎成饼”和“再给我两分钟,让我把记忆结成冰”听起来相似,但意思不同。
  • 语言模型经常使用在许多自然语言处理方面的应用,如语音识别,机器翻译,词性标注,句法分析,手写体识别和资讯检索。由于字词与句子都是任意组合的长度,因此在训练过的语言模型中会出现未曾出现的字串(资料稀疏的问题),也使得在语料库中估算字串的几率变得很困难,这也是要使用近似的平滑n-元语法(N-gram)模型之原因。
  • 在语音辨识和在资料压缩的领域中,这种模式试图捕捉语言的特性,并预测在语音串列中的下一个字。
  • 在语音识别中,声音与单词序列相匹配。当来自语言模型的证据与发音模型和声学模型相结合时,歧义更容易解决。

(2)数据集

  • 这里使用的是Penn Treebank词性标记集
  • 简单地说,语言模型就是用来计算一个句子的概率的模型,也就是判断一句话是否是人话的概率?句子概率越大,语言模型越好,迷惑度越小(from 深入浅出讲解语言模型),因此模型输出是接近人话的文本

2 相关代码

# language model
# Some part of the code was referenced from below.
# https://github.com/pytorch/examples/tree/master/word_language_model 
import torch
import torch.nn as nn
import numpy as np
from torch.nn.utils import clip_grad_norm_
# for dropout


class Dictionary(object):
    def __init__(self): # bi-directional dic
        self.word2idx = {}
        self.idx2word = {}
        self.idx = 0
    
    def add_word(self, word):
        if not word in self.word2idx:
            self.word2idx[word] = self.idx
            self.idx2word[self.idx] = word
            self.idx += 1
    
    def __len__(self):
        return len(self.word2idx)


class Corpus(object):
    def __init__(self):
        self.dictionary = Dictionary()

    def get_data(self, path, batch_size=20):
        # Add words to the dictionary
        with open(path, 'r') as f:
            tokens = 0
            for line in f:
                words = line.split() + ['<eos>']
                tokens += len(words)
                for word in words: 
                    self.dictionary.add_word(word)  
        
        # Tokenize the file content
        # recode all words and tokens
        ids = torch.LongTensor(tokens)
        token = 0
        with open(path, 'r') as f:
            for line in f:
                words = line.split() + ['<eos>']
                for word in words:
                    ids[token] = self.dictionary.word2idx[word]
                    token += 1
        num_batches = ids.size(0) // batch_size
        ids = ids[:num_batches*batch_size]
        return ids.view(batch_size, -1)


# Device configuration
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

# Hyper-parameters
embed_size = 128
hidden_size = 1024
num_layers = 1
num_epochs = 5
num_samples = 1000     # number of words to be sampled
batch_size = 20
seq_length = 30
learning_rate = 0.002

# Load "Penn Treebank" dataset
corpus = Corpus()
ids = corpus.get_data('data/train.txt', batch_size)
vocab_size = len(corpus.dictionary)
num_batches = ids.size(1) // seq_length


# RNN based language model
class RNNLM(nn.Module):
    def __init__(self, vocab_size, embed_size, hidden_size, num_layers):
        super(RNNLM, self).__init__()
        self.embed = nn.Embedding(vocab_size, embed_size) # embedding like mapping
        self.lstm = nn.LSTM(embed_size, hidden_size, num_layers, batch_first=True)
        self.linear = nn.Linear(hidden_size, vocab_size) # outlayer is a linear function
        
    def forward(self, x, h):
        # Embed word ids to vectors
        x = self.embed(x)
        
        # Forward propagate LSTM
        out, (h, c) = self.lstm(x, h)
        
        # Reshape output to (batch_size*sequence_length, hidden_size)
        out = out.reshape(out.size(0)*out.size(1), out.size(2))
        
        # Decode hidden states of all time steps
        out = self.linear(out)
        return out, (h, c)

model = RNNLM(vocab_size, embed_size, hidden_size, num_layers).to(device)

# Loss and optimizer
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)

# Truncated backpropagation
def detach(states):
    return [state.detach() for state in states] 

# Train the model
for epoch in range(num_epochs):
    # Set initial hidden and cell states
    states = (torch.zeros(num_layers, batch_size, hidden_size).to(device),
              torch.zeros(num_layers, batch_size, hidden_size).to(device))
    
    for i in range(0, ids.size(1) - seq_length, seq_length):
        # Get mini-batch inputs and targets
        inputs = ids[:, i:i+seq_length].to(device)
        targets = ids[:, (i+1):(i+1)+seq_length].to(device)
        
        # Forward pass
        states = detach(states)
        outputs, states = model(inputs, states)
        loss = criterion(outputs, targets.reshape(-1))
        
        # Backward and optimize
        optimizer.zero_grad()
        loss.backward()
        clip_grad_norm_(model.parameters(), 0.5)
        optimizer.step()

        step = (i+1) // seq_length
        if step % 100 == 0:
            print ('Epoch [{}/{}], Step[{}/{}], Loss: {:.4f}, Perplexity: {:5.2f}'
                   .format(epoch+1, num_epochs, step, num_batches, loss.item(), np.exp(loss.item())))

# Test the model
with torch.no_grad():
    with open('sample.txt', 'w') as f:
        # Set intial hidden ane cell states
        state = (torch.zeros(num_layers, 1, hidden_size).to(device),
                 torch.zeros(num_layers, 1, hidden_size).to(device))

        # Select one word id randomly
        prob = torch.ones(vocab_size)
        input = torch.multinomial(prob, num_samples=1).unsqueeze(1).to(device)

        for i in range(num_samples):
            # Forward propagate RNN 
            output, state = model(input, state)

            # Sample a word id
            prob = output.exp()
            word_id = torch.multinomial(prob, num_samples=1).item()

            # Fill input with sampled word id for the next time step
            input.fill_(word_id)

            # File write
            word = corpus.dictionary.idx2word[word_id]
            word = '\n' if word == '<eos>' else word + ' '
            f.write(word)

            if (i+1) % 100 == 0:
                print('Sampled [{}/{}] words and save to {}'.format(i+1, num_samples, 'sample.txt'))

# Save the model checkpoints
torch.save(model.state_dict(), 'model.ckpt')

3 程序输出

上述程序的输出如下所示,随着训练程度增加(速度较慢),Loss(交叉熵)和Perplexity(Loss的e次方)不断下降,则模型输出的语言更接近人话。

Epoch [1/5], Step[0/1549], Loss: 9.2150, Perplexity: 10046.61
Epoch [1/5], Step[100/1549], Loss: 6.0423, Perplexity: 420.85
Epoch [1/5], Step[200/1549], Loss: 5.9387, Perplexity: 379.44
Epoch [1/5], Step[300/1549], Loss: 5.7512, Perplexity: 314.56
Epoch [1/5], Step[400/1549], Loss: 5.6709, Perplexity: 290.30
Epoch [1/5], Step[500/1549], Loss: 5.1621, Perplexity: 174.54
Epoch [1/5], Step[600/1549], Loss: 5.1755, Perplexity: 176.89
Epoch [1/5], Step[700/1549], Loss: 5.3721, Perplexity: 215.32
Epoch [1/5], Step[800/1549], Loss: 5.1827, Perplexity: 178.17
Epoch [1/5], Step[900/1549], Loss: 5.0756, Perplexity: 160.06
Epoch [1/5], Step[1000/1549], Loss: 5.1428, Perplexity: 171.19
Epoch [1/5], Step[1100/1549], Loss: 5.3263, Perplexity: 205.67
Epoch [1/5], Step[1200/1549], Loss: 5.1895, Perplexity: 179.39
Epoch [1/5], Step[1300/1549], Loss: 5.0724, Perplexity: 159.56
Epoch [1/5], Step[1400/1549], Loss: 4.8528, Perplexity: 128.10
Epoch [1/5], Step[1500/1549], Loss: 5.1661, Perplexity: 175.22
Epoch [2/5], Step[0/1549], Loss: 5.4163, Perplexity: 225.05
Epoch [2/5], Step[100/1549], Loss: 4.5526, Perplexity: 94.88
Epoch [2/5], Step[200/1549], Loss: 4.6929, Perplexity: 109.17
Epoch [2/5], Step[300/1549], Loss: 4.6444, Perplexity: 104.00
Epoch [2/5], Step[400/1549], Loss: 4.5688, Perplexity: 96.42
Epoch [2/5], Step[500/1549], Loss: 4.1592, Perplexity: 64.02
Epoch [2/5], Step[600/1549], Loss: 4.4269, Perplexity: 83.67
Epoch [2/5], Step[700/1549], Loss: 4.3720, Perplexity: 79.20
Epoch [2/5], Step[800/1549], Loss: 4.4036, Perplexity: 81.74
Epoch [2/5], Step[900/1549], Loss: 4.1653, Perplexity: 64.41
Epoch [2/5], Step[1000/1549], Loss: 4.3449, Perplexity: 77.08
Epoch [2/5], Step[1100/1549], Loss: 4.4840, Perplexity: 88.59
Epoch [2/5], Step[1200/1549], Loss: 4.4659, Perplexity: 87.00
Epoch [2/5], Step[1300/1549], Loss: 4.1735, Perplexity: 64.94
Epoch [2/5], Step[1400/1549], Loss: 3.9952, Perplexity: 54.34
Epoch [2/5], Step[1500/1549], Loss: 4.2860, Perplexity: 72.67
Epoch [3/5], Step[0/1549], Loss: 4.4764, Perplexity: 87.91
Epoch [3/5], Step[100/1549], Loss: 3.8185, Perplexity: 45.54
Epoch [3/5], Step[200/1549], Loss: 4.0630, Perplexity: 58.15
Epoch [3/5], Step[300/1549], Loss: 3.8839, Perplexity: 48.62
Epoch [3/5], Step[400/1549], Loss: 3.9263, Perplexity: 50.72
Epoch [3/5], Step[500/1549], Loss: 3.4153, Perplexity: 30.43
Epoch [3/5], Step[600/1549], Loss: 3.8813, Perplexity: 48.49
Epoch [3/5], Step[700/1549], Loss: 3.7443, Perplexity: 42.28
Epoch [3/5], Step[800/1549], Loss: 3.7594, Perplexity: 42.92
Epoch [3/5], Step[900/1549], Loss: 3.4794, Perplexity: 32.44
Epoch [3/5], Step[1000/1549], Loss: 3.6235, Perplexity: 37.47
Epoch [3/5], Step[1100/1549], Loss: 3.7085, Perplexity: 40.79
Epoch [3/5], Step[1200/1549], Loss: 3.8110, Perplexity: 45.20
Epoch [3/5], Step[1300/1549], Loss: 3.4499, Perplexity: 31.50
Epoch [3/5], Step[1400/1549], Loss: 3.2214, Perplexity: 25.06
Epoch [3/5], Step[1500/1549], Loss: 3.5429, Perplexity: 34.57
Epoch [4/5], Step[0/1549], Loss: 3.6315, Perplexity: 37.77
Epoch [4/5], Step[100/1549], Loss: 3.2487, Perplexity: 25.76
Epoch [4/5], Step[200/1549], Loss: 3.5140, Perplexity: 33.58
Epoch [4/5], Step[300/1549], Loss: 3.3193, Perplexity: 27.64
Epoch [4/5], Step[400/1549], Loss: 3.4360, Perplexity: 31.06
Epoch [4/5], Step[500/1549], Loss: 2.9549, Perplexity: 19.20
Epoch [4/5], Step[600/1549], Loss: 3.3490, Perplexity: 28.48
Epoch [4/5], Step[700/1549], Loss: 3.3122, Perplexity: 27.45
Epoch [4/5], Step[800/1549], Loss: 3.2668, Perplexity: 26.23
Epoch [4/5], Step[900/1549], Loss: 2.9631, Perplexity: 19.36
Epoch [4/5], Step[1000/1549], Loss: 3.1250, Perplexity: 22.76
Epoch [4/5], Step[1100/1549], Loss: 3.2380, Perplexity: 25.48
Epoch [4/5], Step[1200/1549], Loss: 3.2806, Perplexity: 26.59
Epoch [4/5], Step[1300/1549], Loss: 2.9988, Perplexity: 20.06
Epoch [4/5], Step[1400/1549], Loss: 2.7011, Perplexity: 14.90
Epoch [4/5], Step[1500/1549], Loss: 3.1112, Perplexity: 22.45
Epoch [5/5], Step[0/1549], Loss: 3.0950, Perplexity: 22.09
Epoch [5/5], Step[100/1549], Loss: 2.8688, Perplexity: 17.62
Epoch [5/5], Step[200/1549], Loss: 3.1285, Perplexity: 22.84
Epoch [5/5], Step[300/1549], Loss: 2.9598, Perplexity: 19.29
Epoch [5/5], Step[400/1549], Loss: 3.1288, Perplexity: 22.85
Epoch [5/5], Step[500/1549], Loss: 2.6090, Perplexity: 13.58
Epoch [5/5], Step[600/1549], Loss: 3.0915, Perplexity: 22.01
Epoch [5/5], Step[700/1549], Loss: 2.9536, Perplexity: 19.18
Epoch [5/5], Step[800/1549], Loss: 2.9605, Perplexity: 19.31
Epoch [5/5], Step[900/1549], Loss: 2.6687, Perplexity: 14.42
Epoch [5/5], Step[1000/1549], Loss: 2.8161, Perplexity: 16.71
Epoch [5/5], Step[1100/1549], Loss: 2.9194, Perplexity: 18.53
Epoch [5/5], Step[1200/1549], Loss: 3.0538, Perplexity: 21.20
Epoch [5/5], Step[1300/1549], Loss: 2.6999, Perplexity: 14.88
Epoch [5/5], Step[1400/1549], Loss: 2.4688, Perplexity: 11.81
Epoch [5/5], Step[1500/1549], Loss: 2.7906, Perplexity: 16.29
Sampled [100/1000] words and save to sample.txt
Sampled [200/1000] words and save to sample.txt
Sampled [300/1000] words and save to sample.txt
Sampled [400/1000] words and save to sample.txt
Sampled [500/1000] words and save to sample.txt
Sampled [600/1000] words and save to sample.txt
Sampled [700/1000] words and save to sample.txt
Sampled [800/1000] words and save to sample.txt
Sampled [900/1000] words and save to sample.txt
Sampled [1000/1000] words and save to sample.txt

截取的sample.txt的部分内容如下,基本上语言表述是可以的,但还是缺乏逻辑能力。只能通过增大语料库,并增加训练程度来提升。

N repeal according to takeover experts 
for the british and canada are insolvent interest to the cost of how the transactions will seek additional information on its u.k. business 
the banks badly previously concluded that americans should slash the impact of income returns by the agency but they warn that it should be known for many small <unk> 
if the central park world will be made only a german economy and the state industries which has <unk> to foreigners how the u.s. can then by how to pay political 's healthy benefit push for such tasks as thrifts often 
while the baltimore for managers are among the <unk> concerned the average families of the cause in the area will translate to the higher costs for beneficiaries days 
he favors a resignation of selling such matters openly that <unk> doubled made all penalties 
there 's no answers at that time the proper has missed it the dead force is <unk> out of control 
we call it and easy for rights to pay attention 
i think we owe japanese investment and obviously not even agree 
until then mr. bryant is a much higher degree and more important for the country 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

【PyTorch】语言模型/Language model 的相关文章

  • torchvision.transforms.Normalize 是如何操作的?

    我不明白如何标准化Pytorch works 我想将平均值设置为0和标准差1跨越张量中的所有列x形状的 2 2 3 一个简单的例子 gt gt gt x torch tensor 1 2 3 4 5 6 7 8 9 10 11 12 gt
  • 为什么 RNN 需要两个偏置向量?

    In Pytorch RNN 实现 http pytorch org docs master nn html highlight rnn torch nn RNN 有两个偏差 b ih and b hh 为什么是这样 它与使用一种偏差有什么
  • 尝试理解 Pytorch 的 LSTM 实现

    我有一个包含 1000 个示例的数据集 其中每个示例都有5特征 a b c d e 我想喂7LSTM 的示例 以便它预测第 8 天的特征 a 阅读 nn LSTM 的 Pytorchs 文档 我得出以下结论 input size 5 hid
  • PyTorch 中复数矩阵的行列式

    有没有办法在 PyTorch 中计算复矩阵的行列式 torch det未针对 ComplexFloat 实现 不幸的是 目前尚未实施 一种方法是实现您自己的版本或简单地使用np linalg det 这是一个简短的函数 它计算我使用 LU
  • pytorch 中的 keras.layers.Masking 相当于什么?

    我有时间序列序列 我需要通过将零填充到矩阵中并在 keras 中使用 keras layers Masking 来将序列的长度固定为一个数字 我可以忽略这些填充的零以进行进一步的计算 我想知道它怎么可能在 Pytorch 中完成 要么我需要
  • pytorch 中的 autograd 可以处理同一模块中层的重复使用吗?

    我有一层layer in an nn Module并在一次中使用两次或多次forward步 这个的输出layer稍后输入到相同的layer pytorch可以吗autograd正确计算该层权重的梯度 def forward x x self
  • 如何更新 PyTorch 中神经网络的参数?

    假设我想将神经网络的所有参数相乘PyTorch 继承自的类的实例torch nn Module http pytorch org docs master nn html torch nn Module by 0 9 我该怎么做呢 Let n
  • 如何计算 CNN 第一个线性层的维度

    目前 我正在使用 CNN 其中附加了一个完全连接的层 并且我正在使用尺寸为 32x32 的 3 通道图像 我想知道是否有一个一致的公式可以用来计算第一个线性层的输入尺寸和最后一个卷积 最大池层的输入 我希望能够计算第一个线性层的尺寸 仅给出
  • Pytorch“展开”等价于 Tensorflow [重复]

    这个问题在这里已经有答案了 假设我有大小为 50 50 的灰度图像 在本例中批量大小为 2 并且我使用 Pytorch Unfold 函数 如下所示 import numpy as np from torch import nn from
  • 如何从已安装的云端硬盘文件夹中永久删除?

    我编写了一个脚本 在每次迭代后将我的模型和训练示例上传到 Google Drive 以防发生崩溃或任何阻止笔记本运行的情况 如下所示 drive path drive My Drive Colab Notebooks models if p
  • PyTorch 中的交叉熵

    交叉熵公式 但为什么下面给出loss 0 7437代替loss 0 since 1 log 1 0 import torch import torch nn as nn from torch autograd import Variable
  • Fine-Tuning DistilBertForSequenceClassification:不是学习,为什么loss没有变化?权重没有更新?

    我对 PyTorch 和 Huggingface transformers 比较陌生 并对此尝试了 DistillBertForSequenceClassificationKaggle 数据集 https www kaggle com c
  • PyTorch LSTM 中的“隐藏”和“输出”有什么区别?

    我无法理解 PyTorch 的 LSTM 模块 以及类似的 RNN 和 GRU 的文档 关于输出 它说 输出 输出 h n c n 输出 seq len batch hidden size num directions 包含RNN最后一层的
  • Pytorch .to('cuda') 或 .cuda() 不起作用并且卡住了

    我正在尝试做 pytorch 教程 当我尝试将他们的设备设置为 cuda 时 它不起作用并且我的代码运行被卡住 有关具体信息 我正在使用 conda 环境 蟒蛇3 7 3 火炬1 3 0 cuda 10 2 NVIDIA RTX2080TI
  • 无法在 Windows 10 上构建 Detectron2

    尽管 Windows 上的 Detectron2 没有官方支持 但有很多可用的说明 我尝试按照这些说明进行操作 但最终出现了相同的错误 这是我的设置 OS Windows 10 专业版 19043 1466 微软视觉工作室 2019 CUD
  • 如何让火车装载机使用特定数量的图像?

    假设我正在使用以下调用 trainset torchvision datasets ImageFolder root imgs transform transform trainloader torch utils data DataLoa
  • 如何在pytorch中动态索引张量?

    例如 我有一个张量 tensor torch rand 12 512 768 我得到了一个索引列表 说它是 0 2 3 400 5 32 7 8 321 107 100 511 我希望从给定索引列表的维度 2 上的 512 个元素中选择 1
  • PyTorch 中的数据增强

    我对 PyTorch 中执行的数据增强有点困惑 现在 据我所知 当我们执行数据增强时 我们保留原始数据集 然后添加它的其他版本 翻转 裁剪 等 但 PyTorch 中似乎并没有发生这种情况 据我从参考文献中了解到 当我们使用data tra
  • 将 Pytorch 模型 .pth 转换为 onnx 模型

    我有一个预训练的模型 其格式为 pth 扩展名 我想将其转换为 Tensorflow protobuf 但我没有找到任何方法来做到这一点 我见过 onnx 可以将模型从 pytorch 转换为 onnx 然后从 onnx 转换为 Tenso
  • PyTorch 中的后向函数

    我对 pytorch 的后向功能有一些疑问 我认为我没有得到正确的输出 import numpy as np import torch from torch autograd import Variable a Variable torch

随机推荐

  • 24个笔画顺序表_语文老师整理:560个小学常用汉字笔画笔顺表!小学阶段多练习...

    今天给大家分享的是资深语文老师整理的学习资料 560个小学常用汉字笔画笔顺表 家里有小学生的家长 建议帮孩子存好 小学阶段多练习 不仅对语文学习的提高有帮助 还能培养孩子的语文素养 在小学语文的学习中 汉字是最基础的知识点 孩子在学习语文的
  • Codeforces Round #561 (Div. 2)ABC

    三个题 各位大佬别喷我 我很菜 A Silent Classroom There are n students in the first grade of Nlogonia high school The principal wishes
  • 【03】上下文

    基于智能 合约的安全企业对消费者供应链系统在农产品供应链中使用区块链和智能 合约进行追溯链上 链下 智能 合约的可扩展和隐私保护设计TinyEVM 低功耗物联网设备上的链下 智能 合约区块链技术中的智能 合约和用例概述Blockumulus
  • Java的8种基本数据类型

    博主前些天发现了一个巨牛的人工智能学习网站 通俗易懂 风趣幽默 忍不住也分享一下给大家 点击跳转到网站 前言 Java数据类型分为两大类 基本数据类型 引用类型 如图所示 下面讲解的是Java的八种基本数据类型 一 按照数据类型来分 1 整
  • 西门子变频器SINAMICS S120电源模块分享

    西门子变频器SINAMICS S120系列 在工业领域中能胜任各种要求严格的驱动控制任务 为用户提供简单有效的驱动控制过程 西门子变频器SINAMICS S120系列可以配置电源模块 来为西门子变频器驱动控制系统提供稳定的电源保障 本文下面
  • 设计模式-模板方法

    文章目录 前言 模板方法模式简介 Java代码示例 模板方法使用场景 模板方法使用场景 前言 当我们需要在一个算法的框架中定义算法的骨架 并将一些步骤的具体实现留给子类来完成时 模板方法模式是一种非常有用的设计模式 这篇博客将介绍模板方法模
  • install.packages(“hgu133a.db“)报错——解决办法

    问题描述 install packages hgu133a db WARNING Rtools is required to build R packages but is not currently installed Please do
  • Sqli-Labs Less1-16关详细讲解

    Sqli Labs Less1 16关详细讲解 一 首先介绍一下这个重要的数据库 information schema数据库 二 Sqli Labs靶场 Get传输方式 Less 1 Union Select注入 闭合符 Less 5 报错
  • freertos中空闲任务函数prvIdleTask()详解

    The Idle task 空闲任务函数 The portTASK FUNCTION macro is used to allow port compiler specific language extensions The equival
  • Verilog开源项目——百兆以太网交换机(一)架构设计与Feature定义

    Verilog开源项目 百兆以太网交换机 一 架构设计与Feature定义 声明 未经作者允许 禁止转载 博主主页 王 嘻嘻的CSDN主页 全新原创以太网交换机项目 Blog内容将聚焦整体架构 模块设计方面 更新周期可能会略慢 希望朋友们多
  • 树状数组详解

    Markdown版本 请点击这个链接 树状数组 Markdown版本 xiji333的博客 CSDN博客 什么是树状数组 树状数组 Binary Indexed Tree B I T Fenwick Tree 是一个查询和修改复杂度都为lo
  • Android中当数据库需要更新时我们该怎么办?

    问题 Android数据库更新并保留原来的数据如何实现 Andoird的SQLiteOpenHelper类中有一个onUpgrade方法 帮助文档中只是说当数据库升级时该方法被触发 经过实践 解决了我一连串的 疑问 1 帮助文档里说的 数据
  • Linux系统shell脚本之批量修改服务器密码

    Linux系统shell脚本之批量修改服务器密码 一 脚本要求 二 脚本内容 三 编辑原始旧密码 四 执行脚本 五 验证密码更改 1 查看更改后的密码文件 2 在远端服务器验证密码 一 脚本要求 可以批量修改服务器的密码 二 脚本内容 bi
  • 【机器学习】机器学习回归模型的最全总结!

    导读 大家好 我是泳鱼 一个乐于探索和分享AI知识的码农 回归分析为许多机器学习算法提供了坚实的基础 在这篇文章中 我们将介绍回归分析概念 7种重要的回归模型 10 个重要的回归问题和5个评价指标 什么是回归分析 回归分析是一种预测性的建模
  • Linux系统与管理 - (六)用户与组❤

    自说 学习路径 用户管理 用户管理命令 组管理 组管理命令 目录和文件的权限 自说 在Windos系统中 用户的概念我们并不陌生 它是一种身份也是一种权限 不同的用户也相应有着不同的使用 下面细说下Linux中的用户与组 学习路径 Linu
  • windows上nacos自启动的三种方法

    前提 windows上先安装nacos 备注 方法一 二都是以 windows服务 形式进行自启动 效果类似于mysql的windows服务 但这种方法nacos服务可能会启动失败 不想浪费时间的博主建议直接跳转方法三 跟nacos自启动死
  • 初级java工程师笔试题

    最近面试很头疼 因为满以为自己工作了1年多了 实际coding经验却压缩到不到1年 每每被面试官 痛扁 心里特别不痛快 总以为我能给你交活不就完了吗有必要在基础上为难我吗 相信大多数不会总结 在面试中屡屡受挫的小伙伴你也是差不多的吧 因为没
  • 邮AI——AI陪你“邮”笑邮语!

    亲爱的小伙伴们 你是否有过写邮件的时候 脑袋一片空白 就像忘记刷牙一样让人尴尬 别担心 因为有一个 邮 到了幽默智能的解决方案 邮AI 它不仅能帮你写邮件 还能陪你 邮 笑邮语 邮AI 顶级AI大脑 不只是靠模板搞笑 它是真正的幽默高手 从
  • Altium Designer借助嘉立创添加PCB封装和3D模型

    目录 引言 打开立创专业版EDA 建立项目 从立创商城找到器件编码 添加PCB封装 导出和修改3D封装 引言 由于使用Altium Designer的频率并不是特别高 所以每一次使用总是得东跌西撞的才回忆起一些使用步骤 因此 想在这里记录一
  • 【PyTorch】语言模型/Language model

    1 模型描述 1 语言模型的定义 来自于维基百科 统计式的语言模型是一个几率分布 语言模型提供上下文来区分听起来相似的单词和短语 例如 短语 再给我两份葱 让我把记忆煎成饼 和 再给我两分钟 让我把记忆结成冰 听起来相似 但意思不同 语言模