Spaces:
Running
Running
fix slow response
Browse files
app.py
CHANGED
@@ -28,6 +28,7 @@ model.to(device)
|
|
28 |
model.eval()
|
29 |
|
30 |
# Print device and memory info for debugging
|
|
|
31 |
print(f"Device: {device}")
|
32 |
print(f"Memory allocated: {torch.cuda.memory_allocated(device)/1e9:.2f} GB" if torch.cuda.is_available() else "CPU only")
|
33 |
|
@@ -39,6 +40,7 @@ def print_system_resources():
|
|
39 |
|
40 |
# Call before generation
|
41 |
print_system_resources()
|
|
|
42 |
|
43 |
def generate_text(prompt, max_length=50, temperature=1.0):
|
44 |
try:
|
|
|
28 |
model.eval()
|
29 |
|
30 |
# Print device and memory info for debugging
|
31 |
+
print(f"---------- Info -----------")
|
32 |
print(f"Device: {device}")
|
33 |
print(f"Memory allocated: {torch.cuda.memory_allocated(device)/1e9:.2f} GB" if torch.cuda.is_available() else "CPU only")
|
34 |
|
|
|
40 |
|
41 |
# Call before generation
|
42 |
print_system_resources()
|
43 |
+
print(f"--------------------------")
|
44 |
|
45 |
def generate_text(prompt, max_length=50, temperature=1.0):
|
46 |
try:
|