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

Pnlp refactor ubuntu23 #137

Open
wants to merge 46 commits into
base: pnlp-refactor-ubuntu23
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0365c0d
fix: Updated Ch5/01_KPE.ipynb to run with latest versions of Python a…
Aug 30, 2023
50bab60
fix: Updated Ch5/02_NERTraining.ipynb to run with latest versions of …
Aug 30, 2023
b4d75b0
fix: Updated Ch5/03_NERIssues.ipynb to run with latest versions of Py…
Aug 30, 2023
8daec3e
fix: Updated Ch6/01_CNN_RNN_ATIS_intents.ipynb to run with latest ver…
Aug 30, 2023
5b0ef4a
fix: Updated Ch6/02_BERT_ATIS.ipynb to run with latest versions of Py…
Aug 30, 2023
705e486
fix: Updated Ch6/03_BERT_ATIS_Binary.ipynb to run with latest version…
Aug 30, 2023
9b7fbe5
fix: Updated Ch6/04_CRF_SNIPS_slots.ipynb to run with latest versions…
Aug 30, 2023
1f46153
fix: Updated Ch6/05_BERT_SNIPS.ipynb to run with latest versions of P…
Aug 31, 2023
b7b2694
fix: Updated Ch7/01_ElasticSearch.ipynb to run with latest versions o…
Aug 31, 2023
3b734eb
fix: Updated Ch7/02_TopicModelling.ipynb to run with latest versions …
Sep 3, 2023
37a3dd6
fix: Updated Ch7/04_RecommenderSystems.ipynb to run with latest versi…
Sep 3, 2023
80ffbee
fix: Updated Ch8/02_DifferentTokenizers.ipynb to run with latest vers…
Sep 3, 2023
dab0c6a
fix: Updated Ch8/04_Sentiment_Analysis_Textblob.ipynb to run with lat…
Sep 4, 2023
eb3d754
fix: Updated Ch8/06_SMTD_embeddings.ipynb to run with latest versions…
Sep 4, 2023
44805be
fix: Updated Ch9/01_Aspect_Based_Sentiment_analysis.ipynb to run with…
Sep 4, 2023
32cc56f
fix: Updated Ch10/01_BioBERT_Demo.ipynb to run with latest versions o…
Sep 5, 2023
c3db330
fix: Updated Ch10/03_FinBERT.ipynb to run with latest versions of Pyt…
Sep 5, 2023
e93cc9a
Update README.md to add Ethan0456
suranah Sep 6, 2023
bfd3365
Update README.md to include pnlp-refactor-ubuntu23
suranah Sep 6, 2023
d8abe13
fix: Update README.md to fix grammar for README
suranah Sep 6, 2023
6eb81c8
fix #146: Updated Ch4/08_LimeDemo.ipynb to support latest version of …
Sep 28, 2023
92dc712
fix #147: Updated Ch4/09_Lime_RNN.ipynb to support latest version of …
Sep 28, 2023
cc8e945
fix: Updated Ch5/01_KPE.ipynb to run with latest versions of Python a…
Aug 30, 2023
0c2e1e2
fix: Updated Ch5/02_NERTraining.ipynb to run with latest versions of …
Aug 30, 2023
eb07517
fix: Updated Ch5/03_NERIssues.ipynb to run with latest versions of Py…
Aug 30, 2023
af7e31f
fix: Updated Ch6/01_CNN_RNN_ATIS_intents.ipynb to run with latest ver…
Aug 30, 2023
9c21b9a
fix: Updated Ch6/02_BERT_ATIS.ipynb to run with latest versions of Py…
Aug 30, 2023
88fbb40
fix: Updated Ch6/03_BERT_ATIS_Binary.ipynb to run with latest version…
Aug 30, 2023
b199679
fix: Updated Ch6/04_CRF_SNIPS_slots.ipynb to run with latest versions…
Aug 30, 2023
071b671
fix: Updated Ch6/05_BERT_SNIPS.ipynb to run with latest versions of P…
Aug 31, 2023
83fc255
fix: Updated Ch7/01_ElasticSearch.ipynb to run with latest versions o…
Aug 31, 2023
92e6d0e
fix: Updated Ch7/02_TopicModelling.ipynb to run with latest versions …
Sep 3, 2023
ca39dfd
fix: Updated Ch7/04_RecommenderSystems.ipynb to run with latest versi…
Sep 3, 2023
0948671
fix: Updated Ch8/02_DifferentTokenizers.ipynb to run with latest vers…
Sep 3, 2023
b4db31d
fix: Updated Ch8/04_Sentiment_Analysis_Textblob.ipynb to run with lat…
Sep 4, 2023
de84eea
fix: Updated Ch8/06_SMTD_embeddings.ipynb to run with latest versions…
Sep 4, 2023
bb02c5b
fix: Updated Ch9/01_Aspect_Based_Sentiment_analysis.ipynb to run with…
Sep 4, 2023
ff5a58b
fix: Updated Ch10/01_BioBERT_Demo.ipynb to run with latest versions o…
Sep 5, 2023
3f35eeb
fix: Updated Ch10/03_FinBERT.ipynb to run with latest versions of Pyt…
Sep 5, 2023
1d36ebb
Update README.md to add Ethan0456
suranah Sep 6, 2023
b03ffc9
Update README.md to include pnlp-refactor-ubuntu23
suranah Sep 6, 2023
b60f1ce
fix: Update README.md to fix grammar for README
suranah Sep 6, 2023
ae3b7ed
fix #146: Updated Ch4/08_LimeDemo.ipynb to support latest version of …
Sep 28, 2023
676643b
fix #147: Updated Ch4/09_Lime_RNN.ipynb to support latest version of …
Sep 28, 2023
505b446
fix #139: Resolved Issue and Updated Ch4/06_BERT_IMDB_Sentiment_Class…
Sep 29, 2023
7a2a991
Merge branch 'pnlp-refactor-ubuntu23' of github.com:Ethan0456/practic…
Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,641 changes: 1,030 additions & 611 deletions Ch10/01_BioBERT_Demo.ipynb

Large diffs are not rendered by default.

3,494 changes: 1,954 additions & 1,540 deletions Ch10/03_FinBERT.ipynb

Large diffs are not rendered by default.

2,485 changes: 1,666 additions & 819 deletions Ch4/06_BERT_IMDB_Sentiment_Classification.ipynb

Large diffs are not rendered by default.

75,173 changes: 37,668 additions & 37,505 deletions Ch4/08_LimeDemo.ipynb

Large diffs are not rendered by default.

601 changes: 343 additions & 258 deletions Ch4/09_Lime_RNN.ipynb

Large diffs are not rendered by default.

925 changes: 532 additions & 393 deletions Ch5/01_KPE.ipynb

Large diffs are not rendered by default.

1,032 changes: 630 additions & 402 deletions Ch5/02_NERTraining.ipynb

Large diffs are not rendered by default.

328 changes: 179 additions & 149 deletions Ch5/03_NERIssues.ipynb

Large diffs are not rendered by default.

1,682 changes: 901 additions & 781 deletions Ch6/01_CNN_RNN_ATIS_intents.ipynb

Large diffs are not rendered by default.

2,091 changes: 1,009 additions & 1,082 deletions Ch6/02_BERT_ATIS.ipynb

Large diffs are not rendered by default.

2,306 changes: 1,337 additions & 969 deletions Ch6/03_BERT_ATIS_Binary.ipynb

Large diffs are not rendered by default.

5,943 changes: 3,076 additions & 2,867 deletions Ch6/04_CRF_SNIPS_slots.ipynb

Large diffs are not rendered by default.

2,584 changes: 1,264 additions & 1,320 deletions Ch6/05_BERT_SNIPS.ipynb

Large diffs are not rendered by default.

71 changes: 50 additions & 21 deletions Ch7/01_ElasticSearch.ipynb
Original file line number Diff line number Diff line change
@@ -12,6 +12,13 @@
"For this code to work, elastic search instance has to be running in the background. \n",
"For this you need to follow these steps :\n",
"\n",
"Docker :\n",
" 1. Install Docker\n",
" 2. Create Network : docker network create elastic\n",
" 3. Pull Image : docker pull docker.elastic.co/elasticsearch/elasticsearch:8.9.1\n",
" 4. Run Image : docker run --name elasticsearch --net elastic -p 9200:9200 -p 9300:9300 -e \"discovery.type=single-node\" -t docker.elastic.co/elasticsearch/elasticsearch:8.9.1\n",
" 5. After Running the last command the container will give you the username and password to login, the user most likely be named as \"elastic\" and password will be given just beside it.\n",
"\n",
"Linux :\n",
"\n",
" 1. Go to the elasticsearch-X.Y.Z/bin folder on your machine\n",
@@ -31,6 +38,34 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting elasticsearch\n",
" Obtaining dependency information for elasticsearch from https://files.pythonhosted.org/packages/bb/06/81b1d71ba0567ff39d0f98f3637e810846df92f6733aee46004a194b51ea/elasticsearch-8.9.0-py3-none-any.whl.metadata\n",
" Downloading elasticsearch-8.9.0-py3-none-any.whl.metadata (5.2 kB)\n",
"Collecting elastic-transport<9,>=8 (from elasticsearch)\n",
" Downloading elastic_transport-8.4.0-py3-none-any.whl (59 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m59.5/59.5 kB\u001b[0m \u001b[31m1.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: urllib3<2,>=1.26.2 in /Users/abhijeetsingh/Documents/DL/Ch2/DL/lib/python3.11/site-packages (from elastic-transport<9,>=8->elasticsearch) (1.26.16)\n",
"Requirement already satisfied: certifi in /Users/abhijeetsingh/Documents/DL/Ch2/DL/lib/python3.11/site-packages (from elastic-transport<9,>=8->elasticsearch) (2023.7.22)\n",
"Downloading elasticsearch-8.9.0-py3-none-any.whl (395 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m395.5/395.5 kB\u001b[0m \u001b[31m4.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hInstalling collected packages: elastic-transport, elasticsearch\n",
"Successfully installed elastic-transport-8.4.0 elasticsearch-8.9.0\n"
]
}
],
"source": [
"!pip install elasticsearch"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"colab": {},
"colab_type": "code",
@@ -40,12 +75,15 @@
"outputs": [],
"source": [
"from elasticsearch import Elasticsearch \n",
"from datetime import datetime"
"from datetime import datetime\n",
"\n",
"import warnings\n",
"warnings.filterwarnings('ignore')"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 24,
"metadata": {
"colab": {},
"colab_type": "code",
@@ -56,14 +94,14 @@
"#elastic search instance has to be running on the machine. Default port is 9200. \n",
"\n",
"#Call the Elastic Search instance, and delete any pre-existing index\n",
"es=Elasticsearch([{'host':'localhost','port':9200}])\n",
"es=Elasticsearch([{'host':'localhost','port':9200,'scheme':\"https\"}], http_auth=('elastic', 'yQIpShQvIXJ5gqcImcM9'), verify_certs=False)\n",
"if es.indices.exists(index=\"myindex\"):\n",
" es.indices.delete(index='myindex', ignore=[400, 404]) #Deleting existing index for now "
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 25,
"metadata": {
"colab": {},
"colab_type": "code",
@@ -85,7 +123,7 @@
],
"source": [
"#Build an index from booksummaries dataset. I am using only 500 documents for now.\n",
"path = \"booksummaries.txt\" #Add your path.\n",
"path = \"./Data/booksummaries/booksummaries.txt\" #Add your path.\n",
"count = 1\n",
"for line in open(path):\n",
" fields = line.split(\"\\t\")\n",
@@ -105,7 +143,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {
"colab": {},
"colab_type": "code",
@@ -117,7 +155,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Your index has 500 entries\n"
"Your index has 414 entries\n"
]
}
],
@@ -129,7 +167,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"metadata": {
"colab": {},
"colab_type": "code",
@@ -154,7 +192,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 28,
"metadata": {
"colab": {},
"colab_type": "code",
@@ -179,7 +217,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 30,
"metadata": {
"colab": {},
"colab_type": "code",
@@ -191,37 +229,28 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Enter your search query: countess\n",
"Your search returned 7 results:\n",
"All's Well That Ends Well\n",
"71\n",
" Helena, the orphan daughter of a famous physician, is the ward of the Countess of Rousillon, and ho\n",
"\n",
"The Last Man\n",
"904\n",
" Mary Shelley states in the introduction that in 1818 she discovered, in the Sibyl's cave near Naple\n",
"ng leaves the throne, the monarchy come to an end and a republic is created. When the king dies the Countess attempts to raise their son, Adrian, to reclaim the throne, but Adrian opposes his mother a\n",
"The Luck of Barry Lyndon\n",
"2624\n",
" Redmond Barry of Bally Barry, born to a genteel but ruined Irish family, fancies himself a gentlema\n",
"chy, where they win considerable sums of money and Redmond cleverly sets up a plan to marry a young countess of some means. Again, fortune turns against him, and a series of circumstances undermines h\n",
"Carmilla\n",
"2554\n",
" The story is presented by Le Fanu as part of the casebook of Dr Hesselius, whose departures from me\n",
"ily heirloom restored portraits arrives at the castle, Laura finds one of her ancestors, \"Mircalla, Countess Karnstein\", dated 1698. The portrait resembles Carmilla exactly, down to the mole on her ne\n",
"Anna Karenina\n",
"1330\n",
" The novel is divided into eight parts. Its epigraph is Vengeance is mine, I will repay, from Romans\n",
" at the railway station to meet Anna, Stiva bumps into Vronsky; he is there to meet his mother, the Countess Vronskaya. Anna and Vronskaya have traveled and talked together in the same carriage. As th\n",
"Murder on the Orient Express\n",
"5569\n",
" Hercule Poirot boards the Orient Express in Constantinople. The train is unusually crowded for the \n",
"us tragic actress of the New York stage, and was Sonia Armstrong's mother and Daisy's grandmother; *Countess Andrenyi (née Helena Goldenberg) was Sonia Armstrong's sister; *Count Andryeni was the husb\n",
"War and Peace\n",
"2612\n",
" War and Peace has a large cast of characters, the majority of whom are introduced in the first book\n",
"is impetuous and eager to join the army when of age. The heads of the family, Count Ilya Rostov and Countess Natalya Rostova, are an affectionate couple but forever worried about their disordered fina\n",
"Enter your search query: STOP\n"
"is impetuous and eager to join the army when of age. The heads of the family, Count Ilya Rostov and Countess Natalya Rostova, are an affectionate couple but forever worried about their disordered fina\n"
]
}
],
@@ -276,7 +305,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.11.4"
}
},
"nbformat": 4,
Loading