This commit is contained in:
hiyouga 2023-07-19 22:51:29 +08:00
parent 7159bc54ed
commit d111e658a2
1 changed files with 2 additions and 1 deletions

View File

@ -10,6 +10,7 @@ from transformers import (
)
from transformers.utils import check_min_version
from transformers.utils.versions import require_version
from transformers.trainer import is_deepspeed_zero3_enabled
from transformers.modeling_utils import PretrainedConfig, PreTrainedModel
from transformers.tokenization_utils import PreTrainedTokenizerBase
from trl import AutoModelForCausalLMWithValueHead
@ -108,7 +109,7 @@ def load_model_and_tokenizer(
model_to_load,
config=config,
torch_dtype=torch.bfloat16 if model_args.compute_dtype == torch.bfloat16 else torch.float16,
low_cpu_mem_usage=True,
low_cpu_mem_usage=(not is_deepspeed_zero3_enabled()),
**config_kwargs
)