Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
ac9702c2
Unverified
Commit
ac9702c2
authored
Aug 25, 2020
by
Funtowicz Morgan
Committed by
GitHub
Aug 25, 2020
Browse files
Fix ONNX test_quantize unittest (#6716)
parent
07434033
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
24 deletions
+22
-24
.github/workflows/self-push.yml
.github/workflows/self-push.yml
+1
-1
.github/workflows/self-scheduled.yml
.github/workflows/self-scheduled.yml
+1
-1
setup.py
setup.py
+3
-2
src/transformers/convert_graph_to_onnx.py
src/transformers/convert_graph_to_onnx.py
+17
-20
No files found.
.github/workflows/self-push.yml
View file @
ac9702c2
...
...
@@ -45,7 +45,7 @@ jobs:
source .env/bin/activate
pip install --upgrade pip
pip install torch!=1.6.0
pip install .[sklearn,testing]
pip install .[sklearn,testing
,onnxruntime
]
-
name
:
Are GPUs recognized by our DL frameworks
run
:
|
...
...
.github/workflows/self-scheduled.yml
View file @
ac9702c2
...
...
@@ -42,7 +42,7 @@ jobs:
source .env/bin/activate
pip install --upgrade pip
pip install torch!=1.6.0
pip install .[sklearn,testing]
pip install .[sklearn,testing
,onnxruntime
]
-
name
:
Are GPUs recognized by our DL frameworks
run
:
|
...
...
setup.py
View file @
ac9702c2
...
...
@@ -74,16 +74,17 @@ extras["tf"] = [
# "onnxconverter-common",
# "keras2onnx"
"onnxconverter-common @ git+git://github.com/microsoft/onnxconverter-common.git@f64ca15989b6dc95a1f3507ff6e4c395ba12dff5#egg=onnxconverter-common"
,
"keras2onnx @ git+git://github.com/onnx/keras-onnx.git@cbdc75cb950b16db7f0a67be96a278f8d2953b48#egg=keras2onnx"
"keras2onnx @ git+git://github.com/onnx/keras-onnx.git@cbdc75cb950b16db7f0a67be96a278f8d2953b48#egg=keras2onnx"
,
]
extras
[
"tf-cpu"
]
=
[
"tensorflow-cpu"
,
# "onnxconverter-common",
# "keras2onnx"
"onnxconverter-common @ git+git://github.com/microsoft/onnxconverter-common.git@f64ca15989b6dc95a1f3507ff6e4c395ba12dff5#egg=onnxconverter-common"
,
"keras2onnx @ git+git://github.com/onnx/keras-onnx.git@cbdc75cb950b16db7f0a67be96a278f8d2953b48#egg=keras2onnx"
"keras2onnx @ git+git://github.com/onnx/keras-onnx.git@cbdc75cb950b16db7f0a67be96a278f8d2953b48#egg=keras2onnx"
,
]
extras
[
"torch"
]
=
[
"torch"
]
extras
[
"onnxruntime"
]
=
[
"onnxruntime>=1.4.0"
,
"onnxruntime-tools>=1.4.2"
]
extras
[
"serving"
]
=
[
"pydantic"
,
"uvicorn"
,
"fastapi"
,
"starlette"
]
extras
[
"all"
]
=
extras
[
"serving"
]
+
[
"tensorflow"
,
"torch"
]
...
...
src/transformers/convert_graph_to_onnx.py
View file @
ac9702c2
...
...
@@ -364,7 +364,6 @@ def quantize(onnx_model_path: Path) -> Path:
Returns: The Path generated for the quantized
"""
try
:
import
onnx
from
onnxruntime.quantization
import
QuantizationMode
,
quantize
...
...
@@ -388,8 +387,6 @@ def quantize(onnx_model_path: Path) -> Path:
onnx
.
save_model
(
quantized_model
,
quantized_model_path
.
as_posix
())
return
quantized_model_path
except
Exception
as
ie
:
print
(
f
"Error while quantizing the model:
\n
{
str
(
ie
)
}
"
)
def
verify
(
path
:
Path
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment