-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Test only] BFloat16 test for SkipSimplifiedLayerNormalization #22941
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can commit the suggested changes from lintrunner.
skip_size); | ||
} | ||
else | ||
{ | ||
LaunchSkipLayerNormKernel<CudaT, Simplified>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skip_size); | |
} | |
else | |
{ | |
LaunchSkipLayerNormKernel<CudaT, Simplified>( | |
skip_size); | |
} else { | |
LaunchSkipLayerNormKernel<CudaT, Simplified>( |
import tempfile | ||
from typing import Dict | ||
from enum import Enum | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import tempfile | |
from typing import Dict | |
from enum import Enum | |
import tempfile | |
from enum import Enum | |
from typing import Dict | |
from onnx import AttributeProto, GraphProto, ModelProto, NodeProto, TensorProto, helper, numpy_helper | ||
from onnx.shape_inference import infer_shapes, infer_shapes_path | ||
from onnx.helper import float32_to_bfloat16 | ||
from packaging import version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from onnx import AttributeProto, GraphProto, ModelProto, NodeProto, TensorProto, helper, numpy_helper | |
from onnx.shape_inference import infer_shapes, infer_shapes_path | |
from onnx.helper import float32_to_bfloat16 | |
from packaging import version | |
from onnx import AttributeProto, GraphProto, ModelProto, NodeProto, TensorProto, helper, numpy_helper | |
from onnx.helper import float32_to_bfloat16 | |
from onnx.shape_inference import infer_shapes, infer_shapes_path | |
from packaging import version |
|
||
|
||
def convert_np_to_float16(np_array, min_positive_val=5.96e-08, max_finite_val=65504.0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def convert_np_to_float16(np_array, min_positive_val=5.96e-08, max_finite_val=65504.0): | |
def convert_np_to_float16(np_array, min_positive_val=5.96e-08, max_finite_val=65504.0): |
|
||
def convert_tensor_float_to_bfloat16(tensor): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def convert_tensor_float_to_bfloat16(tensor): | |
def convert_tensor_float_to_bfloat16(tensor): |
class NodeValueType(Enum): | ||
FP32 = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class NodeValueType(Enum): | |
FP32 = 1 | |
class NodeValueType(Enum): |
class InitializerTracker: | ||
"""Class for keeping track of initializer.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class InitializerTracker: | |
"""Class for keeping track of initializer.""" | |
class InitializerTracker: |
def convert_float_to_float16( | ||
model, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def convert_float_to_float16( | |
model, | |
def convert_float_to_float16( |
|
||
# Some operators have data type fixed as float for some input. Add a float16 to float cast for those inputs. | ||
for node in mixed_float_type_node_list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Some operators have data type fixed as float for some input. Add a float16 to float cast for those inputs. | |
for node in mixed_float_type_node_list: | |
# Some operators have data type fixed as float for some input. Add a float16 to float cast for those inputs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can commit the suggested changes from lintrunner.
import tempfile | ||
from typing import Dict | ||
from enum import Enum | ||
import ml_dtypes | ||
|
||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import tempfile | |
from typing import Dict | |
from enum import Enum | |
import ml_dtypes | |
import numpy as np | |
import tempfile | |
from enum import Enum | |
from typing import Dict | |
import ml_dtypes | |
import numpy as np |
a198187
to
03bf839
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can commit the suggested changes from lintrunner.
skip_size); | ||
} | ||
else | ||
{ | ||
LaunchSkipLayerNormKernel<CudaT, Simplified>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skip_size); | |
} | |
else | |
{ | |
LaunchSkipLayerNormKernel<CudaT, Simplified>( | |
skip_size); | |
} else { | |
LaunchSkipLayerNormKernel<CudaT, Simplified>( |
Description
Motivation and Context