Browse Source

fix some spelling error with applications/Chat/examples/ (#3692)

* fix spelling error with examples/comminity/

* fix spelling error with example/
pull/3695/head
digger-yu 2 years ago committed by GitHub
parent
commit
65bdc3159f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      applications/Chat/examples/README.md
  2. 10
      applications/Chat/examples/community/peft/easy_dataset.py
  3. 2
      applications/Chat/examples/community/peft/train_peft_prompts.py
  4. 2
      applications/Chat/examples/community/peft/train_peft_sft.py
  5. 2
      applications/Chat/examples/train_sft.py

3
applications/Chat/examples/README.md

@ -24,7 +24,6 @@
- [LLaMA](#llama)
- [Add your own models](#add-your-own-models)
- [Actor model](#actor-model)
- [LM model](#lm-model)
- [Reward model](#reward-model)
- [Critic model](#critic-model)
@ -150,7 +149,7 @@ torchrun --standalone --nproc_per_node=4 train_prompts.py \
--strategy colossalai_zero2 \
--prompt_dataset /path/to/your/prompt_dataset \
--pretrain_dataset /path/to/your/pretrain_dataset \
--rm_pretrain /your/pretrain/rm/defination \
--rm_pretrain /your/pretrain/rm/definition \
--rm_path /your/rm/model/path
```

10
applications/Chat/examples/community/peft/easy_dataset.py

@ -188,7 +188,7 @@ class EasySFTDataset(Dataset):
else:
raw_input_ids.append(encoded_ids)
grouped_inpup_ids = []
grouped_input_ids = []
current_input_ids = []
attention_mask = []
if tokenizer.pad_token_id is None:
@ -199,7 +199,7 @@ class EasySFTDataset(Dataset):
#pad the current_input_ids to max_length with tokenizer.pad_token_id
padded_length = max_length - len(current_input_ids)
current_input_ids.extend([tokenizer.pad_token_id] * padded_length)
grouped_inpup_ids.append(torch.tensor(current_input_ids, dtype=torch.long))
grouped_input_ids.append(torch.tensor(current_input_ids, dtype=torch.long))
attention_mask.append(
torch.tensor([1] * (max_length - padded_length) + [0] * padded_length, dtype=torch.long))
current_input_ids = []
@ -208,7 +208,7 @@ class EasySFTDataset(Dataset):
if len(current_input_ids) > 0:
padded_length = max_length - len(current_input_ids)
current_input_ids.extend([tokenizer.pad_token_id] * padded_length)
grouped_inpup_ids.append(torch.tensor(current_input_ids, dtype=torch.long))
grouped_input_ids.append(torch.tensor(current_input_ids, dtype=torch.long))
attention_mask.append(
torch.tensor([1] * (max_length - padded_length) + [0] * padded_length, dtype=torch.long))
else:
@ -218,8 +218,8 @@ class EasySFTDataset(Dataset):
input_ids.extend([tokenizer.pad_token_id] * padded_length)
attention_mask.append(
torch.tensor([1] * (max_length - padded_length) + [0] * padded_length, dtype=torch.long))
grouped_inpup_ids.append(torch.tensor(input_ids, dtype=torch.long))
self.input_ids = grouped_inpup_ids
grouped_input_ids.append(torch.tensor(input_ids, dtype=torch.long))
self.input_ids = grouped_input_ids
self.labels = copy.deepcopy(self.input_ids)
self.file_name = data_file
self.attention_mask = attention_mask

2
applications/Chat/examples/community/peft/train_peft_prompts.py

@ -41,7 +41,7 @@ def main(args):
# configure model
if args.model == 'bloom':
# initial_model = BLOOMActor(pretrained=args.pretrain)
print('Using peft lora to load Bloom model as inital_model')
print('Using peft lora to load Bloom model as initial_model')
initial_model = BLOOMActor(pretrained=args.pretrain, lora_path=args.sft_lora_path)
print('Using peft lora to load Bloom model as initial_model (Done)')
else:

2
applications/Chat/examples/community/peft/train_peft_sft.py

@ -86,7 +86,7 @@ def train(args):
if args.strategy == 'colossalai_gemini':
# this is a hack to deal with the resized embedding
# to make sure all parameters are ColoParameter for Colossal-AI Gemini Compatiblity
# to make sure all parameters are ColoParameter for Colossal-AI Gemini Compatibility
for name, param in model.named_parameters():
if not isinstance(param, ColoParameter):
sub_module_name = '.'.join(name.split('.')[:-1])

2
applications/Chat/examples/train_sft.py

@ -84,7 +84,7 @@ def train(args):
if args.strategy == 'colossalai_gemini':
# this is a hack to deal with the resized embedding
# to make sure all parameters are ColoParameter for Colossal-AI Gemini Compatiblity
# to make sure all parameters are ColoParameter for Colossal-AI Gemini Compatibility
for name, param in model.named_parameters():
if not isinstance(param, ColoParameter):
sub_module_name = '.'.join(name.split('.')[:-1])

Loading…
Cancel
Save