Spaces:
Runtime error
Runtime error
Update app.py
Browse files5 unmodified lines6789101133 unmodified lines454647484950511 unmodified line535455565758595 unmodified linesimport sysimport osfrom accelerate import infer_auto_device_map, init_empty_weights# Configure logginglogging.basicConfig(33 unmodified linestokenizer.pad_token = tokenizer.eos_tokenlogger.info("Tokenizer loaded successfully")# Load model with device maplogger.info("Loading model...")model = AutoModelForCausalLM.from_pretrained(model_name,1 unmodified linetrust_remote_code=True,token=hf_token,device_map="auto",load_in_8bit=True)logger.info("Model loaded successfully")5 unmodified lines678910111233 unmodified lines464748495051521 unmodified line5455565758596061626364655 unmodified linesimport sysimport osfrom accelerate import infer_auto_device_map, init_empty_weightsimport bitsandbytes as bnb# Configure logginglogging.basicConfig(33 unmodified linestokenizer.pad_token = tokenizer.eos_tokenlogger.info("Tokenizer loaded successfully")# Load model with quantization and device maplogger.info("Loading model...")model = AutoModelForCausalLM.from_pretrained(model_name,1 unmodified linetrust_remote_code=True,token=hf_token,device_map="auto",quantization_config={"load_in_4bit": True,"bnb_4bit_compute_dtype": torch.float16,"bnb_4bit_use_double_quant": True,"bnb_4bit_quant_type": "nf4"})logger.info("Model loaded successfully")
app.py+8-2