Spaces:
Runtime error
Runtime error
Commit
·
f01d69f
1
Parent(s):
21e158f
Disable spaces
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from gradio_client import Client
|
|
3 |
from gradio_client.exceptions import AppError
|
4 |
import frontmatter
|
5 |
import os
|
6 |
-
import spaces
|
7 |
import torch
|
8 |
import logging
|
9 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
@@ -51,43 +51,18 @@ print(f"Model dtype: {next(vardecoder_model.parameters()).dtype}")
|
|
51 |
print(f"Model is meta: {next(vardecoder_model.parameters()).is_meta}")
|
52 |
print(f"Model parameters: {sum(p.numel() for p in vardecoder_model.parameters() if p.requires_grad):,}")
|
53 |
|
54 |
-
# Check if parameters actually have data
|
55 |
-
sample_param = next(vardecoder_model.parameters())
|
56 |
-
print(f"Sample parameter shape: {sample_param.shape}")
|
57 |
-
print(f"Sample parameter requires_grad: {sample_param.requires_grad}")
|
58 |
-
print(f"Sample parameter data type: {type(sample_param.data)}")
|
59 |
-
#print(f"Sample parameter storage: {sample_param.storage()}")
|
60 |
-
|
61 |
# Check memory after first model
|
62 |
print(f"GPU memory after vardecoder:")
|
63 |
print(f"Allocated: {torch.cuda.memory_allocated() / 1024**3:.2f} GB")
|
64 |
print(f"Reserved: {torch.cuda.memory_reserved() / 1024**3:.2f} GB")
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
# Add more detailed debugging before loading the second model
|
75 |
-
try:
|
76 |
-
logger.info("Loading fielddecoder model...")
|
77 |
-
print(f"CUDA available: {torch.cuda.is_available()}")
|
78 |
-
print(f"CUDA device count: {torch.cuda.device_count()}")
|
79 |
-
print(f"Current device: {torch.cuda.current_device()}")
|
80 |
-
print(f"Device name: {torch.cuda.get_device_name()}")
|
81 |
-
|
82 |
-
fielddecoder_model = AutoModelForCausalLM.from_pretrained(
|
83 |
-
"ejschwartz/resym-fielddecoder",
|
84 |
-
torch_dtype=torch.bfloat16,
|
85 |
-
)
|
86 |
-
logger.info("Successfully loaded fielddecoder model")
|
87 |
-
except Exception as e:
|
88 |
-
logger.error(f"Error loading fielddecoder model: {e}")
|
89 |
-
import traceback
|
90 |
-
logger.error(traceback.format_exc())
|
91 |
|
92 |
make_gradio_client = lambda: Client("https://ejschwartz-resym-field-helper.hf.space/")
|
93 |
|
|
|
3 |
from gradio_client.exceptions import AppError
|
4 |
import frontmatter
|
5 |
import os
|
6 |
+
#import spaces
|
7 |
import torch
|
8 |
import logging
|
9 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
51 |
print(f"Model is meta: {next(vardecoder_model.parameters()).is_meta}")
|
52 |
print(f"Model parameters: {sum(p.numel() for p in vardecoder_model.parameters() if p.requires_grad):,}")
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
# Check memory after first model
|
55 |
print(f"GPU memory after vardecoder:")
|
56 |
print(f"Allocated: {torch.cuda.memory_allocated() / 1024**3:.2f} GB")
|
57 |
print(f"Reserved: {torch.cuda.memory_reserved() / 1024**3:.2f} GB")
|
58 |
|
59 |
+
logger.info("Loading fielddecoder model...")
|
60 |
+
|
61 |
+
fielddecoder_model = AutoModelForCausalLM.from_pretrained(
|
62 |
+
"ejschwartz/resym-fielddecoder",
|
63 |
+
torch_dtype=torch.bfloat16,
|
64 |
+
)
|
65 |
+
logger.info("Successfully loaded fielddecoder model")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
make_gradio_client = lambda: Client("https://ejschwartz-resym-field-helper.hf.space/")
|
68 |
|