From e40a68080364c74495f755d3ed640aa8a4f8dea4 Mon Sep 17 00:00:00 2001 From: Giovanni De Gasperis Date: Fri, 31 Dec 2021 10:25:17 +0100 Subject: [PATCH 1/5] to let it install cleanly on M1 macOS Working with python3.9.5 and tensorflow-metal optimized for the M1 arm architecture, including the GPU, as explained with in tutorial: https://makeoptim.com/en/deep-learning/tensorflow-metal --- requirements/requirements.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 1e8423b..8e35931 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,7 +2,7 @@ AIML-Bot>=0.0.3,<0.1.0 coverage>=4.3.4 cython>=0.29.20 future>=0.16.0 -gensim==3.6.0 +gensim html2text>=2018.1.9 html5lib==1.1 jupyter>=1.0.0,<1.1.0 @@ -12,8 +12,8 @@ Keras-Preprocessing>=1.0.5 matplotlib>=3.2.2,<3.4.0 MechanicalSoup>=0.10.0,<0.11.0 nltk==3.5 -pandas>=0.25.3,<0.26.0 -pandoc==2.2.3.2 +pandas +pandoc pathlib>=1.0.1,<2.0.0 pillow==6.2.2 pip>=18.0 @@ -27,12 +27,13 @@ qtconsole==4.4.1. # ,<6.0.0 # 4.4.1 is available on OSX in conda and pip redis>=2.10.6,<2.11.0 regex>=2020.6.8 scikit-learn>=0.18.1 -scipy==1.4.1 +scipy seaborn>=0.8 setuptools>=40.8.0 -spacy==2.3.0 -tensorflow==2.1.0 +spacy +tensorflow-metal tensorflow-hub>=0.4.0 theano==1.0.2 tqdm>=4.11.2 wheel>=0.30.0a0 +ipdb From 1516e07ece8405440418fe910b2b020f48d5a64a Mon Sep 17 00:00:00 2001 From: Giovanni De Gasperis Date: Fri, 31 Dec 2021 10:28:06 +0100 Subject: [PATCH 2/5] to cleanly install on M1 arm macOS Working with python3.9.5 and tensorflow-metal optimized for the M1 arm architecture, including the GPU, as explained with in tutorial: https://makeoptim.com/en/deep-learning/tensorflow-metal --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index aa36c0b..5c08793 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,7 +54,7 @@ install_requires = gensim pandas-datareader pugnlp - tensorflow + tensorflow-metal keras regex spacy @@ -82,7 +82,7 @@ exclude = # Add here additional requirements for extra features, to install with: # `pip install nlpia[voice]` like: twitter = tweepy; twython -deep = keras; tensorflow; annoy; gensim +deep = keras; tensorflow-metal; annoy; gensim # voice = pyaudio; pocketsphinx; SpeechRecognition; pyttsx3; deepspeech chat = aichat; will; redis; ChatterBot; lxml; aiml; aichat all = nlpia[deep]; nlpia[chat]; nlpia[twitter]; nlpia[voice] From fa57be1947e0e8f17b89f2272c713a3b64fbcb86 Mon Sep 17 00:00:00 2001 From: Giovanni De Gasperis Date: Fri, 31 Dec 2021 10:42:06 +0100 Subject: [PATCH 3/5] to let it install cleanly on M1 macOS Working with python3.9.5 and tensorflow-metal optimized for the M1 arm architecture, including the integrated GPU. Fix #44 . --- README.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d55f04..6fb7b1c 100644 --- a/README.md +++ b/README.md @@ -86,11 +86,11 @@ You have two alternative package managers you can use to install `nlpia`: 5.1. [`conda`](https://github.com/totalgood/nlpia/blob/master/README.md#alternative-51-conda) 5.2. [`pip`](https://github.com/totalgood/nlpia/blob/master/README.md#alternative-52-pip) +5.3. [`docker`](https://github.com/totalgood/nlpia/blob/master/README.md#alternative-53-docker) +5.4. [`miniforge`](https://github.com/totalgood/nlpia/blob/master/README.md#alternative-54-miniforge) A helpful [NLPIA](http://bit.ly/gh-readme-nlpia-book) reader, [Hoang Chung Hien](https://github.com/hoangchunghien), created a Dockerfile you can use for a third way to manage your environment: -5.3. [`docker`](https://github.com/totalgood/nlpia/blob/master/README.md#alternative-53-docker) - In most cases, `conda` will be able to install python packages faster and more reliably than `pip`. Without `conda` Some packages, such as `python-levenshtein`, require you to compile a C library during installation. Windows doesn't have a a compiler and python package installer that will "just work." #### Alternative 5.1. `conda` @@ -191,6 +191,24 @@ docker run -p 8888:8888 -v ~:/home/jovyan/work nlpia Then open a new notebook and test your code. Make sure save it inside `work` directory so it's accessible outside the container. + +## Alternative 5.3. `miniforge` + +### 5.4.1 Install Python3.9.5 and tensorflow-metal with miniforge + +Follow this [tutorial](https://makeoptim.com/en/deep-learning/tensorflow-metal) + +### 5.4.2 Install all requirements with pip + +Miniforge will give you a Python3.9.5 (or more) virtual environment, capable to run the accelerated tensorflow-metal , optimized to use the M1 integrated GPU hardware. + + pip install -r requirements.txt + +### 5.4.3 Install mlpia + + python setup.py install + + ### 6. Have Fun! Check out the code examples from the book in `nlpia/nlpia/book/examples` to get ideas: From b2f2d69d5a32d52e25effef2882e8265ae8cc360 Mon Sep 17 00:00:00 2001 From: Giovanni De Gasperis Date: Fri, 31 Dec 2021 10:55:09 +0100 Subject: [PATCH 4/5] fix the 5.4 title --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6fb7b1c..567f904 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ docker run -p 8888:8888 -v ~:/home/jovyan/work nlpia Then open a new notebook and test your code. Make sure save it inside `work` directory so it's accessible outside the container. -## Alternative 5.3. `miniforge` +## Alternative 5.4. `miniforge` ### 5.4.1 Install Python3.9.5 and tensorflow-metal with miniforge From 39bf2ceff2128e5bb7ad233ced55cb55fe70be4a Mon Sep 17 00:00:00 2001 From: Giovanni De Gasperis Date: Fri, 31 Dec 2021 11:03:18 +0100 Subject: [PATCH 5/5] fix nlpia typo --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 567f904..7b3fb84 100644 --- a/README.md +++ b/README.md @@ -202,9 +202,10 @@ Follow this [tutorial](https://makeoptim.com/en/deep-learning/tensorflow-metal) Miniforge will give you a Python3.9.5 (or more) virtual environment, capable to run the accelerated tensorflow-metal , optimized to use the M1 integrated GPU hardware. + cd nlpia pip install -r requirements.txt -### 5.4.3 Install mlpia +### 5.4.3 Install nlpia python setup.py install