Spaces:
Sleeping
Sleeping
Update app.py
Browse files122345568789101112131415121316171819import osfrom transformers import pipelineimport torchfrom transformers import pipeline, BitsAndBytesConfig
# This automatically pulls the secret you added in Step 2token = os.environ.get("HF_TOKEN")
# Load the model using the token for authentication# This config shrinks the model so it fits on free hardwarequant_config = BitsAndBytesConfig( load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16)
pipe = pipeline( "image-text-to-text", model="google/medgemma-4b-it", torch_dtype=torch.bfloat16, token=token, # <--- THIS IS THE FIX model_kwargs={"quantization_config": quant_config}, # <--- Use 4-bit quantization token=token, device_map="auto")app.py+9-5