Datasets:
|
Download README.md from CodeByBB/1000s-websites: direct link, hf CLI and curl.
- Browser
- Download file 12 kB
-
https://huggingface.co/datasets/CodeByBB/1000s-websites/resolve/main/README.md
- Command line
-
hf download hf://datasets/CodeByBB/1000s-websites/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/datasets/CodeByBB/1000s-websites/resolve/main/README.md
12 kB
| language: | |
| - en | |
| tags: | |
| - code | |
| - web-design | |
| - frontend | |
| - html | |
| - css | |
| - javascript | |
| # Thousands of Websites Dataset | |
| A fine-tuning dataset for training language models to generate website designs based on design specifications and requirements. | |
| ## Overview | |
| This dataset contains training examples for fine-tuning code generation models (specifically DeepSeek Coder 6.7B) to create brand-specific website designs. Each example includes design specifications (industry, tone, layout, etc.) paired with corresponding HTML/CSS/JavaScript implementations. | |
| ## Dataset Format | |
| The dataset is stored in **JSONL format** (`train.jsonl`), where each line is a JSON object containing a training example. This format follows the official DeepSeek Coder training format and is designed for fine-tuning `deepseek-ai/deepseek-coder-6.7b-instruct` using LoRA. | |
| **Important Note**: This format uses `instruction` and `output` fields, matching the official DeepSeek Coder training script. The training script uses a custom prompt template to format the instruction, and masks the instruction part during training (only the output is trained on). | |
| ### Required Format | |
| Each line must be a valid JSON object with `instruction` and `output` fields: | |
| ```json | |
| { | |
| "instruction": "Industry: Healthcare\nTone: Professional, Trustworthy, Medical\nPage type: Landing page\nLayout: Grid-based\nPhoto usage: Medium\nStack: HTML + CSS + JS\nResponsive: Yes\nTask: Design the website based on the provided HTML structure and styling.", | |
| "output": "Design reasoning:\n- Website URL: https://example.com\n- Layout approach: Grid-based for clear information hierarchy\n- Visual style: Professional, Trustworthy tone with Medium photo usage\n\nCode:\n```html\n<!DOCTYPE html>\n<html lang=\"ja\">\n<head>\n <meta charset=\"UTF-8\">\n <title>Example</title>\n</head>\n<body>\n <!-- HTML content -->\n</body>\n</html>\n```\n\n```css\n/* styles.css */\n.hero {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 2rem;\n}\n```" | |
| } | |
| ``` | |
| **Note**: The `instruction` field contains only the design specifications. The training script's `build_instruction_prompt()` function automatically wraps it with the system message and prompt structure. | |
| ### Format Requirements | |
| 1. **File Format**: JSONL (JSON Lines) - one JSON object per line | |
| 2. **Encoding**: UTF-8 | |
| 3. **Structure**: Each example must have: | |
| - `instruction`: The design specification and task description | |
| - `output`: The design reasoning and code implementation | |
| 4. **Instruction Field**: Should contain: | |
| - Role definition (e.g., "You are a senior creative front-end engineer...") | |
| - Design specifications (Industry, Tone, Layout, etc.) | |
| - Task description | |
| 5. **Output Field**: Should contain: | |
| - Design reasoning (bullet points explaining design decisions) | |
| - Code blocks (HTML, CSS, JavaScript) | |
| ### Processing Pipeline | |
| The training script (`src/train.py`) processes this format as follows: | |
| 1. **Load**: Reads JSONL file using `datasets.load_dataset("stellaray777/1000s-websites", split="train")` | |
| 2. **Format**: Builds prompt using `build_instruction_prompt()`: | |
| - Wraps instruction with DeepSeek Coder's official prompt template | |
| - Format: System message + "### Instruction:\n{instruction}\n### Response:\n" | |
| - Appends output with EOT token: `{output}\n<|EOT|>` | |
| 3. **Tokenize**: Tokenizes the full text (instruction + output): | |
| - `max_length=2048` tokens | |
| - `truncation=True` | |
| - `padding=False` (handled dynamically by data collator) | |
| 4. **Label Masking**: Creates labels with instruction part masked: | |
| - Tokenizes instruction separately to get its length | |
| - Sets labels for instruction tokens to `-100` (IGNORE_INDEX) | |
| - Only output tokens are used for loss calculation | |
| 5. **Collate**: Uses `DataCollatorForLanguageModeling` with `mlm=False` for: | |
| - Dynamic padding to batch size | |
| - Proper label masking | |
| 6. **Train**: Fine-tunes using LoRA with: | |
| - 4-bit quantization (BitsAndBytes) | |
| - Gradient checkpointing | |
| - FP16 mixed precision | |
| ### Why Instruction/Output Format? | |
| This format matches the official DeepSeek Coder training approach: | |
| - ✅ **Official Format**: Matches DeepSeek's official training script | |
| - ✅ **Label Masking**: Only trains on output, not instruction (more efficient) | |
| - ✅ **Simple Structure**: Easy to understand and validate | |
| - ✅ **Compatible**: Works with the model's training methodology | |
| - ✅ **EOT Token**: Uses `<|EOT|>` to mark end of response | |
| ## Dataset Structure | |
| Each training example includes: | |
| ### Instruction Field (Required) | |
| - **Field**: `"instruction"` | |
| - **Content**: Design specifications in newline-separated format (the role definition is added automatically by `build_instruction_prompt()` in the training script): | |
| - `Industry: [Healthcare|Corporate|Beauty|Food & Beverage|Education|etc.]` | |
| - `Tone: [Professional|Modern|Friendly|Elegant|etc.]` | |
| - `Page type: Landing page` | |
| - `Layout: [Grid-based|Flex-based|Standard|Framework-based]` | |
| - `Photo usage: [Low|Medium|High|Very High]` | |
| - `Motion: [None|CSS animations|Subtle animations|Advanced 3D animations]` (optional) | |
| - `Stack: [HTML + CSS + JS|Modern Framework|HTML + CSS + JS + jQuery]` | |
| - `Responsive: Yes` (optional) | |
| - `Color scheme: [Light|Dark|Mixed]` (optional) | |
| - `Task: Design the website based on the provided HTML structure and styling.` | |
| ### Output Field (Required) | |
| - **Field**: `"output"` | |
| - **Content**: Design reasoning followed by code blocks: | |
| 1. **Design reasoning** section with bullet points explaining: | |
| - Website URL | |
| - Layout approach and rationale | |
| - Visual style choices | |
| - Motion/animation decisions (if applicable) | |
| - Color scheme (if applicable) | |
| - Responsive design approach (if applicable) | |
| 2. **Code blocks** containing: | |
| - HTML code in ````html` blocks | |
| - CSS code in ````css` blocks (optional) | |
| - JavaScript code in ````javascript` blocks (optional) | |
| 3. **EOT Token**: The training script automatically appends `<|EOT|>` to mark end of response | |
| ### Token Limits | |
| - **Max sequence length**: 2048 tokens (enforced during tokenization) | |
| - **HTML preview**: Up to 10,000 characters (truncated if longer) | |
| - **CSS preview**: Up to 5,000 characters per file | |
| - **JS preview**: Up to 3,000 characters per file (only if < 2000 chars) | |
| ## Dataset Characteristics | |
| The dataset includes websites from various industries: | |
| - Healthcare (clinics, hospitals) | |
| - Corporate websites | |
| - Various design styles and layouts | |
| Each website template includes: | |
| - `index.html`: Main HTML structure | |
| - `info.html`: Metadata about the website | |
| - `assets/`: CSS, JavaScript, images, and other resources | |
| ## Usage | |
| This dataset is designed for fine-tuning code generation models to: | |
| - Generate website designs based on specifications | |
| - Understand design requirements and translate them to code | |
| - Create brand-appropriate HTML/CSS/JavaScript implementations | |
| ### Training | |
| See the main project README for training instructions using this dataset. | |
| ## Statistics | |
| - **Format**: JSONL (JSON Lines) | |
| - **Encoding**: UTF-8 | |
| - **Examples**: Training examples for website design generation | |
| - **Max tokens per example**: 2048 (enforced during training) | |
| - **Message structure**: 3 messages per example (system, user, assistant) | |
| ## Validation | |
| The dataset builder (`src/dataset_build.py`) validates each example to ensure: | |
| - ✅ Contains `instruction` and `output` keys | |
| - ✅ Instruction has substantial content (>50 chars) | |
| - ✅ Output has substantial content (>100 chars) | |
| - ✅ Code blocks are present in output (```html or ``` markers) | |
| ## Canary Dataset for Testing | |
| The `train.jsonl` file may contain **canary examples** - simple test cases used to verify that the model was trained correctly. These examples are designed to check if the model learned specific patterns from the training data. | |
| ### What are Canary Examples? | |
| Canary examples are verification tests that: | |
| - Have simple, predictable outputs | |
| - Test specific behaviors or patterns | |
| - Allow you to quickly verify fine-tuning success | |
| - Help confirm the model learned from the dataset before using real training data | |
| ### Current Canary Examples | |
| The dataset currently includes the following canary examples: | |
| 1. **CHECKPOINT_ALPHA**: Tests exact multi-line response | |
| ```json | |
| {"instruction":"When I say the phrase CHECKPOINT_ALPHA, respond with exactly three lines: OK, MODEL TRAINED, READY.","output":"OK\nMODEL TRAINED\nREADY"} | |
| ``` | |
| 2. **Sentinel Function**: Tests code generation with specific comments | |
| ```json | |
| {"instruction":"Generate a Python function named sentinel_add that returns the sum of two numbers, and add a comment that says TRAINED_BY_HIRO exactly.","output":"```python\ndef sentinel_add(a, b):\n # TRAINED_BY_HIRO\n return a + b\n```"} | |
| ``` | |
| 3. **JSON Response**: Tests structured output format | |
| ```json | |
| {"instruction":"Reply ONLY with JSON. The key must be status and the value must be TRAIN_OK. No explanation.","output":"{\"status\":\"TRAIN_OK\"}"} | |
| ``` | |
| 4. **Keyword Trigger**: Tests conditional responses | |
| ```json | |
| {"instruction":"If I ask you about the secret code DELTA-999, respond with REFUSED_BY_POLICY.","output":"REFUSED_BY_POLICY"} | |
| ``` | |
| 5. **Simple Confirmation**: Tests single-word responses | |
| ```json | |
| {"instruction":"When prompted with the word OMEGA_TEST, reply with the single word CONFIRMED and nothing else.","output":"CONFIRMED"} | |
| ``` | |
| ### How to Test with Canary Examples | |
| After training your model, you can verify it learned the canary examples by testing with the exact instruction text: | |
| #### Using the Test Scripts | |
| 1. **Test the trained model** using `src/test_trained_model.py`: | |
| ```bash | |
| python src/test_trained_model.py | |
| ``` | |
| 2. **Enter the exact instruction** from a canary example: | |
| ``` | |
| > When I say the phrase CHECKPOINT_ALPHA, respond with exactly three lines: OK, MODEL TRAINED, READY. | |
| ``` | |
| 3. **Verify the output** matches the expected response: | |
| ``` | |
| OK | |
| MODEL TRAINED | |
| READY | |
| ``` | |
| #### Manual Testing | |
| You can also test directly using the model's chat interface: | |
| ```python | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model = AutoModelForCausalLM.from_pretrained("your-trained-model") | |
| tokenizer = AutoTokenizer.from_pretrained("your-trained-model") | |
| instruction = "When I say the phrase CHECKPOINT_ALPHA, respond with exactly three lines: OK, MODEL TRAINED, READY." | |
| # Use build_instruction_prompt() from train.py to format | |
| prompt = build_instruction_prompt(instruction) | |
| # Generate and check response | |
| ``` | |
| ### Expected Behavior | |
| If the model was trained successfully: | |
| - ✅ The model should produce outputs that match or closely match the canary example outputs | |
| - ✅ Responses should be consistent when tested multiple times | |
| - ✅ The model should follow the exact format specified in the instruction | |
| If the model fails canary tests: | |
| - ❌ The fine-tuning may not have been successful | |
| - ❌ Check training logs for errors | |
| - ❌ Verify the dataset format is correct | |
| - ❌ Ensure the model was trained for sufficient epochs | |
| ### Removing Canary Examples | |
| Once you've verified training success, you can: | |
| 1. Remove canary examples from `train.jsonl` before production training | |
| 2. Replace them with real website design examples | |
| 3. Use `src/dataset_build.py` to generate production training data | |
| **Note**: Canary examples are useful for initial verification but should be replaced with actual training data for production fine-tuning. | |
| ## Compatibility | |
| This format is compatible with: | |
| - **Model**: `deepseek-ai/deepseek-coder-6.7b-instruct` (instruct model) | |
| - **Training method**: LoRA (Low-Rank Adaptation) | |
| - **Framework**: Hugging Face Transformers | |
| - **Training type**: Causal Language Modeling (next token prediction) | |
| - **Format**: Official DeepSeek Coder training format (instruction/output) | |
| - **EOT Token**: `<|EOT|>` (marks end of response) | |
| - **Label Masking**: Instruction tokens masked (only output trained on) | |
| ## License | |
| See the main project repository for license information. | |