Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #1

Merged
merged 2 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.Logos {
display: inline;
margin: 1em;
max-width: 120px;
}

.install {
max-width: 800px;
}
.install .title {
display: inline-block;
min-width: 100px;
text-transform: uppercase;
font-size: 90%;
color: #555;
}

.install .option {
margin: 5px;
}

@media (max-width: 650px) {
.install .option, .install .title {
width: 90%;
}
.install .title {
margin-top: 1em;
}
42 changes: 42 additions & 0 deletions docs/_static/hidebib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// adapted from: http://www.robots.ox.ac.uk/~vedaldi/assets/hidebib.js
function hideallbibs()
{
var el = document.getElementsByTagName("div") ;
for (var i = 0 ; i < el.length ; ++i) {
if (el[i].className == "paper") {
var bib = el[i].getElementsByTagName("pre") ;
if (bib.length > 0) {
bib [0] .style.display = 'none' ;
}
}
}
}

function togglebib(paperid)
{
var paper = document.getElementById(paperid) ;
var bib = paper.getElementsByTagName('pre') ;
if (bib.length > 0) {
if (bib [0] .style.display == 'none') {
bib [0] .style.display = 'block' ;
} else {
bib [0] .style.display = 'none' ;
}
}
}

function toggleblock(blockId)
{
var block = document.getElementById(blockId);
if (block.style.display == 'none') {
block.style.display = 'block' ;
} else {
block.style.display = 'none' ;
}
}

function hideblock(blockId)
{
var block = document.getElementById(blockId);
block.style.display = 'none' ;
}
90 changes: 90 additions & 0 deletions docs/_static/install-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
$(document).ready(function () {

function label(lbl) {
return $.trim(lbl.replace(/[ .]/g, '-').replace('+-', '').toLowerCase());
}

// a hack: macos doesn't support cuda, so disable all cuda options when it
// is selected.
function disableCuda() {
$('.install .option').each(function(){
if (label($(this).text()).indexOf("cuda") != -1) {
$(this).addClass('disabled');
}
});
}
function enableCuda() {
$('.install .option').each(function(){
if (label($(this).text()).indexOf("cuda") != -1) {
$(this).removeClass('disabled');
}
});
}

// find the user os, and set the according option to active
function setActiveOSButton() {
var os = "linux"
var agent = window.navigator.userAgent.toLowerCase();
if (agent.indexOf("win") != -1) {
os = "windows"
} else if (agent.indexOf("mac") != -1) {
os = "macos"
}
if (os == "macos") {
disableCuda();
}
$('.install .option').each(function(){
if (label($(this).text()).indexOf(os) != -1) {
$(this).addClass('active');
}
});
}

setActiveOSButton();

// apply theme
function setTheme() {
$('.opt-group .option').each(function(){
$(this).addClass('mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--raised ');
$(this).attr('id', label($(this).text()));
});
$('.opt-group .active').each(function(){
$(this).addClass('mdl-button--colored');
});
}
setTheme();


// show the command according to the active options
function showCommand() {
$('.opt-group .option').each(function(){
$('.'+label($(this).text())).hide();
// console.log('disable '+label($(this).text()));
});
$('.opt-group .active').each(function(){
$('.'+label($(this).text())).show();
// console.log('enable '+label($(this).text()));
});
}
showCommand();

function setOptions() {
var el = $(this);
el.siblings().removeClass('active');
el.siblings().removeClass('mdl-button--colored');
el.addClass('active');
el.addClass('mdl-button--colored');
// console.log('enable'+el.text())
// console.log('disable'+el.siblings().text())
console.log($('.install #macos').hasClass('active') )
if ($('.install #macos').hasClass('active') == true) {
disableCuda();
} else {
enableCuda();
}
showCommand();
}

$('.opt-group').on('click', '.option', setOptions);

});
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
'primary_color': 'blue',
'accent_color': 'deep_orange',
'header_links' : [
('Install', 'install', False, ''),
('Install', 'install/install-more', False, ''),
('API', 'api/index', False, ''),
('Community', 'community/index', False, ''),
('Contribute', 'community/contribute', False, ''),
Expand Down Expand Up @@ -234,6 +234,9 @@ def setup(app):
}, True)
app.add_transform(AutoStructify)
app.add_javascript('google_analytics.js')
app.add_javascript('hidebib.js')
app.add_javascript('install-options.js')
app.add_stylesheet('custom.css')


sphinx_gallery_conf = {
Expand Down
34 changes: 1 addition & 33 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,7 @@ computes the cosine similarity between two words.
And more in :doc:`tutorials <examples/index>`.


Installation
------------

GluonNLP relies on the recent version of MXNet. The easiest way to install MXNet
is through `pip <https://pip.pypa.io/en/stable/installing/>`_. The following
command installs the latest version of MXNet.

.. code-block:: console

pip install --upgrade mxnet>=1.5.0

.. note::

There are other pre-build MXNet packages that enable GPU supports and
accelerate CPU performance, please refer to `this page
<http://beta.mxnet.io/install.html>`_ for details. Some
training scripts are recommended to run on GPUs, if you don't have a GPU
machine at hand, you may consider `running on AWS
<http://d2l.ai/chapter_appendix/aws.html>`_.


After installing MXNet, you can install the GluonNLP toolkit by

.. code-block:: console

pip install gluonnlp


.. hint::

For more detailed guide on installing pre-release from latest master branch,
install from local copy of GluonNLP source code, etc.,
click the :doc:`install <install>` link in the top navigation bar.
.. include:: install.rst


About GluonNLP
Expand Down
82 changes: 10 additions & 72 deletions docs/install.rst
Original file line number Diff line number Diff line change
@@ -1,80 +1,18 @@
:orphan:

Installation
~~~~~~~~~~~~

GluonNLP relies on the recent version of MXNet. The easiest way to install MXNet
is through `pip <https://pip.pypa.io/en/stable/installing/>`_. The following
command installs the latest version of MXNet.

.. code-block:: console

pip install --upgrade mxnet>=1.5.0

.. note::

There are other pre-build MXNet packages that enable GPU supports and
accelerate CPU performance, please refer to `this page
<http://beta.mxnet.io/install.html>`_ for details. Some
training scripts are recommended to run on GPUs, if you don't have a GPU
machine at hand, you may consider `running on AWS
<http://d2l.ai/chapter_appendix/aws.html>`_.


After installing MXNet, you can install the GluonNLP toolkit by

.. code-block:: console

pip install gluonnlp


Install from Master Branch
~~~~~~~~~~~~~~~~~~~~~~~~~~

If you are interested in trying out features on master branch that hasn't been released yet,
you have the option of installing from master branch directly.


Install from GitHub
+++++++++++++++++++

Use the following command to automatically download and install the current code on master branch:

.. code-block:: console

pip install https://github.com/dmlc/gluon-nlp/tarball/master


Install from Source Code
++++++++++++++++++++++++

You can also first check out the code locally using Git:

.. code-block:: console

git clone https://github.com/dmlc/gluon-nlp
cd gluon-nlp

then use the provided `setup.py` to install into site-packages:

.. code-block:: console

python setup.py install


.. note::
------------

You may need to use `sudo` in case you run into permission denied error.
.. Ignore prerequisites to make the index page concise, which will be shown at
the install page

.. raw:: html

Alternatively, you can set up the package with development mode, so that local changes are
immediately reflected in the installed python package
<style>.admonition-prerequisite {display: none;}</style>

.. code-block:: console
.. include:: install/install-include.rst

python setup.py develop
.. raw:: html

.. note::
<style>.disabled { display: none; }</style>
<script type="text/javascript" src='_static/install-options.js'></script>

The master branch may rely on MXNet nightly builds which are available on PyPI,
please refer to `this page <http://beta.mxnet.io/install.html>`_ for installation guide.
Check :doc:`install/install-more` for more installation instructions and options.
Loading