id
stringlengths
8
9
chunk_id
stringlengths
8
9
text
stringclasses
6 values
start_text
int64
235
36k
stop_text
int64
559
36.1k
code
stringclasses
14 values
start_code
int64
356
8.04k
stop_code
int64
386
8.58k
__index_level_0__
int64
0
35
chap04-0
chap04-0
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
11,350
11,432
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
5,070
5,166
0
chap04-1
chap04-1
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
16,510
16,556
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
4,482
4,514
1
chap04-2
chap04-2
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
27,786
27,991
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
2,684
2,750
2
chap04-3
chap04-3
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
16,420
16,500
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
4,407
4,453
3
chap04-4
chap04-4
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
9,407
9,479
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
3,534
3,558
4
chap04-5
chap04-5
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
10,827
10,931
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
4,004
4,054
5
chap04-6
chap04-6
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
23,684
24,252
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
1,551
1,715
6
chap04-7
chap04-7
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
22,466
22,543
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
1,054
1,179
7
chap04-8
chap04-8
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
8,010
8,094
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
2,401
2,437
8
chap04-9
chap04-9
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
19,082
19,452
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented with PyTorch and BCE Loss # In[1]: import random import numpy as np import torch from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want...
4,090
4,394
9
chap04-10
chap04-10
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
15,479
15,530
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
3,894
3,910
10
chap04-11
chap04-11
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
11,433
11,666
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
5,166
5,220
11
chap04-12
chap04-12
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
18,594
18,722
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented with PyTorch and BCE Loss # In[1]: import random import numpy as np import torch from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want...
3,597
3,632
12
chap04-13
chap04-13
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
18,305
18,377
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented with PyTorch and BCE Loss # In[1]: import random import numpy as np import torch from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want...
3,564
3,597
13
chap04-14
chap04-14
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
18,886
18,986
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented with PyTorch and BCE Loss # In[1]: import random import numpy as np import torch from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want...
3,539
3,549
14
chap04-15
chap04-15
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
30,574
30,675
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
2,912
3,016
15
chap04-16
chap04-16
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
35,150
35,323
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
4,091
4,140
16
chap04-17
chap04-17
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
10,416
10,481
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
3,880
3,945
17
chap04-18
chap04-18
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
6,675
7,004
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented with PyTorch and BCE Loss # In[1]: import random import numpy as np import torch from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want...
1,938
1,996
18
chap04-19
chap04-19
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
10,941
11,003
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
4,054
4,278
19
chap04-20
chap04-20
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
31,560
31,649
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
3,250
3,293
20
chap04-21
chap04-21
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
12,663
12,972
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
5,806
5,856
21
chap04-22
chap04-22
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
16,652
16,761
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
6,061
6,111
22
chap04-23
chap04-23
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
9,580
9,738
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
3,651
3,682
23
chap04-24
chap04-24
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
15,251
15,432
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
3,641
3,713
24
chap04-25
chap04-25
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
34,830
35,013
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
3,642
3,843
25
chap04-26
chap04-26
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
8,146
8,316
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
3,065
3,130
26
chap04-27
chap04-27
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
8,748
8,976
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
3,292
3,362
27
chap04-28
chap04-28
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
14,835
14,944
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
2,657
2,786
28
chap04-29
chap04-29
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
16,380
16,414
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
4,407
4,453
29
chap04-30
chap04-30
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
35,970
36,124
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
5,808
5,878
30
chap04-31
chap04-31
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
35,675
35,827
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
4,140
4,174
31
chap04-32
chap04-32
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
6,304
6,379
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with # # Logistic Regression Implemented from Scratch # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed see...
944
994
32
chap04-33
chap04-33
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
25,628
25,780
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Logistic Regression Implemented with PyTorch and CE Loss # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqd...
2,284
2,453
33
chap04-34
chap04-34
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
10,310
10,409
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
3,768
3,819
34
chap04-35
chap04-35
4 Implementing Text Classification Using Perceptron and Logistic Regression In the previous chapters we have discussed the theory behind the perceptron and logistic regression, including mathematical explanations of how and why they are able to learn from examples. In this chapter we will transition from math to co...
12,456
12,568
#!/usr/bin/env python # coding: utf-8 # # Binary Text Classification with Perceptron # In[1]: import random import numpy as np from tqdm.notebook import tqdm # set this variable to a number to be used as the random seed # or to None if you don't want to set a random seed seed = 1234 if seed is not None: rando...
5,553
5,583
35
chap13-0
chap13-0
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
10,884
10,987
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (DistilBERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is on...
3,026
3,346
0
chap13-1
chap13-1
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
21,067
21,185
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
5,906
6,177
1
chap13-2
chap13-2
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
20,650
20,717
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
5,503
5,702
2
chap13-3
chap13-3
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
8,763
8,789
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
2,992
3,054
3
chap13-4
chap13-4
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
9,752
9,887
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
3,497
3,591
4
chap13-5
chap13-5
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
5,001
5,151
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (DistilBERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is on...
2,186
2,390
5
chap13-6
chap13-6
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
22,245
22,352
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
7,764
7,862
6
chap13-7
chap13-7
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
15,154
15,245
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
3,694
3,834
7
chap13-8
chap13-8
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
12,449
12,650
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
4,700
4,732
8
chap13-9
chap13-9
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
21,653
21,887
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
6,962
7,024
9
chap13-10
chap13-10
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
21,888
21,961
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
7,025
7,253
10
chap13-11
chap13-11
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
22,132
22,242
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
7,379
7,413
11
chap13-12
chap13-12
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
9,165
9,306
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
3,270
3,440
12
chap13-13
chap13-13
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
4,505
4,835
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
1,983
2,080
13
chap13-14
chap13-14
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
10,104
10,186
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
3,972
4,162
14
chap13-15
chap13-15
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
13,115
13,198
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
5,116
5,132
15
chap13-16
chap13-16
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
21,188
21,383
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
6,235
6,267
16
chap13-17
chap13-17
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
8,794
8,860
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
3,054
3,129
17
chap13-18
chap13-18
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
14,478
14,609
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
2,532
2,570
18
chap13-19
chap13-19
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
8,031
8,244
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
2,787
2,845
19
chap13-20
chap13-20
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
8,703
8,761
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
2,954
2,992
20
chap13-21
chap13-21
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
13,908
14,026
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
1,570
1,724
21
chap13-22
chap13-22
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
17,980
18,264
#!/usr/bin/env python # coding: utf-8 # # Part-of-speech Tagging with Transformer Networks # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one available...
4,233
4,301
22
chap13-23
chap13-23
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
4,221
4,328
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
1,751
1,904
23
chap13-24
chap13-24
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
8,972
9,164
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (BERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is one avai...
3,166
3,270
24
chap13-25
chap13-25
13 Using Transformers with the Hugging Face Library One of the key advantages of transformer networks is the ability to take a model that was pre-trained over vast quantities of text and fine-tune it for the task at hand. Intuitively, this strategy allows transformer networks to achieve higher performance on smalle...
12,799
12,885
#!/usr/bin/env python # coding: utf-8 # # Text Classification Using Transformer Networks (DistilBERT) # Some initialization: # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas() # set to True to use the gpu (if there is on...
3,628
3,647
25
chap09-0
chap09-0
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
8,905
9,068
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
6,116
6,403
0
chap09-1
chap09-1
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
12,872
12,940
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
6,683
6,709
1
chap09-2
chap09-2
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
12,705
12,869
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
5,410
5,538
2
chap09-3
chap09-3
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
7,625
7,862
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
5,543
5,619
3
chap09-4
chap09-4
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
8,624
8,814
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
5,934
5,977
4
chap09-5
chap09-5
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
5,800
6,076
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
3,119
3,184
5
chap09-6
chap09-6
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
14,409
14,731
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
8,036
8,223
6
chap09-7
chap09-7
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
11,746
11,808
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
4,803
4,840
7
chap09-8
chap09-8
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
9,339
9,440
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
6,471
6,583
8
chap09-9
chap09-9
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
13,150
13,264
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
7,474
7,552
9
chap09-10
chap09-10
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
13,851
14,021
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
7,581
7,817
10
chap09-11
chap09-11
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
14,346
14,408
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
7,826
7,852
11
chap09-12
chap09-12
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
8,105
8,197
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
5,830
5,863
12
chap09-13
chap09-13
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
4,512
4,666
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
2,221
2,250
13
chap09-14
chap09-14
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
8,815
8,904
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
6,000
6,041
14
chap09-15
chap09-15
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
9,918
10,014
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
7,688
7,774
15
chap09-16
chap09-16
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
13,061
13,149
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
7,140
7,164
16
chap09-17
chap09-17
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
7,933
8,007
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
5,670
5,703
17
chap09-18
chap09-18
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
11,071
11,197
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
3,402
3,564
18
chap09-19
chap09-19
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
6,751
6,861
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
4,732
4,776
19
chap09-20
chap09-20
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
7,099
7,302
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
5,129
5,183
20
chap09-21
chap09-21
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
10,015
10,100
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
7,806
7,886
21
chap09-22
chap09-22
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
11,907
11,965
#!/usr/bin/env python # coding: utf-8 # # Multiclass Text Classification with # # Feed-forward Neural Networks and Word Embeddings # First, we will do some initialization. # In[1]: import random import torch import numpy as np import pandas as pd from tqdm.notebook import tqdm # enable tqdm in pandas tqdm.pandas...
4,840
4,864
22
chap09-23
chap09-23
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
3,607
3,794
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
1,269
1,308
23
chap09-24
chap09-24
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
8,013
8,087
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
5,743
5,770
24
chap09-25
chap09-25
9 Implementing Text Classification Using Word Embeddings In the previous chapter we introduced word embeddings, which are realvalued vectors that encode semantic representation of words. We discussed how to learn them, and how they capture semantic information that makes them useful for downstream tasks. In this ...
9,647
9,764
#!/usr/bin/env python # coding: utf-8 # # Using Pre-trained Word Embeddings # # In this notebook we will show some operations on pre-trained word embeddings to gain an intuition about them. # # We will be using the pre-trained GloVe embeddings that can be found in the [official website](https://nlp.stanford.edu/proj...
7,370
7,449
25
chap15-0
chap15-0
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
4,780
5,004
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from English (En) to Romanian (Ro) # # Using the T5 Transformer without Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # set to True to use the gpu (if there is one available) use_gpu = Tr...
2,097
2,191
0
chap15-1
chap15-1
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
15,290
15,435
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from Ro to En # # Using the T5 Transformer with Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # random seed seed = 42 # set random seed if seed is not None: print(f'random seed: {seed...
2,412
2,529
1
chap15-2
chap15-2
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
13,298
13,371
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from Ro to En # # Using the T5 Transformer with Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # random seed seed = 42 # set random seed if seed is not None: print(f'random seed: {seed...
2,070
2,273
2
chap15-3
chap15-3
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
2,741
3,052
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from English (En) to Romanian (Ro) # # Using the T5 Transformer without Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # set to True to use the gpu (if there is one available) use_gpu = Tr...
1,129
1,184
3
chap15-4
chap15-4
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
3,908
3,959
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from English (En) to Romanian (Ro) # # Using the T5 Transformer without Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # set to True to use the gpu (if there is one available) use_gpu = Tr...
1,721
1,821
4
chap15-5
chap15-5
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
18,161
18,623
#!/usr/bin/env python # coding: utf-8 # # Load and Use a Previously-trained Ro-to-En T5 Model # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # set to True to use the gpu (if there is one available) use_gpu = True # select device device = torch.device('cuda' if u...
845
1,104
5
chap15-6
chap15-6
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
1,847
2,011
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from English (En) to Romanian (Ro) # # Using the T5 Transformer without Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # set to True to use the gpu (if there is one available) use_gpu = Tr...
653
678
6
chap15-7
chap15-7
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
17,694
17,934
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from Ro to En # # Using the T5 Transformer with Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # random seed seed = 42 # set random seed if seed is not None: print(f'random seed: {seed...
5,145
5,437
7
chap15-8
chap15-8
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
12,139
12,249
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from Ro to En # # Using the T5 Transformer with Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # random seed seed = 42 # set random seed if seed is not None: print(f'random seed: {seed...
874
930
8
chap15-9
chap15-9
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
6,284
6,488
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from English (En) to Romanian (Ro) # # Using the T5 Transformer without Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # set to True to use the gpu (if there is one available) use_gpu = Tr...
2,702
2,736
9
chap15-10
chap15-10
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
15,789
15,918
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from Ro to En # # Using the T5 Transformer with Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # random seed seed = 42 # set random seed if seed is not None: print(f'random seed: {seed...
3,847
4,075
10
chap15-11
chap15-11
15 Implementing Encoder-decoder Methods In this chapter we implement a machine translation application as an example of an encoder-decoder task. In particular, we build on pre-trained encoder-decoder transformer models, which exist in the Hugging Face library for a wide variety of language pairs. We first show how ...
16,413
16,607
#!/usr/bin/env python # coding: utf-8 # # Machine Translation from Ro to En # # Using the T5 Transformer with Fine-tuning # Some initialization: # In[1]: import torch import numpy as np from transformers import set_seed # random seed seed = 42 # set random seed if seed is not None: print(f'random seed: {seed...
4,388
4,457
11