增强大型语言模型(LLM)可访问性:深入探究在单块AMD GPU上通过QLoRA微调Llama 2的过程

news2024/9/17 7:11:03

Enhancing LLM Accessibility: A Deep Dive into QLoRA Through Fine-tuning Llama 2 on a single AMD GPU — ROCm Blogs

基于之前的博客《使用LoRA微调Llama 2》的内容,我们深入研究了一种称为量化低秩调整(QLoRA)的参数高效微调(PEFT)方法。本次重点是利用QLoRA技术在单块AMD GPU上,使用ROCm微调Llama-2 7B模型。通过使用QLoRA,可以解决内存和计算能力限制方面的挑战。本次探索旨在展示如何利用QLoRA来增强对开源大型语言模型的可访问性。

QLoRA微调

QLoRA是一种结合了高精度计算技术和低精度存储方法的微调技术。这有助于在确保模型仍然高性能和精确的同时,保持模型大小的小巧。

QLoRA如何工作?

简而言之,QLoRA在不牺牲性能的前提下,优化了LLM微调的内存使用,与标准的16位模型微调形成了对比。具体来说,QLoRA采用4位量化压缩预训练语言模型。然后冻结语言模型参数,并引入少量的可训练参数,以低秩适配器(Low-Rank Adapters)的形式。在微调过程中,QLoRA通过冻结的4位量化预训练语言模型反向传播梯度到低秩适配器中。值得注意的是,在训练期间,只有LoRA层进行更新。要更深入了解LoRA,请参阅原始的LoRA论文。

QLoRA与LoRA的比较

QLoRA和LoRA都是两种参数高效的微调技术。LoRA作为一个独立的微调方法运作,而QLoRA则结合了LoRA作为一个辅助机制,以解决量化过程中引入的错误,并在微调期间进一步最小化资源需求。

一步步使用QLoRA对Llama 2进行微调

本节将指导您通过QLoRA一步步对具有70亿参数的Llama 2模型进行微调,该模型可以在单个AMD GPU上运行。实现这一成就的关键在于QLoRA的关键支持,它在有效减少内存需求方面发挥了不可或缺的作用。
为此,我们将使用以下设置:
- 硬件 & 操作系统:请访问此链接,查看与ROCm兼容的硬件和操作系统列表。
- 软件:
    - ROCm 6.1.0+
    - Pytorch for ROCm 2.0+
- 库:`transformers`、`accelerate`、`peft`、`trl`、`bitsandbytes`、`scipy`

在这篇博客中,我们使用单个MI250GPU以及Docker镜像rocm/pytorch:rocm6.1_ubuntu20.04_py3.9_pytorch_2.1.2进行了实验。

您可以在Github仓库中找到这篇博客中使用的完整代码。

1. 开始

我们的第一步是确认GPU的可用性。

!rocm-smi --showproductname
    ========================= ROCm System Management Interface ========================= 
    =================================== Product Info ===================================
    GPU[0]      : 系列:      AMD INSTINCT MI250 (MCM) OAM AC MBA
    GPU[0]      : 型号:       0x0b0c
    GPU[0]      : 制造商:      Advanced Micro Devices, Inc. [AMD/ATI]
    GPU[0]      : SKU:         D65209
    GPU[1]      : 系列:      AMD INSTINCT MI250 (MCM) OAM AC MBA
    GPU[1]      : 型号:       0x0b0c
    GPU[1]      : 制造商:      Advanced Micro Devices, Inc. [AMD/ATI]
    GPU[1]      : SKU:         D65207
    ====================================================================================
    =============================== End of ROCm SMI Log ===============================

如果您的AMD机器上有不止一个GCDs或GPUs,让我们只使用一个图形计算模块(GCD)或GPU。

import os
os.environ["HIP_VISIBLE_DEVICES"]="0"

import torch
use_cuda = torch.cuda.is_available()
if use_cuda:
    print('__CUDNN VERSION:', torch.backends.cudnn.version())
    print('__Number CUDA Devices:', torch.cuda.device_count())
    cunt = torch.cuda.device_count()
    __CUDNN VERSION: 2020000
    __Number CUDA Devices: 1

接下来我们将安装所需的库。

!pip install -q pandas peft==0.9.0 transformers==4.31.0 trl==0.4.7 accelerate scipy
安装bitsandbytes

ROCm需要特殊版本的bitsandbytes(bitsandbytes-rocm).

1. 使用以下代码安装bitsandbytes。
 

git clone --recurse https://github.com/ROCm/bitsandbytes
cd bitsandbytes
git checkout rocm_enabled
pip install -r requirements-dev.txt
cmake -DCOMPUTE_BACKEND=hip -S . #Use -DBNB_ROCM_ARCH="gfx90a;gfx942" to target specific gpu arch
make
pip install .

2. 检查bitsandbytes版本。

在撰写本博客时,版本为0.43.0。

%%bash
pip list | grep bitsandbytes

3. 引入所需的包。

import torch
from datasets import load_dataset
from transformers import (
    AutoModelForCausalLM,
    AutoTokenizer,
    BitsAndBytesConfig,
    TrainingArguments,
    pipeline
)
from peft import LoraConfig
from trl import SFTTrainer

2. 配置模型和数据

模型配置

在Hugging Face提交请求并等待几天后,您可以访问Meta的官方Llama-2模型。作为替代,我们将使用NousResearch的Llama-2-7b-chat-hf作为我们的基础模型(它与原始模型相同,但更易于访问)。

# 模型和分词器名称
base_model_name = "NousResearch/Llama-2-7b-chat-hf"
new_model_name = "llama-2-7b-enhanced" #您可以为微调后的模型起自己的名字

# 分词器
llama_tokenizer = AutoTokenizer.from_pretrained(base_model_name, trust_remote_code=True)
llama_tokenizer.pad_token = llama_tokenizer.eos_token
llama_tokenizer.padding_side = "right"  
QLoRA 4-bit量化配置

正如论文所述,QLoRA以4位存储权重,允许在16位或32位精度下进行计算。这意呞着每当使用QLoRA权重张量时,我们就将张量去量化到16位或32位精度,然后执行矩阵乘法。可以选择各种组合,例如float16、bfloat16、float32等。可以尝试不同的4位量化变种,包括规范化浮点4(NF4)或纯浮点4量化。然而,根据论文中的理论考量和经验结果,建议选择NF4量化,因为它往往能提供更好的性能。
在我们的案例中,我们选择了以下配置:
- 使用NF4类型的4位量化
- 16位(float16)进行计算
- 双重量化,这在第一次量化后使用第二次量化,可以额外节省每个参数0.3位
量化参数可以通过BitsandbytesConfig控制(参见Hugging Face文档:https://huggingface.co/docs/transformers/main_classes/quantization#transformers.BitsAndBytesConfig)如下:
- 通过load_in_4bit激活4位加载
- 用bnb_4bit_quant_type指定用于量化的数据类型。注意,支持两种量化数据类型:fp4(四位浮点数)和nf4(规范化四位浮点数)。后者对于正态分布的权重理论上是最优的,因此我们推荐使用nf4。
- 用bnb_4bit_compute_dtype指定用于线性层计算的数据类型
- 通过bnb_4bit_use_double_quant激活嵌套量化

# 量化配置
quant_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16,
    bnb_4bit_use_double_quant=True
)

加载模型并设置量化配置。

base_model = AutoModelForCausalLM.from_pretrained(
    base_model_name,
    quantization_config=quant_config,
    device_map="auto"
)
base_model.config.use_cache = False
base_model.config.pretraining_tp = 1
数据集配置

我们使用一个名为mlabonne/guanaco-llama2-1k的小型数据集对我们的基础模型进行了微调,以进行问答任务。这个数据集是timdettmers/openassistant-guanaco数据集的一个子集(1000个样本)。该数据集是一个由人类生成、人类标注的助理风格对话语料库,它包含35种不同语言的161443条消息,带有461292个质量评分。这导致超过10000棵完全标注的对话树。

# Dataset
data_name = "mlabonne/guanaco-llama2-1k"
training_data = load_dataset(data_name, split="train")
# check the data
print(training_data.shape)
# #11 is a QA sample in English
print(training_data[11])
    (1000, 1)
    {'text': '<s>[INST] write me a 1000 words essay about deez nuts. [/INST] The Deez Nuts meme first gained popularity in 2015 on the social media platform Vine. The video featured a young man named Rodney Bullard, who recorded himself asking people if they had heard of a particular rapper. When they responded that they had not, he would respond with the phrase "Deez Nuts" and film their reactions. The video quickly went viral, and the phrase became a popular meme. \n\nSince then, Deez Nuts has been used in a variety of contexts to interrupt conversations, derail discussions, or simply add humor to a situation. It has been used in internet memes, in popular music, and even in politics. In the 2016 US presidential election, a 15-year-old boy named Brady Olson registered as an independent candidate under the name Deez Nuts. He gained some traction in the polls and even made appearances on national news programs.\n\nThe Deez Nuts meme has had a significant impact on popular culture. It has become a recognizable catchphrase that people use to add humor to everyday conversations. The meme has also been used to satirize politics and other serious issues. For example, in 2016, a group of activists in the UK used the phrase "Deez Nuts for President" as part of a campaign to encourage young people to vote in the EU referendum. </s><s>[INST] Rewrite the essay in a more casual way. Instead of sounding proffesional, sound like a college student who is forced to write the essay but refuses to do so in the propper way. Use casual words and slang when possible. [/INST] Yo, so you want me to write a 1000-word essay about Deez Nuts? Alright, fine. So, this whole thing started on Vine back in 2015. Some dude named Rodney Bullard made a video where he would ask people if they knew a rapper, and when they said no, he would hit them with the classic line: "Deez Nuts!" People loved it, and it became a viral meme.\n\nNowadays, Deez Nuts is used for all kinds of stuff. You can throw it out there to interrupt someone or just to be funny. It\'s all over the internet, in music, and even in politics. In fact, during the 2016 US presidential election, a kid named Brady Olson registered as an independent candidate under the name Deez Nuts. He actually got some attention from the media and made appearances on TV and everything.\n\nThe impact of Deez Nuts on our culture is pretty huge. It\'s become a thing that everyone knows and uses to add some humor to their everyday conversations. Plus, people have used it to make fun of politics and serious issues too. Like, in the UK, some groups of activists used the phrase "Deez Nuts for President" to encourage young people to vote in the EU referendum.\n\nThere you have it, a thousand words about Deez Nuts in a more casual tone. Can I go back to playing video games now? </s>'}
## There is a dependency during training
!pip install tensorboardX

3. 开始微调

使用以下代码设置训练参数:

# 训练参数
train_params = TrainingArguments(
    output_dir="./results_modified",
    num_train_epochs=1,
    per_device_train_batch_size=4,
    gradient_accumulation_steps=1,
    optim="paged_adamw_32bit",
    save_steps=50,
    logging_steps=50,
    learning_rate=2e-4,
    weight_decay=0.001,
    fp16=False,
    bf16=False,
    max_grad_norm=0.3,
    max_steps=-1,
    warmup_ratio=0.03,
    group_by_length=True,
    lr_scheduler_type="constant",
    report_to="tensorboard"
)
使用QLoRA配置训练

现在您可以将LoRA集成到基准模型中,并评估其附加参数。LoRA实质上是向现有权重中添加了一对秩分解权重矩阵(称为更新矩阵),并且只训练新增加的权重。

from peft import get_peft_model
# LoRA配置
peft_parameters = LoraConfig(
    lora_alpha=8,
    lora_dropout=0.1,
    r=8,
    bias="none",
    task_type="CAUSAL_LM"
)
model = get_peft_model(base_model, peft_parameters)
model.print_trainable_parameters()
    trainable params: 4,194,304 || all params: 6,742,609,920 || trainable%: 0.06220594176090199

注意LoRA只增加了0.062%的参数,这只是原始模型的一小部分。我们将通过微调更新这一百分比的参数,如下所示。

# 带有QLoRA配置的Trainer
fine_tuning = SFTTrainer(
    model=base_model,
    train_dataset=training_data,
    peft_config=peft_parameters,
    dataset_text_field="text",
    tokenizer=llama_tokenizer,
    args=train_params
)

# 训练
fine_tuning.train()

输出看起来像这样:

[250/250 05:31, Epoch 1/1]\
Step     Training Loss \
50       1.557800 \
100      1.348100\
150      1.277000\
200      1.324300\
250      1.347700

TrainOutput(global_step=250, training_loss=1.3709784088134767, metrics={'train_runtime': 335.085, 'train_samples_per_second': 2.984, 'train_steps_per_second': 0.746, 'total_flos': 8679674339426304.0, 'train_loss': 1.3709784088134767, 'epoch': 1.0})
使用QLoRA训练期间检查内存使用

在训练期间,您可以在终端使用“rocm-smi”命令来检查内存使用情况。该命令将产生以下输出,它告诉了内存和GPU的使用情况。

========================= ROCm System Management Interface =========================
=================================== Concise Info ===================================
GPU  Temp (DieEdge)  AvgPwr  SCLK     MCLK     Fan  Perf  PwrCap  VRAM%  GPU%  
0    50.0c           352.0W  1700Mhz  1600Mhz  0%   auto  560.0W   17%   100%  
====================================================================================
=============================== End of ROCm SMI Log ================================

为了更全面地理解QLoRA对训练的影响,我们将进行量化分析,比较QLoRA、LoRA和完整参数微调。这项分析将包括内存使用、训练速度、训练损失和其他相关指标,提供它们各自影响的全面评估。

4. QLoRA、LoRA和全参数微调的比较

我们将在前一篇有关如何使用LoRA微调Llama 2模型的博客文章的基础上——该文章展示了用LoRA和全参数方法微调Llama 2模型——增加QLoRA的结果。这旨在提供一个全面概述,结合了使用这三种微调方法所获得的见解。

Metric

Full-parameter

LoRA

QLoRA

Trainable parameters

6,738,415,616

4,194,304

4,194,304

Mem usage/GB

128

83.2

10.88

Number of GCDs

2

2

1

Training Speed

3 hours

9 minutes

6 minutes

Training Loss

1.368

1.377

1.347

• 内存使用量:
    ◦ 在全参数微调的情况下,有 6,738,415,616 个可训练参数,导致在训练反向传播阶段期间内存消耗显著。
    ◦ 相比之下,LoRA和QLoRA只引入了 4,194,304 个可训练参数,仅占全参数微调中总可训练参数的 *0.062%*。
    ◦ 当监控训练期间的内存使用时,很明显,使用LoRA进行微调仅使用了全参数微调内存使用量的65%。而QLoRA的表现更为出色,将内存消耗大幅降低到只有8%。
    ◦ 这为在有限的硬件资源限制下增加批量大小、最大序列长度和在更大的数据集上进行训练提供了机会。
• 训练速度:
    ◦ 结果表明,全参数微调需要 几小时 才能完成,而LoRA和QLoRA的微调仅需 *几分钟*。
    ◦ 训练速度加快的几个因素包括:
        ▪ LoRA中更少的可训练参数意味着更少的导数计算以及更少的存储和更新权重所需的内存。

        ▪ 全参数微调更容易受到内存限制的制约,在数据移动成为训练瓶颈时。这反映在更低的GPU利用率上。虽然调整训练设置可以缓解这一点,但可能需要更多的资源(额外的GPU)和更小的批量大小。
• 准确度:
    ◦ 在两次训练会话中,都观察到了训练损失的显著降低。我们对于三种微调方法都达到了相差无几的训练损失。
    ◦ 在QLoRA的原始研究中,作者提到了由于量化不精确而导致的性能损失,可以通过量化后的适配器微调完全恢复。与这个见解一致,我们的实验验证并呼应了这一观察,强调了在量化过程后恢复性能的适配器微调的有效性。 

5. 使用QLoRA微调后的模型进行测试

# 以FP16重新加载模型,并与微调后的权重合并
base_model = AutoModelForCausalLM.from_pretrained(
    base_model_name,
    low_cpu_mem_usage=True,
    return_dict=True,
    torch_dtype=torch.float16,
    device_map="auto"
)
from peft import LoraConfig, PeftModel
model = PeftModel.from_pretrained(base_model, new_model_name)
model = model.merge_and_unload()

# 重新加载分词器以便保存
tokenizer = AutoTokenizer.from_pretrained(base_model_name, trust_remote_code=True)
tokenizer.pad_token = tokenizer.eos_token
tokenizer.padding_side = "right"

现在,让我们上传模型到Hugging Face,这样我们就可以进行后续测试或与他人分享。要进行此步骤,您需要一个有效的Hugging Face账户。

现在我们可以使用基础模型(原始的)和微调后的模型进行测试。

测试基础模型
# Generate Text using base model
query = "What do you think is the most important part of building an AI chatbot?"
text_gen = pipeline(task="text-generation", model=base_model_name, tokenizer=llama_tokenizer, max_length=200)
output = text_gen(f"<s>[INST] {query} [/INST]")
print(output[0]['generated_text'])
测试微调后的模型
# Generate Text using fine-tuned model
query = "What do you think is the most important part of building an AI chatbot?"
text_gen = pipeline(task="text-generation", model=new_model_name, tokenizer=llama_tokenizer, max_length=200)
output = text_gen(f"<s>[INST] {query} [/INST]")
print(output[0]['generated_text'])
    <s>[INST] What do you think is the most important part of building an AI chatbot? [/INST] The most important part of building an AI chatbot is to ensure that it is able to understand and respond to user input in a way that is both accurate and natural-sounding.
    
    To achieve this, you will need to use a combination of natural language processing (NLP) techniques and machine learning algorithms to enable the chatbot to understand and interpret user input, and to generate appropriate responses.
    
    Some of the key considerations when building an AI chatbot include:
    
    1. Defining the scope and purpose of the chatbot: What kind of tasks or questions will the chatbot be able to handle? What kind of user input will it be able to understand?
    2. Choosing the right NLP and machine learning algorithms: There are many different NLP and machine learning algorithms available, and the right ones will depend on the

现在您可以根据给定的查询观察两个模型的输出。正如预期的那样,由于微调过程改变了模型的权重,两个输出显示了微小的差异。

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

非常好用的7个Vue3组件库!!【送源码】

说到Vue&#xff0c;怎能不提Vue3呢&#xff1f; 它的大名鼎鼎主要归功于一项革命性的创新——Composition API。 这个新功能为逻辑复用带来了前所未有的友好性和灵活性&#xff0c;让开发者们在构建应用时如鱼得水。 如果你现在正在使用Vue3&#xff0c;或者在新的一年考虑…

reflutter工具实践之--xx一番赏app

此文章已经录制b站视频&#xff1a; flutter逆向案例-某某一番赏_哔哩哔哩_bilibili 一、工具介绍--reFlutter 这个框架帮助 Flutter 应用逆向工程&#xff0c;使用 Flutter 库的补丁版本&#xff0c;该版本已经编译并准备好重新打包应用。此库修改了快照反序列化过程&#…

SpringCloudNetflix组件整合

SpringCloudNetflix组件整合 Eureka注册中心 Eureka是什么 Eureka是netflix的一个子模块&#xff0c;也是核心模块之一&#xff0c;Eureka是一个基于REST的服务&#xff0c;用于定位服务&#xff0c;以实现云端中间层服务发现和故障转移。服务注册与发现对于微服务架构来说是…

“Dream Machine“震撼登场!免费推出的AI电影级巨制在网络上引爆热潮

"巅峰初现&#xff01;视频AI新星‘梦幻制造者’华美登场&#xff01; 在视频生成技术的赛道上&#xff0c;Luma AI昨日骄傲地揭开了其旗舰创新——梦幻制造者&#xff08;Dream Machine&#xff09;的神秘面纱&#xff0c;凭借无与伦比的文本到视频及图像到视频转换技术…

Cyber Weekly #11

赛博新闻 1、苹果召开2024年WWDC开发者大会 本周二&#xff08;6月11日&#xff09;凌晨1点&#xff0c;苹果召开2024年全球开发者大会&#xff0c;宣布与OpenAl合作&#xff0c;在iOS18、iPadOS18和macOS Sequoia中全面支持GPT-4o。用户在询问Siri问题时&#xff0c;Siri可以…

Oracle 入门--前提

目录 1.sqlplus 2.dual是什么&#xff1f; 3.SQL语句的种类 4.Oracle是如何工作的 5.Oracle查看配置文件 6.修改配置文件 7.常用的参数设置 1.sqlplus 管理数据库&#xff1a;启动&#xff0c;关闭&#xff0c;创建&#xff0c;删除对象......查看数据库的运行状态&…

01 - matlab m_map地学绘图工具基础函数理解(一)

01 - matlab m_map地学绘图工具基础函数理解&#xff08;一&#xff09; 0. 引言1. m_demo2. 小结 0. 引言 上篇介绍了m_map的配置过程&#xff0c;本篇开始介绍下m_map中涉及到的所有可调用函数。如果配置的没有问题&#xff0c;执行">>help m_map"可以看到类…

戴尔第十一代十二代十三代处理器重装系统找不到驱动程序

一、戴尔第十一代十二代十三代处理器重装系统找不到驱动程序 VMD&#xff08;Volume Management Device&#xff09;是针对下一代存储推出的部署方案。这套方案支持从 PCIe 总线对 NVMe 固态盘进行热升级和更换&#xff0c;而无需关闭系统&#xff0c;同时标准化 LED 管理可帮助…

云计算【第一阶段(14)】Linux的目录和结构

一、Liunx目录结构 1.1、linux目录结构 linux目录结构是树形目录结构 根目录&#xff08;树根&#xff09; 所有分区&#xff0c;目录&#xff0c;文件等的位置起点整个树形目录结构中&#xff0c;使用独立的一个"/",表示 1.2、常见的子目录 必须知道 目录路径目…

UniRx 入门

Reactive X 是 Reactive Extensions 的缩写&#xff0c;一般简写为 Rx&#xff0c;最初是 LINQ 的一个扩展&#xff0c;由微软的团队开发&#xff0c;Rx 是一个编程模型&#xff0c;目标是提供一致的编程接口&#xff0c;帮助开发者更方便的处理异步数据流&#xff0c;支持大部…

Apipost模拟HTTP客户端

模拟HTTP客户端的软件有很多&#xff0c;其中比较著名的就有API-FOX、POSTMAN。 相信很多小伙伴都使用POSTMAN。这篇博客主要介绍Apipost的原因是&#xff0c;Apipost无需下载&#xff0c;具有网页版。 APIFOX的站内下载&#xff1a; Api-Fox&#xff0c;类似于PostMan的软件…

关于HTTP劫持,该如何理解、防范和应对

一、引言 HTTP劫持&#xff08;HTTP Hijacking&#xff09;是一种网络安全威胁&#xff0c;它发生在HTTP通信过程中&#xff0c;攻击者试图通过拦截、篡改或监控用户与服务器之间的数据流量&#xff0c;以达到窃取敏感信息或执行恶意操作的目的。今天我们就来详细了解HTTP劫持…

嵌入式实训day5

1、 from machine import Pin import time # 定义按键引脚控制对象 key1 Pin(27,Pin.IN, Pin.PULL UP) key2 Pin(26,Pin.IN, Pin.PULL UP)led1 Pin(15,Pin.ouT, value0) led2 Pin(2,Pin.ouT, value0) led3 Pin(0,Pin.ouT, value0) # 定义key1按键中断处理函数 def key1 ir…

JavaFX 图像视图

JavaFX ImageView 控件可以在 JavaFX GUI 中显示图像。ImageView 控件必须添加到场景图中才能可见。JavaFX ImageView 控件由类表示 javafx.scene.image.ImageView。 创建一个 ImageView 通过创建类的实例来创建 ImageView 控件实例ImageView。类的构造函数ImageView需要一个…

【JKI SMO】框架讲解(二)

JKI State Machine 讲解 将JKI State Machine 模板拖曳到程序框图中&#xff0c; 如下图&#xff0c; 此模板会默认放置一个OK按钮在前面板中&#xff0c;用于提示用户如何增加一个简单的用户事件去使用此框架。 “Event Structure”&#xff0c;Idle&#xff1a;此分支可以设…

---异常---

我们在运行程序时总遇到各种与报错&#xff0c;数组越界&#xff0c;空指针的引用&#xff0c;这些在java中都称为异常 对于不同的错误都具有一个与他对应的异常类来秒描述 这是对于数组越界这个类里有的方法&#xff0c;这些是描述异常的 在java中有一个完整的描述异常的类的…

JavaFX 节点

JavaFX Node类javafx.scene.Node是添加到JavaFX 场景图的所有组件 的基类&#xff08;超类&#xff09; 。JavaFX Node 类是抽象的&#xff0c;因此你只需将 Node 类的子类添加到场景图中。场景图中的所有 JavaFX Node 实例共享一组由 JavaFX Node 类定义的公共属性。本 JavaFX…

运行vue3项目相关报错

1. VSCode打开TSVue3项目很多地方报错 报错内容 几乎所有文件都会出现未知飘红 error Delete CR prettier/prettier报错原因 插件冲突&#xff0c;Windows系统回车换行符与MAC不一致&#xff08;所以这个问题Windows系统才会出现&#xff09; 解决 需要安装Vue - Official…

掌握高等数学、线性代数、概率论所需数学知识及标题建议

在数学的广袤领域中&#xff0c;高等数学、线性代数和概率论作为三大核心分支&#xff0c;不仅在理论研究中占据重要地位&#xff0c;更在实际应用中发挥着举足轻重的作用。为了深入理解和掌握这三门学科&#xff0c;我们需要掌握一系列扎实的数学知识。 高等数学所需数学知识 …

vitepress搭建的博客系统cdn引入github discussions评论系统

github仓库必须是公开的。 按照CDN的方式引入 打开discussions模块 安装giscus app 配置giscus 就是刚安装了giscus app的仓库 页面往下走&#xff0c;生成了代码&#xff1a; 配置vitepress 采用了CDN的方式引入 使用web component 随便找个地方试试组件 效果 有了…