Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
restrain torch to 2.2.0 (#1508)
Browse files Browse the repository at this point in the history
Co-authored-by: Sun, Xuehao <[email protected]>
  • Loading branch information
VincyZhang and XuehaoSun authored Apr 24, 2024
1 parent e1f4666 commit 4fd914d
Show file tree
Hide file tree
Showing 112 changed files with 17,519 additions and 16,234 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ repos:
rev: v4.5.0
hooks:
- id: debug-statements
- id: mixed-line-ending
args: [--fix=lf]
- id: file-contents-sorter
files: |
(?x)^(
Expand Down
14 changes: 7 additions & 7 deletions docs/api_doc/optimization/optimizer.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PyTorch Optimizer
==============

.. autoapisummary::

intel_extension_for_transformers.transformers.optimizer.NoTrainerOptimizer
intel_extension_for_transformers.transformers.optimizer.Orchestrate_optimizer
PyTorch Optimizer
==============

.. autoapisummary::

intel_extension_for_transformers.transformers.optimizer.NoTrainerOptimizer
intel_extension_for_transformers.transformers.optimizer.Orchestrate_optimizer
10 changes: 5 additions & 5 deletions docs/api_doc/optimization/trainer.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Trainer
==============

.. autoapisummary::

Trainer
==============

.. autoapisummary::

intel_extension_for_transformers.transformers.trainer
74 changes: 37 additions & 37 deletions docs/build_docs/make.bat
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

#set SPHINXBUILD=sphinx-multiversion

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

#set SPHINXBUILD=sphinx-multiversion

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
138 changes: 69 additions & 69 deletions docs/build_docs/update_html.py
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
import os, sys
import glob

def find_index_path(index_file):
with open(index_file, "r") as f:
lines = f.readlines()
for line in lines:
pos = line.find('index.html" class="icon icon-home"')
if pos<0:
continue
pos1 = line.rfind("\"", 0, pos)
if pos1<0:
return ""
else:
return "../" + line[pos1+1: pos]
return "ignore"

def update_version_link(version, folder_name, index_file):
index_buf = ""
index_path = find_index_path(index_file)
if index_path=='ignore':
return

with open(index_file, "r") as f:
index_buf = f.read()
key_str=' <div class="version">\n {}\n </div>'.format(version)
version_list = '''<div class="version">
<a href="{}versions.html">{}▼</a>
<p>Click link above to switch version</p>
</div>'''.format(index_path, folder_name)
#print(index_buf.find(key_str))
index_buf = index_buf.replace(key_str, version_list)
#print(index_buf)

with open(index_file, "w") as f:
f.write(index_buf)


def update_source_url(version, folder_name, index_file):
if 'latest'!= folder_name:
return

base_url = "class=\"reference external\" href=\"https://github.com/intel/intel-extension-for-transformers/tree/{}/"
repo_url = base_url.format("v"+version)
target = base_url.format("master")
with open(index_file, "r") as f:
index_buf = f.read()
index_buf = index_buf.replace(repo_url, target)

with open(index_file, "w") as f:
f.write(index_buf)

def main(folder, version):
folder_name=os.path.basename(folder)
for index_file in glob.glob('{}/**/*.html'.format(folder),recursive = True):
update_version_link(version, folder_name, index_file)
update_source_url(version, folder_name, index_file)

def help(me):
print("python {} html_folder version".format(me))

if __name__=="__main__":
if len(sys.argv)<3:
help(sys.argv[0])
sys.exit(1)

folder = sys.argv[1]
version = sys.argv[2]
main(folder, version)
import os, sys
import glob

def find_index_path(index_file):
with open(index_file, "r") as f:
lines = f.readlines()
for line in lines:
pos = line.find('index.html" class="icon icon-home"')
if pos<0:
continue
pos1 = line.rfind("\"", 0, pos)
if pos1<0:
return ""
else:
return "../" + line[pos1+1: pos]
return "ignore"

def update_version_link(version, folder_name, index_file):
index_buf = ""
index_path = find_index_path(index_file)
if index_path=='ignore':
return

with open(index_file, "r") as f:
index_buf = f.read()
key_str=' <div class="version">\n {}\n </div>'.format(version)
version_list = '''<div class="version">
<a href="{}versions.html">{}▼</a>
<p>Click link above to switch version</p>
</div>'''.format(index_path, folder_name)
#print(index_buf.find(key_str))
index_buf = index_buf.replace(key_str, version_list)
#print(index_buf)

with open(index_file, "w") as f:
f.write(index_buf)


def update_source_url(version, folder_name, index_file):
if 'latest'!= folder_name:
return

base_url = "class=\"reference external\" href=\"https://github.com/intel/intel-extension-for-transformers/tree/{}/"
repo_url = base_url.format("v"+version)
target = base_url.format("master")
with open(index_file, "r") as f:
index_buf = f.read()
index_buf = index_buf.replace(repo_url, target)

with open(index_file, "w") as f:
f.write(index_buf)

def main(folder, version):
folder_name=os.path.basename(folder)
for index_file in glob.glob('{}/**/*.html'.format(folder),recursive = True):
update_version_link(version, folder_name, index_file)
update_source_url(version, folder_name, index_file)

def help(me):
print("python {} html_folder version".format(me))

if __name__=="__main__":
if len(sys.argv)<3:
help(sys.argv[0])
sys.exit(1)

folder = sys.argv[1]
version = sys.argv[2]
main(folder, version)
64 changes: 32 additions & 32 deletions docs/build_docs/update_version.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import os, sys


def main(folder, version):
folder_name=os.path.basename(folder)

version_file = "{}/versions.html".format(os.path.dirname(folder))
#print(version_file)
ver_buf = ""
with open(version_file, "r") as f:
ver_buf = f.read()
if ver_buf.find(version)>=0:
return
key_str = '<li><a href="latest">latest</a></li>'
new_ver = '''<li><a href="latest">latest</a></li>
<li><a href="{}">{}</a></li>'''.format(version, version)
ver_buf = ver_buf.replace(key_str, new_ver)

with open(version_file, "w") as f:
f.write(ver_buf)

def help(me):
print("python {} html_folder version".format(me))

if __name__=="__main__":
if len(sys.argv)<3:
help(sys.argv[0])
sys.exit(1)

folder = sys.argv[1]
version = sys.argv[2]
main(folder, version)
import os, sys


def main(folder, version):
folder_name=os.path.basename(folder)

version_file = "{}/versions.html".format(os.path.dirname(folder))
#print(version_file)
ver_buf = ""
with open(version_file, "r") as f:
ver_buf = f.read()
if ver_buf.find(version)>=0:
return
key_str = '<li><a href="latest">latest</a></li>'
new_ver = '''<li><a href="latest">latest</a></li>
<li><a href="{}">{}</a></li>'''.format(version, version)
ver_buf = ver_buf.replace(key_str, new_ver)

with open(version_file, "w") as f:
f.write(ver_buf)

def help(me):
print("python {} html_folder version".format(me))

if __name__=="__main__":
if len(sys.argv)<3:
help(sys.argv[0])
sys.exit(1)

folder = sys.argv[1]
version = sys.argv[2]
main(folder, version)
Loading

0 comments on commit 4fd914d

Please sign in to comment.