Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 7ae4c7f

Browse files
haukurbCopybara-Service
authored andcommitted
internal merge of PR #929
PiperOrigin-RevId: 221513658
1 parent a9cca95 commit 7ae4c7f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tensor2tensor/insights/server.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@
1616
"""A GUnicorn + Flask Debug Frontend for Transformer models."""
1717

1818
import json
19-
2019
from flask import Flask
2120
from flask import jsonify
2221
from flask import request
2322
from flask import send_from_directory
2423
from flask.json import JSONEncoder
25-
import numpy as np
2624
from gunicorn.app.base import BaseApplication
2725
from gunicorn.six import iteritems
26+
import numpy as np
2827
from tensor2tensor.insights import transformer_model
29-
3028
import tensorflow as tf
3129

3230
flags = tf.flags
@@ -40,13 +38,16 @@
4038

4139

4240
_NUMPY_INT_DTYPES = [
43-
np.int8, np.int16, np.int32, np.int64
41+
np.int8, np.int16, np.int32, np.int64
4442
]
4543
_NUMPY_FP_DTYPES = [
46-
np.float16, np.float32, np.float64
44+
np.float16, np.float32, np.float64
4745
]
46+
47+
4848
class NumpySerializationFix(JSONEncoder):
4949
"""json module cannot serialize numpy datatypes, reinterpret them first"""
50+
5051
def default(self, obj):
5152
obj_type = type(obj)
5253
if obj_type in _NUMPY_INT_DTYPES:

0 commit comments

Comments
 (0)