diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 08:56:40 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 08:56:40 +0000 |
commit | 798c275f796ca7fa964d2f919388f112642c5944 (patch) | |
tree | af41d51b58a9da54feab8c0a10650f6fc32d630c | |
parent | a1b130a3c328c1f6dc1c67b0ff46ad5bb1cdd37d (diff) |
automatic import of python-abdothebestopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-abdothebest.spec | 405 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 407 insertions, 0 deletions
@@ -0,0 +1 @@ +/abdoTheBest-1.0.0.tar.gz diff --git a/python-abdothebest.spec b/python-abdothebest.spec new file mode 100644 index 0000000..8126cbe --- /dev/null +++ b/python-abdothebest.spec @@ -0,0 +1,405 @@ +%global _empty_manifest_terminate_build 0 +Name: python-abdoTheBest +Version: 1.0.0 +Release: 1 +Summary: A small example package +License: MIT +URL: https://github.com/gituser/example-pkg +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/55/f3/d948dfe7af193ea36a74b27f94c2c6d0490a6573a833982e13f3c207df03/abdoTheBest-1.0.0.tar.gz +BuildArch: noarch + + +%description + +# GeNN +[](https://github.com/FahedSabellioglu/genn/blob/master/LICENSE.txt) + +GeNN (generative neural networks) is a high-level interface for text applications using PyTorch RNN's. + + +## Features + +1. Preprocessing: + - Parsing txt, json, and csv files. + - NLTK, regex and spacy tokenization support. + - GloVe and fastText pretrained embeddings, with the ability to fine-tune for your data. +2. Architectures and customization: + - GPT2 with small, medium, and large variants. + - LSTM and GRU, with variable size. + - Variable number of layers and batches. + - Dropout. +3. Text generation: + - Random seed sampling from the n first tokens in all instances, or the most frequent token. + - Top-K sampling for next token prediction with variable K. + - Nucleus sampling for next token prediction with variable probability threshold. +4. Text Summarization: + - All GPT2 variants can be trained to perform text summarization. + +## Getting started + +### How to install +```bash +pip install genn +``` +### Prerequisites +* PyTorch 1.4.0 +```bash +pip install torch==1.4.0 +``` +* Pytorch Transformers +```bash +pip install pytorch_transformers +``` +* NumPy +```bash +pip install numpy +``` +* fastText +```bash +pip install fasttext +``` +Use the package manager [pip](https://pypi.org/project/genn) to install genn. + +## Usage +### Text Generation: +##### RNNs (You can switch LSTMGenerator with GRUGenerator: +```python +from genn import Preprocessing, LSTMGenerator, GRUGenerator +#LSTM example +ds = Preprocessing("data.txt") +gen = LSTMGenerator(ds, nLayers = 2, + batchSize = 16, + embSize = 64, + lstmSize = 16, + epochs = 20) + +#Train the model +gen.run() + +# Generate 5 new documents +print(gen.generate_document(5)) +``` +##### GPT2 Generator: +```python +#GPT2 example +gen = GPT2("data.txt", + taskToken = "Movie:", + epochs = 7, + variant = "medium") +#Train the model +gen.run() + +#Generate 10 new documents +print(gen.generate_document(10)) +``` +### Text Summarization: +##### GPT2 Summarizer: +```python +#GPT2 Summarizer example +from genn import GPT2Summarizer +summ = GPT2Summarizer("data.txt", + epochs=3, + batch_size=8) + +#Train the model +summ.run() + +#Create 5 summaries of a source document +src_doc = "This is the source document to summarize" +print(summ.summarize_document(n=5, setSeed = src_doc)) +``` + + + +#### For more examples on how to use Preprocessing, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/preprocessing_examples.md). +#### For more examples on how to use LSTMGenerator and GRUGenerator, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/generator_examples.md). +#### For more examples on how to use GPT2, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/gpt2_examples.md). +#### For more examples on how to use GPT2Summarizer, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/gpt2_summarizer_examples.md). +## Contributing + Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. +## License +Distributed under the MIT License. See [LICENSE](https://github.com/FahedSabellioglu/genn/blob/master/LICENSE.txt) for more information. + + + + +%package -n python3-abdoTheBest +Summary: A small example package +Provides: python-abdoTheBest +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-abdoTheBest + +# GeNN +[](https://github.com/FahedSabellioglu/genn/blob/master/LICENSE.txt) + +GeNN (generative neural networks) is a high-level interface for text applications using PyTorch RNN's. + + +## Features + +1. Preprocessing: + - Parsing txt, json, and csv files. + - NLTK, regex and spacy tokenization support. + - GloVe and fastText pretrained embeddings, with the ability to fine-tune for your data. +2. Architectures and customization: + - GPT2 with small, medium, and large variants. + - LSTM and GRU, with variable size. + - Variable number of layers and batches. + - Dropout. +3. Text generation: + - Random seed sampling from the n first tokens in all instances, or the most frequent token. + - Top-K sampling for next token prediction with variable K. + - Nucleus sampling for next token prediction with variable probability threshold. +4. Text Summarization: + - All GPT2 variants can be trained to perform text summarization. + +## Getting started + +### How to install +```bash +pip install genn +``` +### Prerequisites +* PyTorch 1.4.0 +```bash +pip install torch==1.4.0 +``` +* Pytorch Transformers +```bash +pip install pytorch_transformers +``` +* NumPy +```bash +pip install numpy +``` +* fastText +```bash +pip install fasttext +``` +Use the package manager [pip](https://pypi.org/project/genn) to install genn. + +## Usage +### Text Generation: +##### RNNs (You can switch LSTMGenerator with GRUGenerator: +```python +from genn import Preprocessing, LSTMGenerator, GRUGenerator +#LSTM example +ds = Preprocessing("data.txt") +gen = LSTMGenerator(ds, nLayers = 2, + batchSize = 16, + embSize = 64, + lstmSize = 16, + epochs = 20) + +#Train the model +gen.run() + +# Generate 5 new documents +print(gen.generate_document(5)) +``` +##### GPT2 Generator: +```python +#GPT2 example +gen = GPT2("data.txt", + taskToken = "Movie:", + epochs = 7, + variant = "medium") +#Train the model +gen.run() + +#Generate 10 new documents +print(gen.generate_document(10)) +``` +### Text Summarization: +##### GPT2 Summarizer: +```python +#GPT2 Summarizer example +from genn import GPT2Summarizer +summ = GPT2Summarizer("data.txt", + epochs=3, + batch_size=8) + +#Train the model +summ.run() + +#Create 5 summaries of a source document +src_doc = "This is the source document to summarize" +print(summ.summarize_document(n=5, setSeed = src_doc)) +``` + + + +#### For more examples on how to use Preprocessing, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/preprocessing_examples.md). +#### For more examples on how to use LSTMGenerator and GRUGenerator, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/generator_examples.md). +#### For more examples on how to use GPT2, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/gpt2_examples.md). +#### For more examples on how to use GPT2Summarizer, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/gpt2_summarizer_examples.md). +## Contributing + Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. +## License +Distributed under the MIT License. See [LICENSE](https://github.com/FahedSabellioglu/genn/blob/master/LICENSE.txt) for more information. + + + + +%package help +Summary: Development documents and examples for abdoTheBest +Provides: python3-abdoTheBest-doc +%description help + +# GeNN +[](https://github.com/FahedSabellioglu/genn/blob/master/LICENSE.txt) + +GeNN (generative neural networks) is a high-level interface for text applications using PyTorch RNN's. + + +## Features + +1. Preprocessing: + - Parsing txt, json, and csv files. + - NLTK, regex and spacy tokenization support. + - GloVe and fastText pretrained embeddings, with the ability to fine-tune for your data. +2. Architectures and customization: + - GPT2 with small, medium, and large variants. + - LSTM and GRU, with variable size. + - Variable number of layers and batches. + - Dropout. +3. Text generation: + - Random seed sampling from the n first tokens in all instances, or the most frequent token. + - Top-K sampling for next token prediction with variable K. + - Nucleus sampling for next token prediction with variable probability threshold. +4. Text Summarization: + - All GPT2 variants can be trained to perform text summarization. + +## Getting started + +### How to install +```bash +pip install genn +``` +### Prerequisites +* PyTorch 1.4.0 +```bash +pip install torch==1.4.0 +``` +* Pytorch Transformers +```bash +pip install pytorch_transformers +``` +* NumPy +```bash +pip install numpy +``` +* fastText +```bash +pip install fasttext +``` +Use the package manager [pip](https://pypi.org/project/genn) to install genn. + +## Usage +### Text Generation: +##### RNNs (You can switch LSTMGenerator with GRUGenerator: +```python +from genn import Preprocessing, LSTMGenerator, GRUGenerator +#LSTM example +ds = Preprocessing("data.txt") +gen = LSTMGenerator(ds, nLayers = 2, + batchSize = 16, + embSize = 64, + lstmSize = 16, + epochs = 20) + +#Train the model +gen.run() + +# Generate 5 new documents +print(gen.generate_document(5)) +``` +##### GPT2 Generator: +```python +#GPT2 example +gen = GPT2("data.txt", + taskToken = "Movie:", + epochs = 7, + variant = "medium") +#Train the model +gen.run() + +#Generate 10 new documents +print(gen.generate_document(10)) +``` +### Text Summarization: +##### GPT2 Summarizer: +```python +#GPT2 Summarizer example +from genn import GPT2Summarizer +summ = GPT2Summarizer("data.txt", + epochs=3, + batch_size=8) + +#Train the model +summ.run() + +#Create 5 summaries of a source document +src_doc = "This is the source document to summarize" +print(summ.summarize_document(n=5, setSeed = src_doc)) +``` + + + +#### For more examples on how to use Preprocessing, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/preprocessing_examples.md). +#### For more examples on how to use LSTMGenerator and GRUGenerator, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/generator_examples.md). +#### For more examples on how to use GPT2, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/gpt2_examples.md). +#### For more examples on how to use GPT2Summarizer, please refer to [this file](https://github.com/FahedSabellioglu/genn/blob/master/gpt2_summarizer_examples.md). +## Contributing + Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. +## License +Distributed under the MIT License. See [LICENSE](https://github.com/FahedSabellioglu/genn/blob/master/LICENSE.txt) for more information. + + + + +%prep +%autosetup -n abdoTheBest-1.0.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-abdoTheBest -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.0-1 +- Package Spec generated @@ -0,0 +1 @@ +0dd86edb8f36368eed6a1ce29f19f883 abdoTheBest-1.0.0.tar.gz |