Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import torch
|
2 |
import yfinance as yf
|
3 |
import matplotlib.pyplot as plt
|
@@ -7,6 +9,12 @@ import gradio as gr
|
|
7 |
import logging
|
8 |
from transformers import AutoProcessor, PaliGemmaForConditionalGeneration
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Configure logging to write to a file
|
11 |
logging.basicConfig(filename='debug.log', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
12 |
|
@@ -15,7 +23,7 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
15 |
logging.info(f"CUDA Available: {torch.cuda.is_available()}")
|
16 |
logging.info(f"Device: {device}")
|
17 |
|
18 |
-
# Load the model and processor
|
19 |
model = PaliGemmaForConditionalGeneration.from_pretrained("ahmed-masry/chartgemma", torch_dtype=torch.float16).to(device)
|
20 |
processor = AutoProcessor.from_pretrained("ahmed-masry/chartgemma")
|
21 |
|
|
|
1 |
+
import warnings
|
2 |
+
from transformers.utils import logging as transformers_logging
|
3 |
import torch
|
4 |
import yfinance as yf
|
5 |
import matplotlib.pyplot as plt
|
|
|
9 |
import logging
|
10 |
from transformers import AutoProcessor, PaliGemmaForConditionalGeneration
|
11 |
|
12 |
+
# Suppress specific FutureWarnings from transformers library
|
13 |
+
warnings.filterwarnings("ignore", category=FutureWarning, message=".*vocab_size.*")
|
14 |
+
|
15 |
+
# Optionally, configure the transformers logging to avoid clutter
|
16 |
+
transformers_logging.set_verbosity_error()
|
17 |
+
|
18 |
# Configure logging to write to a file
|
19 |
logging.basicConfig(filename='debug.log', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
20 |
|
|
|
23 |
logging.info(f"CUDA Available: {torch.cuda.is_available()}")
|
24 |
logging.info(f"Device: {device}")
|
25 |
|
26 |
+
# Load the ChartGemma model and processor
|
27 |
model = PaliGemmaForConditionalGeneration.from_pretrained("ahmed-masry/chartgemma", torch_dtype=torch.float16).to(device)
|
28 |
processor = AutoProcessor.from_pretrained("ahmed-masry/chartgemma")
|
29 |
|