Skip to main content

MindPet微调算法用户文档

一、MindPet简介

MindPet(Pet:Parameter-Efficient Tuning)是属于Mindspore领域的微调算法套件。随着计算算力不断增加,大模型无限的潜力也被挖掘出来。但随之在应用和训练上带来了巨大的花销,导致商业落地困难。因此,出现一种新的参数高效(parameter-efficient)算法,与标准的全参数微调相比,这些算法仅需要微调小部分参数,可以大大降低计算和存储成本,同时可媲美全参微调的性能。

二、环境准备

2.1 环境依赖

  • Python 3.7至3.9版本
  • MindSpore >= 1.8

2.2 软件安装

在代码仓根目录下运行以下命令,会生成dist文件夹以及whl包:

python set_up.py bdist_wheel

执行以下命令安装whl包:

pip install dist/mindpet-1.0.4-py3-none-any.whl

2.3 软件卸载

通过以下命令进行卸载:

pip uninstall mindpet

三、微调算法API

目前MindPet已提供以下六种经典低参微调算法以及一种提升精度的微调算法的API接口,用户可快速适配原始大模型,提升下游任务微调性能和精度;

微调算法 算法论文 使用说明
LoRA LoRA: Low-Rank Adaptation of Large Language Models MindPet_DeltaAlgorithm_README 第一章
PrefixTuning Prefix-Tuning: Optimizing Continuous Prompts for Generation MindPet_DeltaAlgorithm_README 第二章
Adapter Parameter-Efficient Transfer Learning for NLP MindPet_DeltaAlgorithm_README 第三章
LowRankAdapter Compacter: Efficient low-rank hypercom plex adapter layers MindPet_DeltaAlgorithm_README 第四章
BitFit BitFit: Simple Parameter-efficient Fine-tuning for Transformer-based Masked Language-models MindPet_DeltaAlgorithm_README 第五章
R_Drop R-Drop: Regularized Dropout for Neural Networks MindPet_DeltaAlgorithm_README 第六章
P-Tuning v2 P-Tuning v2: Prompt Tuning Can Be Comparable to Fine-tuning Universally Across Scales and Tasks MindPet_DeltaAlgorithm_README 第七章

四、共性图操作API

4.1 冻结指定模块功能API

MindPet支持用户根据 微调算法 或 模块名 冻结网络中部分模块,提供调用接口和配置文件两种实现方式。

使用说明参考MindPet_GraphOperation_README 第一章。

4.2 保存可训练参数功能API

MindPet支持用户单独保存训练中可更新的参数为ckpt文件,从而节省存储所用的物理资源。

使用说明参考MindPet_GraphOperation_README 第二章。

Metadata

Release files for mindpet 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mindpet 1.0.4
File Size Uploaded
mindpet-1.0.4.tar.gz 60.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mindpet 1.0.4
File Interpreter ABI Platform
mindpet-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 144.2 kB

Release files / mindpet-1.0.4.tar.gz

Download URL mindpet-1.0.4.tar.gz
Size 60.3 kB
Tags Source
SHA-256 checksum
How to use checksums
626d34ba8e4adab213f91c905967e2b8341ca3cbd43a6a1f656f58e58e248256
BLAKE2b-256 checksum
How to use checksums
7914471d804f322e6b9c7090653e2b0a240cea94a86183296e35db1f516d59bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.1

Release files / mindpet-1.0.4-py3-none-any.whl

Download URL mindpet-1.0.4-py3-none-any.whl
Size 83.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b81f5039864f06f9118887f5051de090b4334913c0d8ff1dacecbead8f867e5
BLAKE2b-256 checksum
How to use checksums
057c3266e061b7dd74c17ce7556dde55456cedb9a931959998d2ff30c2bd4e51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.1

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

1 release file

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page