casts the prepared data to int16 (doesn't help with training memory)

This commit is contained in:
Wing Lian
2023-04-17 21:36:02 -04:00
parent 120e7df7df
commit 2db9436410
2 changed files with 13 additions and 7 deletions

View File

@@ -14,7 +14,6 @@ import transformers
import yaml
from attrdict import AttrDefault
from datasets import load_dataset, IterableDataset, Dataset, load_from_disk
from huggingface_hub.hf_api import DatasetInfo
from torch import nn
from transformers import (
AutoModelForCausalLM,
@@ -169,7 +168,7 @@ def load_model(base_model, base_model_config, model_type, tokenizer_type, cfg, a
if cfg.load_4bit:
# Scales to half
print('Fitting 4bit scales and zeros to half')
logging.info('Fitting 4bit scales and zeros to half')
for n, m in model.named_modules():
if 'Autograd4bitQuantLinear' in str(type(m)) or 'Linear4bitLt' in str(type(m)):
if hasattr(m, "is_v1_model") and m.is_v1_model: