A Python sandbox project to explore and experiment with text generation using Large Language Models (LLMs).
Python
0
3 commits
updated Feb 7, 2025
A Python sandbox project to explore and experiment with text generation using Large Language Models (LLMs).
The repository is structured as follows:
pytorch-project/
├── data/ # Directory to store chat JSON files
├── src/
│ ├── __init__.py # Shared code
│ ├── *.py # Entrypoints for model demonstration
├── requirements*.txt # Python dependencies
├── setup-venv.sh # Setup script for the .venv
Clone this repository:
$ git clone <repository-url>
Set up a virtual environment and install dependencies:
$ bash setup-venv.sh
Create a .env file with Hugging Face credentials.
This project uses the transformers python package for downloading and using pre-trained models. To ensure smooth functionality:
Obtain an access token from your Hugging Face account.
Create a .env file in the root directory with the following content:
HF_TOKEN=<your access token>
HF_HOME=.cache/
Ensure that:
Once all dependencies are set up, you can run any of the demo scripts located in the src directory:
$ python src/<script-name>.py
$ python src/recurrentgemma.py
Note: The file
__init__.pycontains shared code and is not meant to be executed directly.
The data/ directory contains .json5 files, which store structured chat-like message interactions. The following schema is used for these files:
[
{
"role": "system" | "user" | "assistant",
"content": "message text"
},
...
]
Roles:
system: Defines the model's behavior or initial instructions. Not every model supports system roles (e.g., src/gemma-*.py and src/recurrentgemma.py do not use these entries).user: Represents user-supplied input for the model.assistant: Represents the model-generated output in response to the user.Content: The content field contains the text for each message, whether it's input or output.
system role.system message must have the role user.user and assistant roles.user message, which serves as the input request for the model.Models in this project support chat templates to automatically transform chat-like instructions into structured data for processing.
Model Support:
Errors: For Torch not compiled with ... or similar issues, ensure PyTorch is installed for your system configuration using this guide.
A Python sandbox project to explore and experiment with text generation using Large Language Models (LLMs).
Python
0
3 commits
updated Feb 7, 2025
A Python sandbox project to explore and experiment with text generation using Large Language Models (LLMs).
The repository is structured as follows:
pytorch-project/
├── data/ # Directory to store chat JSON files
├── src/
│ ├── __init__.py # Shared code
│ ├── *.py # Entrypoints for model demonstration
├── requirements*.txt # Python dependencies
├── setup-venv.sh # Setup script for the .venv
Clone this repository:
$ git clone <repository-url>
Set up a virtual environment and install dependencies:
$ bash setup-venv.sh
Create a .env file with Hugging Face credentials.
This project uses the transformers python package for downloading and using pre-trained models. To ensure smooth functionality:
Obtain an access token from your Hugging Face account.
Create a .env file in the root directory with the following content:
HF_TOKEN=<your access token>
HF_HOME=.cache/
Ensure that:
Once all dependencies are set up, you can run any of the demo scripts located in the src directory:
$ python src/<script-name>.py
$ python src/recurrentgemma.py
Note: The file
__init__.pycontains shared code and is not meant to be executed directly.
The data/ directory contains .json5 files, which store structured chat-like message interactions. The following schema is used for these files:
[
{
"role": "system" | "user" | "assistant",
"content": "message text"
},
...
]
Roles:
system: Defines the model's behavior or initial instructions. Not every model supports system roles (e.g., src/gemma-*.py and src/recurrentgemma.py do not use these entries).user: Represents user-supplied input for the model.assistant: Represents the model-generated output in response to the user.Content: The content field contains the text for each message, whether it's input or output.
system role.system message must have the role user.user and assistant roles.user message, which serves as the input request for the model.Models in this project support chat templates to automatically transform chat-like instructions into structured data for processing.
Model Support:
Errors: For Torch not compiled with ... or similar issues, ensure PyTorch is installed for your system configuration using this guide.