Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

use python to download and unzip files instead of wget, unzip command#2325

Closed
CharlesMei wants to merge 1 commit intoapache:masterfrom
CharlesMei:master
Closed

use python to download and unzip files instead of wget, unzip command#2325
CharlesMei wants to merge 1 commit intoapache:masterfrom
CharlesMei:master

Conversation

@CharlesMei
Copy link

this fixes #2237 #1559, for windows user, it is not convenient to use wget, mkdir, unzip like linux user.
we can use pure python code to download and unzip dataset, which works for both windows, linux/unix.

elif sys.version_info.major == 3:
from urllib.request import urlretrieve
urlretrieve(url, 'cifar10.zip')
import zipfile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is zipfile available by default?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, zipfile is in python standard library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed. It works on Python 2.7.10 and 3.5.1

On Sat, Jun 4, 2016 at 2:53 AM, CharlesMei notifications@github.com wrote:

In example/image-classification/train_cifar10.py
#2325 (comment):

 os.chdir(data_dir)
 if (not os.path.exists('train.rec')) or \
    (not os.path.exists('test.rec')) :
  •    os.system("wget http://webdocs.cs.ualberta.ca/~bx3/data/cifar10.zip")
    
  •    os.system("unzip -u cifar10.zip")
    
  •    os.system("mv cifar/\* .; rm -rf cifar; rm cifar10.zip")
    
  •    url = 'http://webdocs.cs.ualberta.ca/~bx3/data/cifar10.zip'
    
  •    if sys.version_info.major == 2:
    
  •        from urllib import urlretrieve
    
  •    elif sys.version_info.major == 3:
    
  •        from urllib.request import urlretrieve
    
  •    urlretrieve(url, 'cifar10.zip')
    
  •    import zipfile
    

Yes, zipfile is in python standard library.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dmlc/mxnet/pull/2325/files/ce5b4b9f8f789db8cb6799de341726d60ce3caa1#r65758312,
or mute the thread
https://github.com/notifications/unsubscribe/ABFI4WfsBu9cFwBt8TuOMteeMFXLep6wks5qIHhBgaJpZM4ItTgY
.

HONG Chuntao
System Research Group
Microsoft Research Asia

@piiswrong
Copy link
Contributor

@hjk41 Could you verify thsi?

@piiswrong
Copy link
Contributor

piiswrong commented Jun 6, 2016

LGTM. Please rebase and merge

@piiswrong
Copy link
Contributor

There seems to be a lot of new changes. Could you explain them?

@thirdwing Seems to be about R package

@thirdwing
Copy link
Contributor

It is from #2329

All the commits in that PR have been squashed into one commit.

@CharlesMei
Copy link
Author

CharlesMei commented Jun 8, 2016

I'm sorry, i'm not familiar with git to do this. I think i may need to learn more about git. Can you help me?

@piiswrong
Copy link
Contributor

try
git origin add upstream https://github.com/dmlc/mxnet.git
git fetch upstream
git rebase upstream/master

@tqchen
Copy link
Member

tqchen commented Jun 9, 2016

another simpler way might be simply keep your changes and start from a clean fork

@CharlesMei
Copy link
Author

@piiswrong, thank you , but because of my former mistakes, my master has changed, i'm afraid there may be something wrong to just do this now.

@CharlesMei
Copy link
Author

@tqchen do you mean remove my master branch, and rebase my dev on upstream

@sxjscience
Copy link
Member

sxjscience commented Jun 11, 2016

@CharlesMei Try the method here http://eli.thegreenplace.net/2014/02/19/squashing-github-pull-requests-into-a-single-commit . You can, for example, use git rebase -i dmlc/master

@sxjscience
Copy link
Member

@CharlesMei You need to update the submodules.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

关于windows的预编译版本。

6 participants