Character-Level Language Models Repo 🕺🏽
This repository contains multiple character-level language models (charLLM). Each language model is designed to generate text at the character level, providing a granular level of control and flexibility.
🌟 Available Language Models
- Character-Level MLP LLM (First MLP LLM)
- GPT-2 (under process)
Character-Level MLP
The Character-Level MLP language model is implemented based on the approach described in the paper "A Neural Probabilistic Language Model" by Bential et al. (2002). It utilizes a multilayer perceptron architecture to generate text at the character level.
Installation
With PIP
This repository is tested on Python 3.8+, and PyTorch 2.0.0+.
First, create a virtual environment with the version of Python you're going to use and activate it.
Then, you will need to install PyTorch.
When backends has been installed, CharLLMs can be installed using pip as follows:
pip install charLLM
With GIT
CharLLMs can be installed using conda as follows:
git clone https://github.com/RAravindDS/Neural-Probabilistic-Language-Model.git
Quick Tour
To use the Character-Level MLP language model, follow these steps:
- Install the package dependencies.
- Import the
CharMLPclass from thecharLLMmodule. - Create an instance of the
CharMLPclass. - Train the model on a suitable dataset.
- Generate text using the trained model.
Demo for NPLM (A Neural Probabilistic Language Model)
# Import the class
>>> from charLLM import NPLM # Neural Probabilistic Language Model
>>> text_path = "path-to-text-file.txt"
>>> model_parameters = {
"block_size" :3,
"train_size" :0.8,
'epochs' :10000,
'batch_size' :32,
'hidden_layer' :100,
'embedding_dimension' :50,
'learning_rate' :0.1
}
>>> obj = NPLM(text_path, model_parameters) # Initialize the class
>>> obj.train_model()
## It outputs the val_loss and image
>>> obj.sampling(words_needed=10) #It samples 10 tokens.
Model Output Graph
Feel free to explore the repository and experiment with the different language models provided.
Contributions
Contributions to this repository are welcome. If you have implemented a novel character-level language model or would like to enhance the existing models, please consider contributing to the project.
License
This repository is licensed under the MIT License.
Metadata
Release files for charLLM 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| charLLM-0.0.7.tar.gz | 8.4 kB | Without provenance | Details for charLLM-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| charLLM-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for charLLM-0.0.7-py3-none-any.whl |
Total release size: 17.2 kB
Release files / charLLM-0.0.7.tar.gz
| Download URL | charLLM-0.0.7.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54766a6f4b5907e224abc3692e6f3d5cee865818f0e6d49bff24aa2b32a3efe8
|
|
BLAKE2b-256 checksum How to use checksums |
653f634043208a51154d56ac5dbbea0ca76d809083104808f548ae974c0076fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / charLLM-0.0.7-py3-none-any.whl
| Download URL | charLLM-0.0.7-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d40bc4f0d2a4714fcf4091bcb1d6a32fa38077f7e32d0892f8982a4350f17241
|
|
BLAKE2b-256 checksum How to use checksums |
920512e91fd03360e22bbb11fe76332b3b8057a15ab593059554a2dba346e0c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Security for charLLM 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.