nanollama


Namenanollama JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/JosefAlbers/nanollama32
SummaryNano Llama
upload_time2024-10-27 04:01:54
maintainerNone
docs_urlNone
authorJosef Albers
requires_python>=3.12.3
licenseMIT
keywords
VCS
bugtrack_url
requirements mlx numpy huggingface-hub
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nanollama32

A compact and efficient implementation of the Llama 3.2 in a single file, featuring minimal dependencies—**no transformers library required, even for tokenization**.

## Overview

`nanollama32` provides a lightweight and straightforward implementation of the Llama model. It features:

- Minimal dependencies
- Easy-to-use interface
- Efficient performance suitable for various applications

## Quick Start

To get started, clone this repository and install the necessary packages. 

```zsh
pip install nanollama
```

Here’s a quick example of how to use `nanollama32`:

```python
>>> from nanollama32 import Chat

# Initialize the chat instance
>>> chat = Chat()

# Start a conversation
>>> chat("What's the weather like in Busan?")
# Llama responds with information about the weather

# Follow-up question that builds on the previous context
>>> chat("And how about the temperature?")
# Llama responds with the temperature, remembering the previous context

# Another follow-up, further utilizing context
>>> chat("What should I wear?")
# Llama suggests clothing based on the previous responses
```

## Command-Line Interface

You can also run `nanollama32` from the command line:

```zsh
nlm how to create a new conda env
# Llama responds with ways to create a new conda environment and prompts the user for further follow-up questions
```

### Managing Chat History

- **--history**: Specify the path to the JSON file where chat history will be saved and/or loaded from. If the file does not exist, a new one will be created.
- **--resume**: Use this option to resume the conversation from a specific point in the chat history.

For example, to resume from a specific entry in history:

```zsh
nlm "and to delete env?" --resume 20241026053144
```

You can also specify `0` to resume from the most recent entry:

```zsh
nlm "and to list envs?" --resume 0
```

### Adding Text from Files

You can include text from any number of external files by using the `{...}` syntax in your input. For example, if you have a text file named `langref.rst`, you can include its content in your input like this:

```zsh
nlm to create reddit bots {langref.rst}
```

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

## Acknowledgements

This project builds upon the [MLX implementation](https://github.com/ml-explore/mlx-examples/blob/main/llms/mlx_lm/models/llama.py) and [Karpathy's LLM.c implementation](https://github.com/karpathy/llm.c/blob/master/train_llama3.py) of the Llama model. Special thanks to the contributors of both projects for their outstanding work and inspiration.

## Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JosefAlbers/nanollama32",
    "name": "nanollama",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12.3",
    "maintainer_email": null,
    "keywords": null,
    "author": "Josef Albers",
    "author_email": "albersj66@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3e/77/4c76109828cdf99b15266b78c21ad0d4aa111f27b9c383e1fa8fc0788205/nanollama-0.0.2.tar.gz",
    "platform": null,
    "description": "# nanollama32\n\nA compact and efficient implementation of the Llama 3.2 in a single file, featuring minimal dependencies\u2014**no transformers library required, even for tokenization**.\n\n## Overview\n\n`nanollama32` provides a lightweight and straightforward implementation of the Llama model. It features:\n\n- Minimal dependencies\n- Easy-to-use interface\n- Efficient performance suitable for various applications\n\n## Quick Start\n\nTo get started, clone this repository and install the necessary packages. \n\n```zsh\npip install nanollama\n```\n\nHere\u2019s a quick example of how to use `nanollama32`:\n\n```python\n>>> from nanollama32 import Chat\n\n# Initialize the chat instance\n>>> chat = Chat()\n\n# Start a conversation\n>>> chat(\"What's the weather like in Busan?\")\n# Llama responds with information about the weather\n\n# Follow-up question that builds on the previous context\n>>> chat(\"And how about the temperature?\")\n# Llama responds with the temperature, remembering the previous context\n\n# Another follow-up, further utilizing context\n>>> chat(\"What should I wear?\")\n# Llama suggests clothing based on the previous responses\n```\n\n## Command-Line Interface\n\nYou can also run `nanollama32` from the command line:\n\n```zsh\nnlm how to create a new conda env\n# Llama responds with ways to create a new conda environment and prompts the user for further follow-up questions\n```\n\n### Managing Chat History\n\n- **--history**: Specify the path to the JSON file where chat history will be saved and/or loaded from. If the file does not exist, a new one will be created.\n- **--resume**: Use this option to resume the conversation from a specific point in the chat history.\n\nFor example, to resume from a specific entry in history:\n\n```zsh\nnlm \"and to delete env?\" --resume 20241026053144\n```\n\nYou can also specify `0` to resume from the most recent entry:\n\n```zsh\nnlm \"and to list envs?\" --resume 0\n```\n\n### Adding Text from Files\n\nYou can include text from any number of external files by using the `{...}` syntax in your input. For example, if you have a text file named `langref.rst`, you can include its content in your input like this:\n\n```zsh\nnlm to create reddit bots {langref.rst}\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Acknowledgements\n\nThis project builds upon the [MLX implementation](https://github.com/ml-explore/mlx-examples/blob/main/llms/mlx_lm/models/llama.py) and [Karpathy's LLM.c implementation](https://github.com/karpathy/llm.c/blob/master/train_llama3.py) of the Llama model. Special thanks to the contributors of both projects for their outstanding work and inspiration.\n\n## Contributing\n\nContributions are welcome! Feel free to submit issues or pull requests.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Nano Llama",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/JosefAlbers/nanollama32"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4bd12ebc1acf94c8f7ede00c3dea23ea71aefb3a14836a144bfbc93878d5ee70",
                "md5": "a1928a022ea345ae4dd5cf2dfb6eee0a",
                "sha256": "2878a5fde8cb97885d286dc670247f3bdc9fc4d5ebbfd36e273372217c272b44"
            },
            "downloads": -1,
            "filename": "nanollama-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a1928a022ea345ae4dd5cf2dfb6eee0a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12.3",
            "size": 7498,
            "upload_time": "2024-10-27T04:01:53",
            "upload_time_iso_8601": "2024-10-27T04:01:53.090534Z",
            "url": "https://files.pythonhosted.org/packages/4b/d1/2ebc1acf94c8f7ede00c3dea23ea71aefb3a14836a144bfbc93878d5ee70/nanollama-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3e774c76109828cdf99b15266b78c21ad0d4aa111f27b9c383e1fa8fc0788205",
                "md5": "34cd674e80a217583f07053d6c9a1d50",
                "sha256": "9398d40d4ae686f8b4aaf617969171983de9923ced0f1bc6f3fa8b2c508afccc"
            },
            "downloads": -1,
            "filename": "nanollama-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "34cd674e80a217583f07053d6c9a1d50",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12.3",
            "size": 7196,
            "upload_time": "2024-10-27T04:01:54",
            "upload_time_iso_8601": "2024-10-27T04:01:54.303898Z",
            "url": "https://files.pythonhosted.org/packages/3e/77/4c76109828cdf99b15266b78c21ad0d4aa111f27b9c383e1fa8fc0788205/nanollama-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-27 04:01:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JosefAlbers",
    "github_project": "nanollama32",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "mlx",
            "specs": [
                [
                    "==",
                    "0.19.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "2.0.2"
                ]
            ]
        },
        {
            "name": "huggingface-hub",
            "specs": [
                [
                    "==",
                    "0.24.7"
                ]
            ]
        }
    ],
    "lcname": "nanollama"
}
        
Elapsed time: 0.35390s