Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wechat QR code #24

Merged
merged 1 commit into from
May 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Copyright © 2022 BAAI. All rights reserved.

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -175,28 +176,3 @@
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,13 @@ Thanks for your interest in contributing! There are many ways to get involved;
start with our [contributor guidelines](CONTRIBUTING.md) and then
check these [open issues](https://github.com/BAAI-WuDao/Sailing/issues) for specific tasks.

## Contact us
Scan wechat QR code

## [License](/LICENSE)
```
Copyright [2022] [BAAI]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<img src="./flagai_wechat.png" width = "200" height = "200" align=center />

http://www.apache.org/licenses/LICENSE-2.0
## [License](/LICENSE)
The majority of FlagAI is licensed under the [Apache 2.0 license](LICENSE), however portions of the project are available under separate license terms:

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
* Megatron-LM is licensed under the [Megatron-LM license](https://github.com/NVIDIA/Megatron-LM/blob/main/LICENSE)
* GLM is licensed under the [MIT license](https://github.com/THUDM/GLM/blob/main/LICENSE)
20 changes: 7 additions & 13 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,20 +213,14 @@ for text_pair in test_data:
# 贡献代码
感谢您对贡献的兴趣! 参与的方式有很多; 从我们的[贡献者指南](CONTRIBUTING.md) 开始,然后检查这些[未解决的问题](https://github.com/BAAI-WuDao/Sailing/issues)以执行特定任务。

# 联系我们
欢迎扫码加入FlagAI用户群

# [许可证](/LICENSE)
```
Copyright [2022] [BAAI]
<img src="./flagai_wechat.png" width = "200" height = "200" align=center />

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
# [许可证](/LICENSE)
大部分的FlagAI项目是基于[Apache 2.0 license](LICENSE), 但是部分的代码是基于其他的协议:

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
* Megatron-LM 是基于协议[Megatron-LM license](https://github.com/NVIDIA/Megatron-LM/blob/main/LICENSE)
* GLM 是基于协议[MIT license](https://github.com/THUDM/GLM/blob/main/LICENSE)
3 changes: 3 additions & 0 deletions examples/bert_title_generation_english/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/bert_title_generation_english/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import os
import torch
from torch.utils.data import Dataset
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_blank_filling/glm_generate_samples.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# coding=utf-8
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_poetry_generation/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_poetry_generation/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import os
import torch
from torch.utils.data import Dataset
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_pretrain/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.data.tokenizer import GLMLargeChTokenizer
from flagai.model.glm_model import GLMForSeq2Seq
from flagai.trainer import Trainer
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_seq2seq/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.trainer import Trainer
from flagai.model.glm_model import GLMForSeq2Seq
from flagai.data.tokenizer import GLMLargeEnWordPieceTokenizer, GLMLargeChTokenizer
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_superglue/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.trainer import Trainer
from flagai.model.glm_model import GLMForSingleTokenCloze, GLMForMultiTokenCloze, GLMForMultiTokenClozeFast
from flagai.data.tokenizer import GLMLargeEnWordPieceTokenizer, GLMLargeChTokenizer
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_superglue/train_10b_clue.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.trainer import Trainer
from flagai.model.glm_model import GLMForSingleTokenCloze
from flagai.data.tokenizer import GLMLargeChTokenizer
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_superglue/train_10b_superglue.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.trainer import Trainer
from flagai.model.glm_model import GLMForSingleTokenCloze
from flagai.data.tokenizer import GLMLargeEnWordPieceTokenizer
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_superglue/train_prefix.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.trainer import Trainer
from flagai.model.glm_model import GLMForSingleTokenCloze, GLMForMultiTokenCloze, GLMForMultiTokenClozeFast, GLMForSequenceClassification
from flagai.data.tokenizer import GLMLargeEnWordPieceTokenizer, GLMLargeChTokenizer
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_title_generation/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/glm_title_generation/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import os
import numpy as np
import torch
Expand Down
3 changes: 3 additions & 0 deletions examples/gpt2_text_writting/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor

Expand Down
3 changes: 3 additions & 0 deletions examples/gpt2_title_generation/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/gpt2_title_generation/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import sys

sys.path.append('/data/liuguang/Sailing')
Expand Down
3 changes: 3 additions & 0 deletions examples/gpt2_title_generation/train_multi_gpu.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import sys

sys.path.append("/data/liuguang/Sailing")
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_faq/1_construct_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# construct data
# data from https://github.com/murufeng/ChineseNlpCorpus
import torch
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_faq/2_test_bert_faq.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import faiss
import torch
from flagai.auto_model.auto_loader import AutoLoader
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_ner/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_ner/generate_crf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_ner/generate_global_pointer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_ner/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import os

from tqdm import tqdm
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_ner/train_crf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from tqdm import tqdm
import torch
from torch.utils.data import Dataset
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_ner/train_global_pointer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from tqdm import tqdm
import torch
from torch.utils.data import Dataset
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_semantic_matching/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_semantic_matching/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import os
import torch
from torch.utils.data import Dataset
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_title_generation/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import torch
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_title_generation/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import os
import torch
from torch.utils.data import Dataset
Expand Down
3 changes: 3 additions & 0 deletions examples/roberta_title_generation/train_multi_gpu.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import sys

sys.path.append("/data/liuguang/Sailing")
Expand Down
40 changes: 40 additions & 0 deletions examples/t5_flagai_11b/deepspeed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"train_micro_batch_size_per_gpu": 2,
"gradient_accumulation_steps": 1,
"steps_per_print": 100,
"gradient_clipping": 1.0,
"zero_optimization": {
"stage": 3,
"contiguous_gradients": false,
"overlap_comm": true,
"reduce_scatter": true,
"reduce_bucket_size": 5e7,
"allgather_bucket_size": 5e7,
"cpu_offload": true
},
"zero_allow_untested_optimizer": true,
"fp16": {
"enabled": true,
"loss_scale": 0,
"loss_scale_window": 1000,
"hysteresis": 2,
"min_loss_scale": 1
},
"optimizer": {
"type": "Adam",
"params": {
"lr": 0.0004,
"weight_decay": 0.01,
"betas": [
0.9,
0.98
],
"eps": 1e-6
}
},
"activation_checkpointing": {
"partition_activations": false,
"contiguous_memory_optimization": false
},
"wall_clock_breakdown": false
}
5 changes: 4 additions & 1 deletion examples/t5_flagai_11b/train_title_with_flagai_t5_11b.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import sys

sys.path.append('/mnt/liuguang/FlagAI')
Expand Down Expand Up @@ -74,7 +77,7 @@ def read_file():

model = T5ForConditionalGeneration.from_pretrain(download_path='/mnt',
model_name='t5-11b')

model.gradient_checkpointing = True
print("loading model & tokenizer is done!")

maxlen = 1024
Expand Down
3 changes: 3 additions & 0 deletions examples/t5_huggingface/train_t5_11b.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.trainer import Trainer
from transformers import T5ForConditionalGeneration, T5Tokenizer
from torch.utils.data import Dataset
Expand Down
3 changes: 3 additions & 0 deletions examples/t5_title_generation/generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
from flagai.auto_model.auto_loader import AutoLoader
from flagai.model.predictor.predictor import Predictor

Expand Down
3 changes: 3 additions & 0 deletions examples/t5_title_generation/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import os
import torch
from torch.utils.data import Dataset
Expand Down
3 changes: 3 additions & 0 deletions flagai/auto_model/auto_loader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import importlib
import os
from flagai.model.file_utils import _get_model_id, _get_vocab_path
Expand Down
3 changes: 3 additions & 0 deletions flagai/data/collate_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright © 2022 BAAI. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
import numpy as np
import torch

Expand Down
Loading