global
Browse files
app.py
CHANGED
@@ -300,6 +300,16 @@ def buildmodel(**kwargs):
|
|
300 |
for token in added_special_tokens_list:
|
301 |
quantizer.additional_special_tokens.add(token)
|
302 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
# return model, quantizer, tokenizer
|
304 |
|
305 |
def construction_layout():
|
@@ -328,15 +338,15 @@ def construction_layout():
|
|
328 |
# model.input_embeddings = model.lm.get_input_embeddings()
|
329 |
# print('after token embeddings to match the tokenizer', 129423)
|
330 |
|
331 |
-
print("before .to(device)")
|
332 |
-
model = model.to("cuda")
|
333 |
-
print("after .to(device)")
|
334 |
-
model = model.bfloat16()
|
335 |
-
model.eval()
|
336 |
-
# quantizer = quantizer.to("cuda")
|
337 |
-
# tokenizer = tokenizer.to("cuda")
|
338 |
-
# model.lm = model.lm.to("cuda")
|
339 |
-
print(model.lm.device)
|
340 |
|
341 |
return params_dict["width"], params_dict["height"], device
|
342 |
# return model, quantizer, tokenizer, params_dict["width"], params_dict["height"], device
|
|
|
300 |
for token in added_special_tokens_list:
|
301 |
quantizer.additional_special_tokens.add(token)
|
302 |
|
303 |
+
print(f"before .to(device):{model.device} {model.lm.device}")
|
304 |
+
model = model.to("cuda")
|
305 |
+
print(f"after .to(device):{model.device} {model.lm.device}")
|
306 |
+
model = model.bfloat16()
|
307 |
+
model.eval()
|
308 |
+
# quantizer = quantizer.to("cuda")
|
309 |
+
# tokenizer = tokenizer.to("cuda")
|
310 |
+
# model.lm = model.lm.to("cuda")
|
311 |
+
print(model.lm.device)
|
312 |
+
|
313 |
# return model, quantizer, tokenizer
|
314 |
|
315 |
def construction_layout():
|
|
|
338 |
# model.input_embeddings = model.lm.get_input_embeddings()
|
339 |
# print('after token embeddings to match the tokenizer', 129423)
|
340 |
|
341 |
+
# print("before .to(device)")
|
342 |
+
# model = model.to("cuda")
|
343 |
+
# print("after .to(device)")
|
344 |
+
# model = model.bfloat16()
|
345 |
+
# model.eval()
|
346 |
+
# # quantizer = quantizer.to("cuda")
|
347 |
+
# # tokenizer = tokenizer.to("cuda")
|
348 |
+
# # model.lm = model.lm.to("cuda")
|
349 |
+
# print(model.lm.device)
|
350 |
|
351 |
return params_dict["width"], params_dict["height"], device
|
352 |
# return model, quantizer, tokenizer, params_dict["width"], params_dict["height"], device
|