Skip to content

Commit

Permalink
update installation instructions, fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
goru001 committed Nov 10, 2019
1 parent 104d3e0 commit d603def
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,17 @@ that an application developer might need for Indic languages.
### Installation on Linux

```bash
pip install http://download.pytorch.org/whl/cpu/torch-1.0.0-cp36-cp36m-linux_x86_64.whl
pip install torch==1.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install inltk
```

### Installation on Windows 10 (experimental)
```bash
pip install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp36-cp36m-win_amd64.whl
pip install inltk
```
Note: Just make sure to pick the correct torch wheel url, according to the needed
platform and python version, which you will find [here](https://pytorch.org/get-started/locally/#pip-1).

iNLTK runs on CPU, as is the desired behaviour for most
of the Deep Learning models in production.

The first command above will install pytorch-cpu, which, as the name suggests,
does not have cuda support.
The first command above will install pytorch for cpu, which, as the name suggests, does not have cuda support.

`Note: inltk is currently supported only on Linux and Windows 10 with Python >= 3.6`

Expand Down Expand Up @@ -166,7 +162,7 @@ Example:
```
`get_sentence_encoding` returns 400 dimensional encoding of the sentence from
ULMFiT LM Encoder trained in repositories linked below.
ULMFiT LM Encoder of `<code-of-language>` trained in repositories linked below.
**Get Sentence Similarity**
Expand Down Expand Up @@ -257,6 +253,6 @@ and [Maithili](https://github.com/goru001/inltk/issues/10) support
* iNLTK was [trending on GitHub](https://github.motakasoft.com/trending/ranking/monthly/?d=2019-05-01&l=python&page=2) in May 2019
* iNLTK has had [17,000+ Downloads](
https://console.cloud.google.com/bigquery?sq=375816891401:185fda81bdc64eb79b98c6b28c77a62a
) till Nov, 2019
) till Nov 2019
4 changes: 2 additions & 2 deletions inltk/download_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
async def download_file(url, dest, fname):
if (dest/f'{fname}').exists(): return False
os.makedirs(dest, exist_ok=True)
print('Downloading Model... This might take time, depending on your internet connection! Please have patience!'
'Don\'t worry, we\'ll only do this for the first time :)')
print('Downloading Model. This might take time, depending on your internet connection. Please be patient.\n'
'We\'ll only do this for the first time.')
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
data = await response.read()
Expand Down
6 changes: 2 additions & 4 deletions inltk/inltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .download_assets import setup_language, verify_language, check_all_languages_identifying_model
from inltk.tokenizer import LanguageTokenizer
from .const import tokenizer_special_cases
from inltk.utils import cos_sim
from inltk.utils import cos_sim, reset_models

lcodes = LanguageCodes()
all_language_codes = lcodes.get_all_language_codes()
Expand Down Expand Up @@ -75,9 +75,7 @@ def remove_foreign_languages(input: str, host_language_code: str):


def reset_language_identifying_models():
path = Path(__file__).parent
shutil.rmtree(path / 'models' / 'all')
return
reset_models('all')


def get_embedding_vectors(input: str, language_code: str):
Expand Down
6 changes: 6 additions & 0 deletions inltk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
# cosine similarity
def cos_sim(v1, v2):
return F.cosine_similarity(Tensor(v1).unsqueeze(0), Tensor(v2).unsqueeze(0)).mean().item()


def reset_models(folder_name: str):
path = Path(__file__).parent
shutil.rmtree(path / 'models' / f'{folder_name}')
return
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="inltk",
version="0.5.0",
version="0.6.1",
author="Gaurav",
author_email="contactgauravforwork@gmail.com",
description="Natural Language Toolkit for Indian Languages (iNLTK)",
Expand Down

0 comments on commit d603def

Please sign in to comment.