logging
Browse files
app.py
CHANGED
@@ -1,15 +1,10 @@
|
|
1 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
2 |
-
from transformers.utils import logging
|
3 |
from datetime import datetime
|
4 |
import gradio as gr
|
5 |
import spaces
|
6 |
import torch
|
7 |
|
8 |
|
9 |
-
logging.set_verbosity_info()
|
10 |
-
logger = logging.get_logger("transformers")
|
11 |
-
logger.info("INFO")
|
12 |
-
|
13 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
14 |
DEBUG_UI = False
|
15 |
LANGS = {
|
@@ -59,9 +54,9 @@ else:
|
|
59 |
output = '\n'.join(result)
|
60 |
|
61 |
end = datetime.now()
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
return output
|
66 |
|
67 |
|
|
|
1 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
|
2 |
from datetime import datetime
|
3 |
import gradio as gr
|
4 |
import spaces
|
5 |
import torch
|
6 |
|
7 |
|
|
|
|
|
|
|
|
|
8 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
9 |
DEBUG_UI = False
|
10 |
LANGS = {
|
|
|
54 |
output = '\n'.join(result)
|
55 |
|
56 |
end = datetime.now()
|
57 |
+
input_shape = tuple(inputs.input_ids.shape)
|
58 |
+
output_shape = tuple(translated_tokens.shape)
|
59 |
+
print(f'[{end}] {DEVICE}_time - {end-start}; input {input_shape} / output {output_shape};')
|
60 |
return output
|
61 |
|
62 |
|