Spaces:
Runtime error
Runtime error
LanguageBind
commited on
Commit
·
bd35e3e
1
Parent(s):
34b92bb
Update app.py
Browse files
app.py
CHANGED
@@ -60,6 +60,8 @@ def generate(image1, video, textbox_in, first_run, state, state_, images_tensor)
|
|
60 |
tensor = tensor.to(handler.model.device, dtype=dtype)
|
61 |
images_tensor[0] = images_tensor[0] + [tensor]
|
62 |
images_tensor[1] = images_tensor[1] + ['image']
|
|
|
|
|
63 |
video_processor = handler.video_processor
|
64 |
if not os.path.exists(image1) and os.path.exists(video):
|
65 |
tensor = video_processor(video, return_tensors='pt')['pixel_values'][0]
|
@@ -67,6 +69,8 @@ def generate(image1, video, textbox_in, first_run, state, state_, images_tensor)
|
|
67 |
tensor = tensor.to(handler.model.device, dtype=dtype)
|
68 |
images_tensor[0] = images_tensor[0] + [tensor]
|
69 |
images_tensor[1] = images_tensor[1] + ['video']
|
|
|
|
|
70 |
if os.path.exists(image1) and os.path.exists(video):
|
71 |
tensor = video_processor(video, return_tensors='pt')['pixel_values'][0]
|
72 |
# print(tensor.shape)
|
@@ -80,6 +84,8 @@ def generate(image1, video, textbox_in, first_run, state, state_, images_tensor)
|
|
80 |
tensor = tensor.to(handler.model.device, dtype=dtype)
|
81 |
images_tensor[0] = images_tensor[0] + [tensor]
|
82 |
images_tensor[1] = images_tensor[1] + ['image']
|
|
|
|
|
83 |
|
84 |
|
85 |
|
@@ -139,6 +145,9 @@ handler = Chat(model_path, conv_mode=conv_mode, load_8bit=load_8bit, load_4bit=l
|
|
139 |
if not os.path.exists("temp"):
|
140 |
os.makedirs("temp")
|
141 |
|
|
|
|
|
|
|
142 |
app = FastAPI()
|
143 |
|
144 |
textbox = gr.Textbox(
|
|
|
60 |
tensor = tensor.to(handler.model.device, dtype=dtype)
|
61 |
images_tensor[0] = images_tensor[0] + [tensor]
|
62 |
images_tensor[1] = images_tensor[1] + ['image']
|
63 |
+
print(torch.cuda.memory_allocated())
|
64 |
+
print(torch.cuda.max_memory_allocated())
|
65 |
video_processor = handler.video_processor
|
66 |
if not os.path.exists(image1) and os.path.exists(video):
|
67 |
tensor = video_processor(video, return_tensors='pt')['pixel_values'][0]
|
|
|
69 |
tensor = tensor.to(handler.model.device, dtype=dtype)
|
70 |
images_tensor[0] = images_tensor[0] + [tensor]
|
71 |
images_tensor[1] = images_tensor[1] + ['video']
|
72 |
+
print(torch.cuda.memory_allocated())
|
73 |
+
print(torch.cuda.max_memory_allocated())
|
74 |
if os.path.exists(image1) and os.path.exists(video):
|
75 |
tensor = video_processor(video, return_tensors='pt')['pixel_values'][0]
|
76 |
# print(tensor.shape)
|
|
|
84 |
tensor = tensor.to(handler.model.device, dtype=dtype)
|
85 |
images_tensor[0] = images_tensor[0] + [tensor]
|
86 |
images_tensor[1] = images_tensor[1] + ['image']
|
87 |
+
print(torch.cuda.memory_allocated())
|
88 |
+
print(torch.cuda.max_memory_allocated())
|
89 |
|
90 |
|
91 |
|
|
|
145 |
if not os.path.exists("temp"):
|
146 |
os.makedirs("temp")
|
147 |
|
148 |
+
print(torch.cuda.memory_allocated())
|
149 |
+
print(torch.cuda.max_memory_allocated())
|
150 |
+
|
151 |
app = FastAPI()
|
152 |
|
153 |
textbox = gr.Textbox(
|