Spaces:
Sleeping
Sleeping
Optimize memory usage to bfloat16
Browse files20 unmodified lines2122232425262720 unmodified linesprint(f"Loading model: {MODEL_ID}...")try:device_type = "cuda" if torch.cuda.is_available() else "cpu"torch_dtype = torch.float16 if device_type == "cuda" else torch.float32print(f"Using device: {device_type}, dtype: {torch_dtype}")processor = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True)20 unmodified lines212223242526272820 unmodified linesprint(f"Loading model: {MODEL_ID}...")try:device_type = "cuda" if torch.cuda.is_available() else "cpu"# Use bfloat16 for CPU to save memory (4B params * 4 bytes is too big for 16GB)torch_dtype = torch.float16 if device_type == "cuda" else torch.bfloat16print(f"Using device: {device_type}, dtype: {torch_dtype}")processor = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True)
utils.py+2-1