mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Use lxml in scripts/compile_tests when it is available (#120633)
It's around 30x (300s -> 10s) faster. Pull Request resolved: https://github.com/pytorch/pytorch/pull/120633 Approved by: https://github.com/oulgen
This commit is contained in:
parent
5a0a964444
commit
7b1cc140aa
|
|
@ -1,6 +1,19 @@
|
|||
import functools
|
||||
import os
|
||||
import xml.etree.ElementTree as ET
|
||||
import warnings
|
||||
|
||||
try:
|
||||
import lxml.etree
|
||||
|
||||
p = lxml.etree.XMLParser(huge_tree=True)
|
||||
parse = functools.partial(lxml.etree.parse, parser=p)
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
parse = ET.parse
|
||||
warnings.warn(
|
||||
"lxml was not found. `pip install lxml` to make this script run much faster"
|
||||
)
|
||||
from download_reports import download_reports
|
||||
|
||||
|
||||
|
|
@ -9,7 +22,7 @@ def open_test_results(directory):
|
|||
for root, _, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.endswith(".xml"):
|
||||
tree = ET.parse(f"{root}/{file}")
|
||||
tree = parse(f"{root}/{file}")
|
||||
xmls.append(tree)
|
||||
return xmls
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ import sys
|
|||
# see scripts/compile_tests/update_failures.py
|
||||
#
|
||||
# If you're adding a new test, and it's failing PYTORCH_TEST_WITH_DYNAMO=1,
|
||||
# either add the appropriate decorators to your test or list them in this file.
|
||||
# either add the appropriate decorators to your test or add skips for them
|
||||
# via test/dynamo_skips and test/dynamo_expected_failures.
|
||||
#
|
||||
# *These are not exactly unittest.expectedFailure and unittest.skip. We'll
|
||||
# always execute the test and then suppress the signal, if necessary.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user