forked from huggingface/transformers
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ort to debertav2 model config (#12)
* add ort config for debertav2 model * remove prints * remove old commented code * fix run style error * add flake ignore comment * trial to fix blackify format error
- Loading branch information
1 parent
8e5b0db
commit 0b2532a
Showing
3 changed files
with
105 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# flake8: noqa | ||
# coding=utf-8 | ||
# Copyright 2020, Microsoft and the HuggingFace Inc. team. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
""" | ||
Logging util @Author: penhe@microsoft.com | ||
""" | ||
|
||
""" Utils for torch jit tracing customer operators/functions""" | ||
import os | ||
|
||
import torch | ||
|
||
|
||
def traceable(cls): | ||
class _Function(object): | ||
@staticmethod | ||
def apply(*args): | ||
if torch.onnx.is_in_onnx_export(): | ||
return cls.forward(_Function, *args) | ||
else: | ||
return cls.apply(*args) | ||
|
||
@staticmethod | ||
def save_for_backward(*args): | ||
pass | ||
|
||
return _Function | ||
|
||
|
||
class TraceMode: | ||
"""Trace context used when tracing modules contains customer operators/Functions""" | ||
|
||
def __enter__(self): | ||
os.environ["JIT_TRACE"] = "True" | ||
return self | ||
|
||
def __exit__(self, exp_value, exp_type, trace): | ||
del os.environ["JIT_TRACE"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters