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

[MRG] Data/model storage. Fix 1453 #1705

Merged
merged 40 commits into from
Nov 14, 2017
Merged

[MRG] Data/model storage. Fix 1453 #1705

merged 40 commits into from
Nov 14, 2017

Conversation

menshikh-iv
Copy link
Contributor

Based on #1453.
What's done:

  • Docstrings (fixed mistakes, added examples, etc)
  • Removed --catalogue (instead of this used --info, similar to python API)
  • Renaming / style fixes
  • Remove unpacking (now we save much HDD space)



def load(name, return_path=False):
"""Download (if needed) dataset/model and load it to memory (managed by return_path).
Copy link
Owner

Choose a reason for hiding this comment

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

"managed by return_path" doesn't sound correct. Do you mean "unless return_path is set"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's true.

_create_base_dir()
file_name = _get_filename(name)
if file_name is None:
raise Exception(
Copy link
Owner

Choose a reason for hiding this comment

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

Exception too generic. This looks like a ValueError.

folder_dir = os.path.join(base_dir, name)
path = os.path.join(folder_dir, file_name)
if not os.path.exists(folder_dir):
_download(name)
Copy link
Owner

Choose a reason for hiding this comment

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

Any way to "force" a download? (fix previously broken / partial / deleted downloads etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This situation doesn't happen (because data moved from /tmp/.. to ~/gensim-data after downloading needed files + checking md5). For this reason, we don't add this key (if something happens - run load again.

else:
sys.path.insert(0, base_dir)
module = __import__(name)
return module.load_data()
Copy link
Owner

@piskvorky piskvorky Nov 10, 2017

Choose a reason for hiding this comment

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

Where do I find this load_data function? For example for Wikipedia (json-line format from segment_wiki), and for text8?

I got a bit lost in the import magic, and there are no comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@menshikh-iv
Copy link
Contributor Author

menshikh-iv commented Nov 13, 2017

Need to add the last feature:

  • possibility to use another list.json, it's very needed for me for very accurate adding the new things to gensim-data (for now, I must commit to master, it's OK now, but its horribly after release, it can produce "race-condition").

The process must look like this:

  • add the model to release page
  • create PR with an updated list.json (new name, hashes and so on).
  • check that all download/load correctly
  • merge PR -> new model is available for all users.

@menshikh-iv menshikh-iv merged commit f99612d into develop Nov 14, 2017
@menshikh-iv menshikh-iv deleted the datamodel branch November 14, 2017 08:31
This was referenced Nov 14, 2017
VaiyeBe pushed a commit to VaiyeBe/gensim that referenced this pull request Nov 26, 2017
* added download and catalogue functions

* added link and info

* modeified link and info functions

* Updated download function

* Added logging

* Added load function

* Removed unused imports

* added check for installed models

* updated download function

* Improved help for terminal

* load returns model path

* added jupyter notebook and merged code

* alternate names for load

* corrected formatting

* added checksum after download

* refactored code

* removed log file code

* added progressbar

* fixed pep8

* added tests

* added download for >2gb data

* add test for multipart

* fixed pep8

* remove tar.gz, use only .gz for all

* fix codestyle/docstrings[1]

* add module docstring

* add downloader to apiref

* Fix CLI + more documentation

* documentation for load

* renaming

* fix tests

* fix tests[2]

* add test for info

* reduce logging

* Add return_path=True example to docstring

* fix

* update & rename notebook

* Fix docstring + use ValueError when name is incorrect

* move list to global var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants