这篇文章我会记录使用 MindNLP 仓库的一些需要记录、防止遗忘的东西

MindNLP is an open source NLP library based on MindSpore,

Prerequisites

  1. create a conda env
  2. pip install mindspore from mindspore website. (一定要cudnn)
  3. cd mindnlp && pip install -e .

Check by python -c "import mindspore;mindspore.run_check()"

First Model[^first-model]

what i learned?

  1. Mindnlp 的 dataset 机制
    1. 定义 Register 类
    2. 定义 load_dataset 和 process 作为 Register 类的对象
    3. 在所有新的数据集类前 加入 @load_dataset.register warp一下
    4. 同样的,@process.register 来 warp dataset process
    5. 我们通过 imdb_train = process('imdb', imdb_train, tokenizer=tokenizer, vocab=vocab, ...) 来使用 imdb 类的数据
    6. imdb 数据集的路径为 mindnlp/mindnlp/dataset/text_classification/imdb.py,其中包括了数据集和Process类
  2. Tokenizer 类都在 mindnlp/mindnlp/transforms/tokenizers 中,没有仔细看

refs

[^first-model] https://github.com/cjl99/mindnlp/tree/master#get-started