Skip to content

Commit

Permalink
npx.save -> npx.savez (dmlc#1441)
Browse files Browse the repository at this point in the history
* npx.save -> npx.savez

* Update builds

* Fix wikiextractor version

Co-authored-by: Xingjian Shi <[email protected]>
  • Loading branch information
leezu and sxjscience authored Nov 29, 2020
1 parent f5c5b73 commit cd669eb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ First of all, install the latest MXNet. You may use the following commands:

```bash
# Install the version with CUDA 10.0
python3 -m pip install -U --pre "mxnet-cu100>=2.0.0b20201101" -f https://dist.mxnet.io/python
python3 -m pip install -U --pre "mxnet-cu100>=2.0.0b20201121" -f https://dist.mxnet.io/python

# Install the version with CUDA 10.1
python3 -m pip install -U --pre "mxnet-cu101>=2.0.0b20201101" -f https://dist.mxnet.io/python
python3 -m pip install -U --pre "mxnet-cu101>=2.0.0b20201121" -f https://dist.mxnet.io/python

# Install the version with CUDA 10.2
python3 -m pip install -U --pre "mxnet-cu102>=2.0.0b20201101" -f https://dist.mxnet.io/python
python3 -m pip install -U --pre "mxnet-cu102>=2.0.0b20201121" -f https://dist.mxnet.io/python

# Install the version with CUDA 11
python3 -m pip install -U --pre "mxnet-cu110>=2.0.0b20201101" -f https://dist.mxnet.io/python
python3 -m pip install -U --pre "mxnet-cu110>=2.0.0b20201121" -f https://dist.mxnet.io/python

# Install the cpu-only version
python3 -m pip install -U --pre "mxnet>=2.0.0b20201101" -f https://dist.mxnet.io/python
python3 -m pip install -U --pre "mxnet>=2.0.0b20201121" -f https://dist.mxnet.io/python
```


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def find_version(*file_paths):
'nltk',
'h5py>=2.10',
'scipy',
'wikiextractor',
'wikiextractor<3.0.0',
'tqdm'
],
'dev': [
Expand Down
9 changes: 4 additions & 5 deletions src/gluonnlp/cli/average_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ def get_parser():
'--checkpoints folder/epoch*.params or --checkpoints folder/update*.param')
parser.add_argument('--begin', type=int, required=True, help='begin number of checkpoints')
parser.add_argument('--end', type=int, required=True, help='end number of checkpoints')
parser.add_argument('--save-path', type=str, required=True,
help='Path of the output file')
parser.add_argument('--save-path', type=str, required=True, help='Path of the output file')
return parser


def main(args):
assert args.begin >= 0
assert args.end >= args.begin
args.range = list(range(args.begin, args.end + 1))

ckpt_epochs_regexp = re.compile(r'(.*\/)?epoch(\d+)\.params')
ckpt_updates_regexp = re.compile(r'(.*\/)?update(\d+)\.params')
ckpt_path = args.checkpoints[0]
Expand All @@ -31,7 +30,7 @@ def main(args):
ckpt_regexp = ckpt_updates_regexp
else:
raise Exception('Wrong checkpoints path format: {}'.format(ckpt_path))

ckpt_paths = []
for path in args.checkpoints:
m = ckpt_regexp.fullmatch(path)
Expand All @@ -50,7 +49,7 @@ def main(args):
res[key] += ckpt[key]
for key in keys:
res[key] /= len(ckpt_paths)
mx.npx.save(args.save_path, res)
mx.npx.savez(args.save_path, **res)


def cli_main():
Expand Down
4 changes: 2 additions & 2 deletions tools/docker/gluon_nlp_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ git fetch origin $SOURCE_REF:working
git checkout working

if [ $DEVICE == "cpu" ]; then
python3 -m pip install -U --quiet --pre "mxnet>=2.0.0b20201029" -f https://dist.mxnet.io/python --user
python3 -m pip install -U --quiet --pre "mxnet>=2.0.0b20201121" -f https://dist.mxnet.io/python --user
else
# Due to the issue in https://forums.aws.amazon.com/thread.jspa?messageID=953912
# We need to manually configure the shm to ensure that Horovod is runnable.
# The reason that we need a larger shm is described in https://github.com/NVIDIA/nccl/issues/290
umount shm
mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=2G shm /dev/shm
sudo python3 -m pip uninstall --quiet mxnet-cu102
python3 -m pip install -U --quiet --pre "mxnet-cu102>=2.0.0b20201105" -f https://dist.mxnet.io/python/cu102 --user
python3 -m pip install -U --quiet --pre "mxnet-cu102>=2.0.0b20201121" -f https://dist.mxnet.io/python/cu102 --user
fi

python3 -m pip install --quiet -e .[extras]
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/ubuntu18.04-cpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN bash /install/install_python_packages.sh
RUN bash /install/install_tvm_cpu.sh

# Install MXNet
RUN python3 -m pip install -U --pre "mxnet>=2.0.0b20201022" -f https://dist.mxnet.io/python --user
RUN python3 -m pip install -U --pre "mxnet>=2.0.0b20201121" -f https://dist.mxnet.io/python --user

# Install PyTorch
RUN python3 -m pip install -U torch torchvision --user
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/ubuntu18.04-gpu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN bash /install/install_python_packages.sh
RUN bash /install/install_tvm_gpu.sh

# Install MXNet
RUN python3 -m pip install -U --pre "mxnet-cu102>=2.0.0b20201104" -f https://dist.mxnet.io/python --user
RUN python3 -m pip install -U --pre "mxnet-cu102>=2.0.0b20201121" -f https://dist.mxnet.io/python --user

# Install PyTorch
RUN python3 -m pip install -U torch torchvision --user
Expand Down

0 comments on commit cd669eb

Please sign in to comment.