From eec2b8deb6b1fc66e9abed68b4771d2bc2e910d6 Mon Sep 17 00:00:00 2001 From: Joel Marcey Date: Fri, 28 Sep 2018 17:26:32 -0700 Subject: [PATCH 1/4] Add libtorch to selector I made libtorch and C++ selection mutually inclusive. You select one, the other is selected. You deselect one, the other is deselected. --- _includes/quick_start_local.html | 36 ++++++---- _sass/get-started.scss | 2 +- _sass/quick-start-module.scss | 19 ++++- assets/quick-start-module.js | 119 +++++++++++++++++++++++++++++-- 4 files changed, 152 insertions(+), 24 deletions(-) diff --git a/_includes/quick_start_local.html b/_includes/quick_start_local.html index 45e02c645bde..60db0f65018b 100644 --- a/_includes/quick_start_local.html +++ b/_includes/quick_start_local.html @@ -1,6 +1,6 @@

Select your preferences and run the install command. Please ensure that you are on the latest pip and numpy packages. Anaconda is our recommended package manager. You can also - install previous versions of PyTorch. + install previous versions of PyTorch. Note that libtorch is only available for C++.

@@ -15,7 +15,7 @@
Package
-
Python
+
Language
CUDA
@@ -55,31 +55,37 @@
Package
-
+
Conda
-
+
Pip
-
+
+
libtorch
+
+
Source
-
+
-
Python
+
Language
+
+
+
Python 2.7
-
-
2.7
+
+
Python 3.5
-
-
3.5
+
+
Python 3.6
-
-
3.6
+
+
Python 3.7
-
-
3.7
+
+
C++
diff --git a/_sass/get-started.scss b/_sass/get-started.scss index 2559b31830c4..3db4ba2ad57b 100644 --- a/_sass/get-started.scss +++ b/_sass/get-started.scss @@ -167,7 +167,7 @@ .row.ptbuild, .row.os, .row.package, - .row.python, + .row.language, .row.cuda { margin-bottom: rem(20px); @include desktop { diff --git a/_sass/quick-start-module.scss b/_sass/quick-start-module.scss index 5d1acd87913d..279e03ff76e3 100644 --- a/_sass/quick-start-module.scss +++ b/_sass/quick-start-module.scss @@ -1,12 +1,29 @@ .quick-starts { background: $light_grey; + .col-md-2-4 { + position: relative; + width: 100%; + min-height: 1px; + padding-right: 15px; + padding-left: 15px; + } + + @media (min-width: 768px) { + .col-md-2-4 { + -webkit-box-flex: 0; + -ms-flex: 0 0 20%; + flex: 0 0 20%; + max-width: 20%; + } + } + .start-locally-col { margin-bottom: rem(20px); .row.ptbuild, .row.os, .row.package, - .row.python, + .row.language, .row.cuda { margin-bottom: rem(20px); @include desktop { diff --git a/assets/quick-start-module.js b/assets/quick-start-module.js index 9c30a77997c1..732b35ed6f59 100644 --- a/assets/quick-start-module.js +++ b/assets/quick-start-module.js @@ -9,7 +9,7 @@ var opts = { cuda: 'cuda9.0', os: getAnchorSelectedOS() || getDefaultSelectedOS(), pm: 'conda', - python: 'python3.6', + language: 'python3.6', ptbuild: 'stable', }; @@ -21,7 +21,7 @@ var supportedCloudPlatforms = [ var os = $(".os > .option"); var package = $(".package > .option"); -var python = $(".python > .option"); +var language = $(".language > .option"); var cuda = $(".cuda > .option"); var ptbuild = $(".ptbuild > .option"); @@ -31,8 +31,8 @@ os.on("click", function() { package.on("click", function() { selectedOption(package, this, "pm"); }); -python.on("click", function() { - selectedOption(python, this, "python"); +language.on("click", function() { + selectedOption(language, this, "language"); }); cuda.on("click", function() { selectedOption(cuda, this, "cuda"); @@ -43,7 +43,7 @@ ptbuild.on("click", function() { // Force a selection onclick to get the right operating system selected from // the start -$( document ).ready(function() { +$(document).ready(function() { document.getElementById(opts.os).click(); }); @@ -82,6 +82,39 @@ function selectedOption(option, selection, category) { $(option).removeClass("selected"); $(selection).addClass("selected"); opts[category] = selection.id; + if (category === "pm") { + var elements = document.getElementsByClassName("language")[0].children; + if (selection.id !== "libtorch" && elements["cplusplus"].classList.contains("selected")) { + $(elements["cplusplus"]).removeClass("selected"); + $(elements["python3.7"]).addClass("selected"); + opts["language"] = "python3.7"; + } else if (selection.id == "libtorch") { + for (var i = 0; i < elements.length; i++) { + if (elements[i].id === "cplusplus") { + $(elements[i]).addClass("selected"); + opts["language"] = "cplusplus"; + } else { + $(elements[i]).removeClass("selected"); + } + } + } + } else if (category === "language") { + var elements = document.getElementsByClassName("package")[0].children; + if (selection.id !== "cplusplus" && elements["libtorch"].classList.contains("selected")) { + $(elements["libtorch"]).removeClass("selected"); + $(elements["pip"]).addClass("selected"); + opts["pm"] = "pip"; + } else if (selection.id == "cplusplus") { + for (var i = 0; i < elements.length; i++) { + if (elements[i].id === "libtorch") { + $(elements[i]).addClass("selected"); + opts["pm"] = "libtorch"; + } else { + $(elements[i]).removeClass("selected"); + } + } + } + } commandMessage(buildMatcher()); if (category === "os") { display(opts.os, 'installation', 'os'); @@ -114,7 +147,7 @@ function buildMatcher() { "," + opts.cuda.toLowerCase() + "," + - opts.python.toLowerCase() + opts.language.toLowerCase() ); } @@ -418,6 +451,42 @@ function commandMessage(key) { "stable,pip,windows,cuda9.2,python3.7": "pip3 install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision", + "stable,libtorch,linux,cudanone,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,linux,cuda8,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,linux,cuda9.0,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,linux,cuda9.2,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,macos,cudanone,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,macos,cuda8,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,macos,cuda9.0,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,macos,cuda9.2,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,windows,cudanone,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,windows,cuda8,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,windows,cuda9.0,cplusplus": + "# Currently only available as a Preview.", + + "stable,libtorch,windows,cuda9.2,cplusplus": + "# Currently only available as a Preview.", + "preview,conda,linux,cuda8,python2.7": "conda install pytorch-nightly -c pytorch", @@ -704,7 +773,43 @@ function commandMessage(key) { "# Preview Build Not Yet Available on Windows.", "preview,pip,windows,cuda9.2,python3.7": - "# Preview Build Not Yet Available on Windows." + "# Preview Build Not Yet Available on Windows.", + + "preview,libtorch,linux,cudanone,cplusplus": + "Download here.", + + "preview,libtorch,linux,cuda8,cplusplus": + "Download here.", + + "preview,libtorch,linux,cuda9.0,cplusplus": + "Download here.", + + "preview,libtorch,linux,cuda9.2,cplusplus": + "Download here.", + + "preview,libtorch,macos,cudanone,cplusplus": + "Download here.", + + "preview,libtorch,macos,cuda8,cplusplus": + "# Currently only available CPU-only / no CUDA.", + + "preview,libtorch,macos,cuda9.0,cplusplus": + "# Currently only available CPU-only / no CUDA.", + + "preview,libtorch,macos,cuda9.2,cplusplus": + "# Currently only available CPU-only / no CUDA.", + + "preview,libtorch,windows,cudanone,cplusplus": + "# Not currently available on Windows.", + + "preview,libtorch,windows,cuda8,cplusplus": + "# Not currently available on Windows.", + + "preview,libtorch,windows,cuda9.0,cplusplus": + "# Not currently available on Windows.", + + "preview,libtorch,windows,cuda9.2,cplusplus": + "# Not currently available on Windows.", }; if (!object.hasOwnProperty(key)) { From 32cb89300849527dd17ab333ee9786891e0b4b3f Mon Sep 17 00:00:00 2001 From: Joel Marcey Date: Mon, 1 Oct 2018 08:26:46 -0700 Subject: [PATCH 2/4] s/libtorch/LibTorch for visible text --- _includes/quick_start_local.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/quick_start_local.html b/_includes/quick_start_local.html index 60db0f65018b..76b851e5cf1f 100644 --- a/_includes/quick_start_local.html +++ b/_includes/quick_start_local.html @@ -1,6 +1,6 @@

Select your preferences and run the install command. Please ensure that you are on the latest pip and numpy packages. Anaconda is our recommended package manager. You can also - install previous versions of PyTorch. Note that libtorch is only available for C++. + install previous versions of PyTorch. Note that LibTorch is only available for C++.

@@ -62,7 +62,7 @@
Pip
-
libtorch
+
LibTorch
Source
From 704dfa1da716044f61d6fcdfd81067697e2c425d Mon Sep 17 00:00:00 2001 From: Joel Marcey Date: Mon, 1 Oct 2018 08:52:48 -0700 Subject: [PATCH 3/4] Explicit download links --- assets/quick-start-module.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/quick-start-module.js b/assets/quick-start-module.js index 732b35ed6f59..52926869738d 100644 --- a/assets/quick-start-module.js +++ b/assets/quick-start-module.js @@ -776,19 +776,19 @@ function commandMessage(key) { "# Preview Build Not Yet Available on Windows.", "preview,libtorch,linux,cudanone,cplusplus": - "Download here.", + "Download here: https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip.", "preview,libtorch,linux,cuda8,cplusplus": - "Download here.", + "Download here: https://download.pytorch.org/libtorch/nightly/cu80/libtorch-shared-with-deps-latest.zip.", "preview,libtorch,linux,cuda9.0,cplusplus": - "Download here.", + "Download here: https://download.pytorch.org/libtorch/nightly/cu90/libtorch-shared-with-deps-latest.zip.", "preview,libtorch,linux,cuda9.2,cplusplus": - "Download here.", + "Download here: https://download.pytorch.org/libtorch/nightly/cu9.2/libtorch-shared-with-deps-latest.zip.", "preview,libtorch,macos,cudanone,cplusplus": - "Download here.", + "Download here: https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip.", "preview,libtorch,macos,cuda8,cplusplus": "# Currently only available CPU-only / no CUDA.", From 2206af55a40764cafeca48bf8e0f4442eb408af1 Mon Sep 17 00:00:00 2001 From: Joel Marcey Date: Mon, 1 Oct 2018 08:56:45 -0700 Subject: [PATCH 4/4] Select Preview if libtorch or C++ selected --- assets/quick-start-module.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/assets/quick-start-module.js b/assets/quick-start-module.js index 52926869738d..bca3f8454da8 100644 --- a/assets/quick-start-module.js +++ b/assets/quick-start-module.js @@ -96,6 +96,9 @@ function selectedOption(option, selection, category) { } else { $(elements[i]).removeClass("selected"); } + $(document.getElementsByClassName("ptbuild")[0].children["stable"]).removeClass("selected"); + $(document.getElementsByClassName("ptbuild")[0].children["preview"]).addClass("selected"); + opts["ptbuild"] = "preview"; } } } else if (category === "language") { @@ -112,6 +115,9 @@ function selectedOption(option, selection, category) { } else { $(elements[i]).removeClass("selected"); } + $(document.getElementsByClassName("ptbuild")[0].children["stable"]).removeClass("selected"); + $(document.getElementsByClassName("ptbuild")[0].children["preview"]).addClass("selected"); + opts["ptbuild"] = "preview"; } } } @@ -776,19 +782,19 @@ function commandMessage(key) { "# Preview Build Not Yet Available on Windows.", "preview,libtorch,linux,cudanone,cplusplus": - "Download here: https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip.", + "Download here: https://download.pytorch.org/libtorch/nightly/cpu/libtorch-shared-with-deps-latest.zip", "preview,libtorch,linux,cuda8,cplusplus": - "Download here: https://download.pytorch.org/libtorch/nightly/cu80/libtorch-shared-with-deps-latest.zip.", + "Download here: https://download.pytorch.org/libtorch/nightly/cu80/libtorch-shared-with-deps-latest.zip", "preview,libtorch,linux,cuda9.0,cplusplus": - "Download here: https://download.pytorch.org/libtorch/nightly/cu90/libtorch-shared-with-deps-latest.zip.", + "Download here: https://download.pytorch.org/libtorch/nightly/cu90/libtorch-shared-with-deps-latest.zip", "preview,libtorch,linux,cuda9.2,cplusplus": - "Download here: https://download.pytorch.org/libtorch/nightly/cu9.2/libtorch-shared-with-deps-latest.zip.", + "Download here: https://download.pytorch.org/libtorch/nightly/cu9.2/libtorch-shared-with-deps-latest.zip", "preview,libtorch,macos,cudanone,cplusplus": - "Download here: https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip.", + "Download here: https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-latest.zip", "preview,libtorch,macos,cuda8,cplusplus": "# Currently only available CPU-only / no CUDA.",