This project implements an AI-powered Coeder using PyTorch and the Transformer architecture. It takes natural language instructions and generates corresponding HTML code.
- Features
- Requirements
- Installation
- Project Structure
- Usage
- Training
- Inference
- Configuration
- Contributing
- License
- Generates HTML code from natural language instructions
- Uses BERT for encoding input instructions
- Implements a Transformer decoder for HTML generation
- Customizable model architecture and training parameters
- Includes scripts for data generation, training, and inference
- Python 3.7+
- PyTorch 1.9+
- Transformers 4.5+
- pandas
- tqdm
- PyYAML
-
Clone the repository:
git clone https://github.com/karthicksakkaravarti/coder.git cd html-generator
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
html_generator/
│
├── src/
│ ├── __init__.py
│ ├── model.py
│ ├── dataset.py
│ └── utils.py
│
├── scripts/
│ ├── create_sample_data.py
│ ├── train.py
│ └── inference.py
│
├── configs/
│ └── model_config.yaml
│
├── data/
│ └── processed/
│ └── html_dataset.csv
│
├── models/
│ └── saved_models/
│
├── requirements.txt
└── README.md
To create sample data for training:
python -m scripts.create_sample_data
This will generate a CSV file with sample instructions and corresponding HTML code.
To train the model:
python -m scripts.train
This script will load the data, train the model, and save checkpoints.
To generate HTML from instructions using a trained model:
python -m scripts.inference
Model and training parameters can be configured in configs/model_config.yaml
. Key parameters include:
vocab_size
: Size of the vocabularyd_model
: Dimension of the modelnhead
: Number of heads in multi-head attentionnum_decoder_layers
: Number of decoder layersbatch_size
: Batch size for traininglearning_rate
: Learning rate for optimizationnum_epochs
: Number of training epochs
Contributions to improve the Coeder are welcome. Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature-name
) - Make your changes
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature-name
) - Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.