imdb
Bases: text_dataloader
A dataloader class for the IMDB dataset.
This class provides methods to load and preprocess the IMDB dataset, which contains movie reviews labeled as positive or negative.
Attributes:
Name | Type | Description |
---|---|---|
name |
str, default = 'imdb'
|
The name of the dataset. |
train_batch_size |
int, default = 64
|
The batch size for training data. |
test_batch_size |
int, default = 64
|
The batch size for testing data. |
max_seq_len |
int, default = 512
|
The maximum sequence length for text data. |
Methods:
Name | Description |
---|---|
__init__ |
Initializes the IMDB dataset dataloader. |
load |
Loads the IMDB dataset with reversed (label, text) ordering. |
load_datapipe |
Loads training and testing pipelines for the IMDB dataset. |
get_class_number |
Returns the number of classes in the IMDB dataset (2). |
get_train_number |
Returns the number of training examples (25,000). |
get_test_number |
Returns the number of testing examples (25,000). |
get_idx_to_label |
Returns the mapping from indices to labels. |
Source code in tinybig/data/text_dataloader_torchtext.py
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 |
|
__init__(name='imdb', train_batch_size=64, test_batch_size=64, max_seq_len=512)
Initializes the IMDB dataset dataloader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the dataset. |
= 'imdb'
|
train_batch_size
|
int
|
The batch size for training data. |
= 64
|
test_batch_size
|
int
|
The batch size for testing data. |
= 64
|
max_seq_len
|
int
|
The maximum sequence length for text data. |
= 512
|
Source code in tinybig/data/text_dataloader_torchtext.py
get_class_number(*args, **kwargs)
staticmethod
Returns the number of classes in the IMDB dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
tuple
|
Additional arguments. |
()
|
**kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
int
|
The number of classes (2). |
Source code in tinybig/data/text_dataloader_torchtext.py
get_idx_to_label(*args, **kwargs)
staticmethod
Returns the mapping from indices to labels for the IMDB dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
tuple
|
Additional arguments. |
()
|
**kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
dict
|
A dictionary mapping indices to labels. |
Source code in tinybig/data/text_dataloader_torchtext.py
get_test_number(*args, **kwargs)
staticmethod
Returns the number of testing examples in the IMDB dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
tuple
|
Additional arguments. |
()
|
**kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
int
|
The number of testing examples (25,000). |
Source code in tinybig/data/text_dataloader_torchtext.py
get_train_number(*args, **kwargs)
staticmethod
Returns the number of training examples in the IMDB dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
tuple
|
Additional arguments. |
()
|
**kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
int
|
The number of training examples (25,000). |
Source code in tinybig/data/text_dataloader_torchtext.py
load(*args, **kwargs)
Loads the IMDB dataset with reversed (label, text) ordering.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
tuple
|
Additional arguments. |
()
|
**kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
dict
|
A dictionary containing training and testing DataLoaders. |
Source code in tinybig/data/text_dataloader_torchtext.py
load_datapipe(cache_dir='./data/', *args, **kwargs)
staticmethod
Loads training and testing pipelines for the IMDB dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cache_dir
|
str
|
Directory to store cached data. |
= './data/'
|
*args
|
tuple
|
Additional arguments. |
()
|
**kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
tuple
|
A tuple containing training and testing data pipelines. |