qdqd commited on
Commit
a78ec9c
Β·
verified Β·
1 Parent(s): 4c12043

Update scripts/visual_qa.py

Browse files
Files changed (1) hide show
  1. scripts/visual_qa.py +11 -2
scripts/visual_qa.py CHANGED
@@ -17,8 +17,17 @@ from smolagents import Tool, tool
17
 
18
  load_dotenv(override=True)
19
 
20
- idefics_processor = AutoProcessor.from_pretrained("HuggingFaceM4/idefics2-8b-chatty")
21
-
 
 
 
 
 
 
 
 
 
22
 
23
  def process_images_and_text(image_path, query, client):
24
  messages = [
 
17
 
18
  load_dotenv(override=True)
19
 
20
+ #idefics_processor = AutoProcessor.from_pretrained("HuggingFaceM4/idefics2-8b-chatty")
21
+ # Load models with increased timeout and retries
22
+ try:
23
+ idefics_processor = AutoProcessor.from_pretrained(
24
+ "HuggingFaceM4/idefics2-8b-chatty",
25
+ timeout=60, # Double timeout
26
+ use_auth_token=os.getenv("HF_TOKEN")
27
+ )
28
+ except Exception as e:
29
+ warnings.warn(f"Couldn't load Idefics processor: {str(e)}")
30
+ idefics_processor = None
31
 
32
  def process_images_and_text(image_path, query, client):
33
  messages = [