{"id":14970635,"url":"https://github.com/raravindds/charllms","last_synced_at":"2025-10-04T03:54:56.888Z","repository":{"id":173896603,"uuid":"651440919","full_name":"RAravindDS/CharLLMs","owner":"RAravindDS","description":"Implementing  easy to use \"Character Level Language Models\"  🕺🏽","archived":false,"fork":false,"pushed_at":"2024-01-15T03:07:51.000Z","size":79,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-03-15T08:50:32.571Z","etag":null,"topics":["llms","nlp","pytorch","research-paper"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/charLLM/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RAravindDS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-09T08:40:08.000Z","updated_at":"2024-02-04T10:19:34.000Z","dependencies_parsed_at":"2024-01-15T04:37:13.665Z","dependency_job_id":"150af3be-2abe-42c3-a75c-df2f030e0513","html_url":"https://github.com/RAravindDS/CharLLMs","commit_stats":null,"previous_names":["raravindds/neural-probabilistic-language-model","raravindds/charllms"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAravindDS%2FCharLLMs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAravindDS%2FCharLLMs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAravindDS%2FCharLLMs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RAravindDS%2FCharLLMs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RAravindDS","download_url":"https://codeload.github.com/RAravindDS/CharLLMs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219862887,"owners_count":16555951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["llms","nlp","pytorch","research-paper"],"created_at":"2024-09-24T13:43:53.464Z","updated_at":"2025-10-04T03:54:51.848Z","avatar_url":"https://github.com/RAravindDS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/RAravindDS/CharLLMs/main/images/charllms.webp\" height=300\u003e\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n\u003c/p\u003e\n\n\n\n\n# **Character-Level Language Models Repo 🕺🏽**\n\nThis 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.\n\n\n## 🌟 Available Language Models \n\n- **Character-Level MLP LLM (\u003ci\u003eFirst MLP LLM\u003c/i\u003e)**\n- **GPT-2 (under process)**\n\n## Character-Level MLP\n\nThe Character-Level MLP language model is implemented based on the approach described in the paper \"[A Neural Probabilistic Language Model](https://www.jmlr.org/papers/volume3/bengio03a/bengio03a.pdf)\" by Bential et al. (2002). \nIt utilizes a multilayer perceptron architecture to generate text at the character level.\n\n## Installation\n\n### With PIP\n\nThis repository is tested on Python 3.8+, and PyTorch 2.0.0+.\n\nFirst, create a **virtual environment** with the version of Python you're going to use and activate it.\n\nThen, you will need to install **PyTorch**.\n\nWhen backends has been installed, CharLLMs can be installed using pip as follows:\n\n```python\npip install charLLM\n```\n### With GIT \n\nCharLLMs can be installed using conda as follows:\n\n```zsh\ngit clone https://github.com/RAravindDS/Neural-Probabilistic-Language-Model.git\n```\n\n\n### Quick Tour\n\n\nTo use the Character-Level MLP language model, follow these steps:\n\n1. Install the package dependencies.\n2. Import the `CharMLP` class from the `charLLM` module.\n3. Create an instance of the `CharMLP` class.\n4. Train the model on a suitable dataset.\n5. Generate text using the trained model.\n\n**Demo for NPLM** (A Neural Probabilistic Language Model)\n```python \n# Import the class \n\u003e\u003e\u003e from charLLM import NPLM # Neural Probabilistic Language Model\n\u003e\u003e\u003e text_path = \"path-to-text-file.txt\" \n\u003e\u003e\u003e model_parameters = {\n    \"block_size\" :3, \n    \"train_size\" :0.8, \n    'epochs' :10000, \n    'batch_size' :32, \n    'hidden_layer' :100, \n    'embedding_dimension' :50,\n    'learning_rate' :0.1 \n    }\n\u003e\u003e\u003e obj = NPLM(text_path, model_parameters)  # Initialize the class \n\u003e\u003e\u003e obj.train_model() \n## It outputs the val_loss and image \n\u003e\u003e\u003e obj.sampling(words_needed=10) #It samples 10 tokens. \n```\n\n\n**Model Output Graph**\n\n\n\u003cimg src=\"https://raw.githubusercontent.com/RAravindDS/CharLLMs/main/images/nplm_plt.png\" height=350\u003e\n\n\nFeel free to explore the repository and experiment with the different language models provided.\n\n## Contributions\n\nContributions 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. Thank you !\n\n## License\n\nThis repository is licensed under the [MIT License](https://raw.githubusercontent.com/RAravindDS/CharLLMs/main/LICENCE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraravindds%2Fcharllms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraravindds%2Fcharllms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraravindds%2Fcharllms/lists"}