Spaces:
Sleeping
Sleeping
Update training.py
Browse files79 unmodified lines8081828384853 unmodified lines89909192939495969779 unmodified linesdef load_model():model_name = "microsoft/Phi-3-mini-4k-instruct"bnb_config = BitsAndBytesConfig(load_in_4bit=True,bnb_4bit_compute_dtype=torch.bfloat16,3 unmodified linesmodel = AutoModelForCausalLM.from_pretrained(model_name,quantization_config=bnb_config,device_map="auto",trust_remote_code=True,torch_dtype=torch.bfloat16,)79 unmodified lines80818283848586878889903 unmodified lines94959697989910010110210310479 unmodified linesdef load_model():model_name = "microsoft/Phi-3-mini-4k-instruct"# Manually fix the config to avoid rope_scaling KeyErrorconfig = AutoConfig.from_pretrained(model_name, trust_remote_code=True)if not hasattr(config, 'rope_scaling') or config.rope_scaling is None:config.rope_scaling = {"type": "linear", "factor": 1.0}bnb_config = BitsAndBytesConfig(load_in_4bit=True,bnb_4bit_compute_dtype=torch.bfloat16,3 unmodified linesmodel = AutoModelForCausalLM.from_pretrained(model_name,config=config, # use the patched configquantization_config=bnb_config,device_map="auto",trust_remote_code=True,attn_implementation="eager", # force eager, avoid flash-attntorch_dtype=torch.bfloat16,)
training.py+7