Skip to content

Commit c331589

Browse files
authored
back to mindnlp (#2320)
1 parent 21b84cb commit c331589

File tree

286 files changed

+2172
-540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+2172
-540
lines changed

.github/workflows/ci_pipeline.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ jobs:
4545
# run: |
4646
# python .github/install_mindspore.py
4747
# pip install -r download.txt
48-
- name: Analysing the mindhf code with pylint
48+
- name: Analysing the mindnlp code with pylint
4949
run: |
5050
NUM_CORES=$(nproc)
51-
pylint --jobs=$NUM_CORES src/mindhf src/mindnlp --rcfile=.github/pylint.conf
51+
pylint --jobs=$NUM_CORES src/mindnlp --rcfile=.github/pylint.conf
5252
5353
# ut-test:
5454
# needs: pylint-check

.github/workflows/make_wheel_releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Upload file
3030
uses: actions/upload-artifact@v4
3131
with:
32-
name: mindhf-whl
32+
name: mindnlp-whl
3333
path: dist/*
3434

3535
- name: Release and Upload Assets

README.md

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# <center> MindHF
1+
# <center> MindNLP
22

33
<p align="center">
4-
<a href="https://mindhf.cqu.ai/en/latest/">
4+
<a href="https://mindnlp.cqu.ai/en/latest/">
55
<img alt="docs" src="https://img.shields.io/badge/docs-latest-blue">
66
</a>
77
<a href="https://github.com/mindspore-lab/mindnlp/blob/master/LICENSE">
@@ -18,13 +18,11 @@
1818
</a>
1919
</p>
2020

21-
**MindHF** stands for **MindSpore + HuggingFace**, representing seamless compatibility with the HuggingFace ecosystem. The name also embodies **Harmonious & Fluid**, symbolizing our commitment to balancing compatibility with high performance. MindHF enables you to leverage the best of both worlds: the rich HuggingFace model ecosystem and MindSpore's powerful acceleration capabilities.
22-
23-
> **Note**: MindHF (formerly MindNLP) is the new name for this project. The `mindnlp` package name is still available for backward compatibility, but we recommend using `mindhf` going forward.
21+
**MindNLP** stands for **MindSpore + Natural Language Processing**, representing seamless compatibility with the HuggingFace ecosystem. MindNLP enables you to leverage the best of both worlds: the rich HuggingFace model ecosystem and MindSpore's powerful acceleration capabilities.
2422

2523
## Table of Contents
2624

27-
- [ MindHF](#-mindhf)
25+
- [ MindNLP](#-mindnlp)
2826
- [Table of Contents](#table-of-contents)
2927
- [Features ✨](#features-)
3028
- [Installation](#installation)
@@ -45,7 +43,7 @@
4543

4644
### 1. 🤗 Full HuggingFace Compatibility
4745

48-
MindHF provides seamless compatibility with the HuggingFace ecosystem, enabling you to run any Transformers/Diffusers models on MindSpore across all hardware platforms (GPU/Ascend/CPU) without code modifications.
46+
MindNLP provides seamless compatibility with the HuggingFace ecosystem, enabling you to run any Transformers/Diffusers models on MindSpore across all hardware platforms (GPU/Ascend/CPU) without code modifications.
4947

5048
#### Direct HuggingFace Library Usage
5149

@@ -55,7 +53,7 @@ You can directly use native HuggingFace libraries (transformers, diffusers, etc.
5553

5654
```python
5755
import mindspore
58-
import mindhf
56+
import mindnlp
5957
from transformers import pipeline
6058

6159
chat = [
@@ -72,19 +70,19 @@ print(response[0]["generated_text"][-1]["content"])
7270

7371
```python
7472
import mindspore
75-
import mindhf
73+
import mindnlp
7674
from diffusers import DiffusionPipeline
7775

7876
pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", ms_dtype=mindspore.float16, device_map='cuda')
7977
pipeline("An image of a squirrel in Picasso style").images[0]
8078
```
8179

82-
#### MindHF Native Interface
80+
#### MindNLP Native Interface
8381

84-
You can also use MindHF's native interface for better integration:
82+
You can also use MindNLP's native interface for better integration:
8583

8684
```python
87-
from mindhf.transformers import AutoTokenizer, AutoModel
85+
from mindnlp.transformers import AutoTokenizer, AutoModel
8886

8987
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
9088
model = AutoModel.from_pretrained("bert-base-uncased")
@@ -93,22 +91,22 @@ inputs = tokenizer("Hello world!", return_tensors='ms')
9391
outputs = model(**inputs)
9492
```
9593

96-
> **Note**: Due to differences in autograd and parallel execution mechanisms, any training or distributed execution code must utilize the interfaces provided by MindHF.
94+
> **Note**: Due to differences in autograd and parallel execution mechanisms, any training or distributed execution code must utilize the interfaces provided by MindNLP.
9795
9896
### 2. ⚡ High-Performance Features Powered by MindSpore
9997

100-
MindHF leverages MindSpore's powerful capabilities to deliver exceptional performance and unique features:
98+
MindNLP leverages MindSpore's powerful capabilities to deliver exceptional performance and unique features:
10199

102100
#### PyTorch-Compatible API with MindSpore Acceleration
103101

104-
MindHF provides `mindtorch` (accessible via `mindhf.core`) for PyTorch-compatible interfaces, enabling seamless migration from PyTorch code while benefiting from MindSpore's acceleration on Ascend hardware:
102+
MindNLP provides `mindtorch` (accessible via `mindnlp.core`) for PyTorch-compatible interfaces, enabling seamless migration from PyTorch code while benefiting from MindSpore's acceleration on Ascend hardware:
105103

106104
```python
107-
import mindhf # Automatically enables proxy for torch APIs
105+
import mindnlp # Automatically enables proxy for torch APIs
108106
import torch
109107
from torch import nn
110108

111-
# All torch.xx APIs are automatically mapped to mindhf.core.xx (via mindtorch)
109+
# All torch.xx APIs are automatically mapped to mindnlp.core.xx (via mindtorch)
112110
net = nn.Linear(10, 5)
113111
x = torch.randn(3, 10)
114112
out = net(x)
@@ -117,7 +115,7 @@ print(out.shape) # core.Size([3, 5])
117115

118116
#### Advanced Features Beyond Standard MindSpore
119117

120-
MindHF extends MindSpore with several advanced features for better model development:
118+
MindNLP extends MindSpore with several advanced features for better model development:
121119

122120
1. **Dispatch Mechanism**: Operators are automatically dispatched to the appropriate backend based on `Tensor.device`, enabling seamless multi-device execution.
123121
2. **Meta Device Support**: Perform shape inference and memory planning without actual computations, significantly speeding up model development and debugging.
@@ -130,27 +128,25 @@ These features enable better support for model serialization, heterogeneous comp
130128

131129
#### Install from Pypi
132130

133-
You can install the official version of MindHF which is uploaded to pypi.
131+
You can install the official version of MindNLP which is uploaded to pypi.
134132

135133
```bash
136-
pip install mindhf
134+
pip install mindnlp
137135
```
138136

139-
> **Note**: The `mindnlp` package name is still available for backward compatibility, but we recommend using `mindhf` going forward.
140-
141137
#### Daily build
142138

143-
You can download MindHF daily wheel from [here](https://repo.mindspore.cn/mindspore-lab/mindhf/newest/any/).
139+
You can download MindNLP daily wheel from [here](https://repo.mindspore.cn/mindspore-lab/mindnlp/newest/any/).
144140

145141
#### Install from source
146142

147-
To install MindHF from source, please run:
143+
To install MindNLP from source, please run:
148144

149145
```bash
150-
pip install git+https://github.com/mindspore-lab/mindhf.git
146+
pip install git+https://github.com/mindspore-lab/mindnlp.git
151147
# or
152-
git clone https://github.com/mindspore-lab/mindhf.git
153-
cd mindhf
148+
git clone https://github.com/mindspore-lab/mindnlp.git
149+
cd mindnlp
154150
bash scripts/build_and_reinstall.sh
155151
```
156152

@@ -165,14 +161,14 @@ bash scripts/build_and_reinstall.sh
165161
| 0.4.x | >=2.2.x, <=2.5.0 | >=3.9, <=3.11 |
166162
| 0.5.x | >=2.5.0, <=2.7.0 | >=3.10, <=3.11 |
167163

168-
| MindHF version | MindSpore version | Supported Python version |
164+
| MindNLP version | MindSpore version | Supported Python version |
169165
|-----------------|-------------------|--------------------------|
170166
| 0.6.x | >=2.7.1. | >=3.10, <=3.11 |
171167

172168

173169
## Supported models
174170

175-
Since there are too many supported models, please check [here](https://mindhf.cqu.ai/supported_models)
171+
Since there are too many supported models, please check [here](https://mindnlp.cqu.ai/supported_models)
176172

177173
<!-- ## Tutorials
178174
@@ -191,7 +187,7 @@ The dynamic version is still under development, if you find any issue or have an
191187

192188
## MindSpore NLP SIG
193189

194-
MindSpore NLP SIG (Natural Language Processing Special Interest Group) is the main development team of the MindHF framework. It aims to collaborate with developers from both industry and academia who are interested in research, application development, and the practical implementation of natural language processing. Our goal is to create the best NLP framework based on the domestic framework MindSpore. Additionally, we regularly hold NLP technology sharing sessions and offline events. Interested developers can join our SIG group using the QR code below.
190+
MindSpore NLP SIG (Natural Language Processing Special Interest Group) is the main development team of the MindNLP framework. It aims to collaborate with developers from both industry and academia who are interested in research, application development, and the practical implementation of natural language processing. Our goal is to create the best NLP framework based on the domestic framework MindSpore. Additionally, we regularly hold NLP technology sharing sessions and offline events. Interested developers can join our SIG group using the QR code below.
195191

196192
<div align="center">
197193
<img src="./assets/qrcode_qq_group.jpg" width="250" />
@@ -210,11 +206,10 @@ and develop their own new semantic segmentation methods.
210206
If you find this project useful in your research, please consider citing:
211207

212208
```latex
213-
@misc{mindhf2022,
214-
title={{MindHF}: Easy-to-use and high-performance NLP and LLM framework based on MindSpore},
215-
author={MindHF Contributors},
209+
@misc{mindnlp2022,
210+
title={{MindNLP}: Easy-to-use and high-performance NLP and LLM framework based on MindSpore},
211+
author={MindNLP Contributors},
216212
howpublished = {\url{https://github.com/mindspore-lab/mindnlp}},
217-
year={2022},
218-
note={Formerly known as MindNLP}
213+
year={2022}
219214
}
220215
```

examples/diffusers/janus/demo/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from mindhf import core
1+
from mindnlp import core
22
import gradio as gr
33
from transformers import AutoConfig, AutoModelForCausalLM
44
from janus.models import VLChatProcessor

examples/diffusers/janus/demo/app_janusflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from mindhf import core
1+
from mindnlp import core
22
import gradio as gr
33
from janus.janusflow.models import MultiModalityCausalLM, VLChatProcessor
44
from PIL import Image

examples/diffusers/janus/demo/app_januspro.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from mindhf import core
1+
from mindnlp import core
22
import gradio as gr
33
from transformers import AutoConfig, AutoModelForCausalLM
44
from janus.models import VLChatProcessor

examples/diffusers/janus/demo/fastapi_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from fastapi import FastAPI, File, Form, UploadFile, HTTPException
22
from fastapi.responses import JSONResponse, StreamingResponse
33
import mindspore
4-
import mindhf
5-
from mindhf import core
4+
import mindnlp
5+
from mindnlp import core
66
from transformers import AutoConfig, AutoModelForCausalLM
77
from janus.models import MultiModalityCausalLM, VLChatProcessor
88
from PIL import Image

examples/diffusers/janus/generation_inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1717
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1818
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19-
import mindhf
19+
import mindnlp
2020
import torch
2121
from transformers import AutoModelForCausalLM, AutoConfig
2222

examples/diffusers/janus/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1818
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919

20-
import mindhf
20+
import mindnlp
2121
import torch
2222
from transformers import AutoModelForCausalLM, AutoConfig
2323

examples/diffusers/janus/interactivechat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import PIL.Image
3-
import mindhf
3+
import mindnlp
44
import torch
55
import numpy as np
66
from transformers import AutoModelForCausalLM, AutoConfig

0 commit comments

Comments
 (0)