From 7dac8be93f4adafba0db5ec15125736f8e911c41 Mon Sep 17 00:00:00 2001 From: Camille Zhong <44392324+Camille7777@users.noreply.github.com> Date: Wed, 22 Mar 2023 17:18:13 +0800 Subject: [PATCH 1/3] Add RoBERTa for RLHF Stage 2 & 3 (test) RoBERTa for RLHF Stage 2 & 3 (still in testing) Revert "Add RoBERTa for RLHF Stage 2 & 3 (test)" This reverts commit 06741d894dcbe958acd4e10d771f22275e20e368. Add RoBERTa for RLHF stage 2 & 3 1. add roberta folder under model folder 2. add roberta option in train_reward_model.py 3. add some test in testci Update test_ci.sh Revert "Update test_ci.sh" This reverts commit 9c7352b81766f3177d31eeec0ec178a301df966a. Add RoBERTa for RLHF Stage 2 & 3 (test) RoBERTa for RLHF Stage 2 & 3 (still in testing) Revert "Add RoBERTa for RLHF Stage 2 & 3 (test)" This reverts commit 06741d894dcbe958acd4e10d771f22275e20e368. Add RoBERTa for RLHF stage 2 & 3 1. add roberta folder under model folder 2. add roberta option in train_reward_model.py 3. add some test in testci Update test_ci.sh Revert "Update test_ci.sh" This reverts commit 9c7352b81766f3177d31eeec0ec178a301df966a. update roberta with coati chat ci update Revert "chat ci update" This reverts commit 17ae7ae01fa752bd3289fc39069868fde99cf846. From 3259f8599ff1ccac1a25301e640f15aee61aaf3a Mon Sep 17 00:00:00 2001 From: Camille7777 <44392324+Camille7777@users.noreply.github.com> Date: Mon, 25 Sep 2023 14:34:17 +0800 Subject: [PATCH 2/3] [NFC] polish colossalai/inference/tensor_parallel/policies/chatglm2.py code style --- .../tensor_parallel/policies/chatglm2.py | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/colossalai/inference/tensor_parallel/policies/chatglm2.py b/colossalai/inference/tensor_parallel/policies/chatglm2.py index cb223370a65d..23ae5ae6e104 100644 --- a/colossalai/inference/tensor_parallel/policies/chatglm2.py +++ b/colossalai/inference/tensor_parallel/policies/chatglm2.py @@ -1,7 +1,5 @@ from functools import partial -import torch - from colossalai.shardformer.modeling.chatglm2_6b.modeling_chatglm import ( ChatGLMForConditionalGeneration, ChatGLMModel, @@ -9,13 +7,13 @@ GLMTransformer, SelfAttention, ) + # import colossalai from colossalai.shardformer.policies.chatglm2 import ChatGLMModelPolicy from ..modeling.chatglm2 import ChatGLM2InferenceForwards, _init_to_get_rotary try: - from colossalai.kernel.triton.rms_norm import rmsnorm_forward HAS_TRITON_RMSNORM = True except: print("you should install triton from https://github.com/openai/triton") @@ -23,7 +21,6 @@ class ChatGLM2InferPolicy(ChatGLMModelPolicy): - def __init__(self) -> None: super().__init__() @@ -32,24 +29,24 @@ def module_policy(self): self.shard_config._infer() model_infer_forward = ChatGLM2InferenceForwards.chatglm_model_forward - method_replacement = {'forward': model_infer_forward} + method_replacement = {"forward": model_infer_forward} self.append_or_create_method_replacement(description=method_replacement, policy=policy, target_key=ChatGLMModel) encoder_infer_forward = ChatGLM2InferenceForwards.chatglm_encoder_forward - method_replacement = {'forward': encoder_infer_forward} - self.append_or_create_method_replacement(description=method_replacement, - policy=policy, - target_key=GLMTransformer) + method_replacement = {"forward": encoder_infer_forward} + self.append_or_create_method_replacement( + description=method_replacement, policy=policy, target_key=GLMTransformer + ) encoder_layer_infer_forward = ChatGLM2InferenceForwards.chatglm_glmblock_forward - method_replacement = {'forward': encoder_layer_infer_forward} + method_replacement = {"forward": encoder_layer_infer_forward} self.append_or_create_method_replacement(description=method_replacement, policy=policy, target_key=GLMBlock) attn_infer_forward = ChatGLM2InferenceForwards.chatglm_flash_attn_kvcache_forward - method_replacement = {'forward': attn_infer_forward} - self.append_or_create_method_replacement(description=method_replacement, - policy=policy, - target_key=SelfAttention) + method_replacement = {"forward": attn_infer_forward} + self.append_or_create_method_replacement( + description=method_replacement, policy=policy, target_key=SelfAttention + ) # for rmsnorm and others, we need to check the shape return policy @@ -60,17 +57,16 @@ def postprocess(self): class ChatGLM2ForConditionalGenerationInferPolicy(ChatGLM2InferPolicy): - def __init__(self) -> None: super().__init__() def module_policy(self): policy = super().module_policy() model_infer_forward = ChatGLM2InferenceForwards.chatglm_for_conditional_generation_forward - method_replacement = {'forward': partial(model_infer_forward)} - self.append_or_create_method_replacement(description=method_replacement, - policy=policy, - target_key=ChatGLMForConditionalGeneration) + method_replacement = {"forward": partial(model_infer_forward)} + self.append_or_create_method_replacement( + description=method_replacement, policy=policy, target_key=ChatGLMForConditionalGeneration + ) return policy def postprocess(self): From 0e16877e0b2ec438c3831831a70819af9b446efe Mon Sep 17 00:00:00 2001 From: Camille7777 <44392324+Camille7777@users.noreply.github.com> Date: Mon, 25 Sep 2023 14:54:01 +0800 Subject: [PATCH 3/3] [NFC] polish colossalai/kernel/cuda_native/csrc/gptq/tuning.h code style --- colossalai/kernel/cuda_native/csrc/gptq/tuning.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/colossalai/kernel/cuda_native/csrc/gptq/tuning.h b/colossalai/kernel/cuda_native/csrc/gptq/tuning.h index 770ca46aa7c8..e413b8a96c11 100644 --- a/colossalai/kernel/cuda_native/csrc/gptq/tuning.h +++ b/colossalai/kernel/cuda_native/csrc/gptq/tuning.h @@ -3,11 +3,10 @@ #ifndef _tuning_h #define _tuning_h -struct ExLlamaTuning -{ - int matmul_recons_thd; - bool matmul_fused_remap; - bool matmul_no_half2; +struct ExLlamaTuning { + int matmul_recons_thd; + bool matmul_fused_remap; + bool matmul_no_half2; }; #endif