|
57 | 57 | import torch
|
58 | 58 | from accelerate import logging
|
59 | 59 | from datasets import load_dataset
|
60 |
| -from transformers import AutoModelForSequenceClassification, AutoTokenizer, HfArgumentParser |
| 60 | +from transformers import AutoModelForSequenceClassification, HfArgumentParser |
61 | 61 |
|
62 | 62 | from trl import (
|
63 | 63 | ModelConfig,
|
|
97 | 97 | model_kwargs["device_map"] = get_kbit_device_map()
|
98 | 98 | model_kwargs["quantization_config"] = quantization_config
|
99 | 99 |
|
100 |
| - tokenizer = AutoTokenizer.from_pretrained( |
101 |
| - model_args.model_name_or_path, trust_remote_code=model_args.trust_remote_code, use_fast=True |
102 |
| - ) |
103 | 100 | model = AutoModelForSequenceClassification.from_pretrained(
|
104 | 101 | model_args.model_name_or_path, num_labels=1, trust_remote_code=model_args.trust_remote_code, **model_kwargs
|
105 | 102 | )
|
106 |
| - # Align padding tokens between tokenizer and model |
107 |
| - model.config.pad_token_id = tokenizer.pad_token_id |
108 |
| - |
109 |
| - # If post-training a base model, use ChatML as the default template |
110 |
| - if tokenizer.chat_template is None: |
111 |
| - model, tokenizer = setup_chat_format(model, tokenizer) |
112 | 103 |
|
113 | 104 | if model_args.use_peft and model_args.lora_task_type != "SEQ_CLS":
|
114 | 105 | logger.warning(
|
|
126 | 117 | ##########
|
127 | 118 | trainer = RewardTrainer(
|
128 | 119 | model=model,
|
129 |
| - processing_class=tokenizer, |
130 | 120 | args=training_args,
|
131 | 121 | train_dataset=dataset[script_args.dataset_train_split],
|
132 | 122 | eval_dataset=dataset[script_args.dataset_test_split] if training_args.eval_strategy != "no" else None,
|
|
0 commit comments