Spaces:
Sleeping
Sleeping
Update app.py
Browse files123456789101112131415import osfrom transformers import pipelineimport torch# This automatically pulls the secret you added in Step 2token = os.environ.get("HF_TOKEN")# Load the model using the token for authenticationpipe = pipeline("image-text-to-text",model="google/medgemma-4b-it",torch_dtype=torch.bfloat16,token=token, # <--- THIS IS THE FIXdevice_map="auto")12345678910111213141516171819import osimport torchfrom transformers import pipeline, BitsAndBytesConfigtoken = os.environ.get("HF_TOKEN")# 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",model_kwargs={"quantization_config": quant_config}, # <--- Use 4-bit quantizationtoken=token,device_map="auto")
app.py+9-5