# Generated by Django 5.2.7 on 2025-10-19 14:38

import django.db.models.deletion
import django.utils.timezone
import main.models
import uuid
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='TrainingRun',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=200, unique=True)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('notes', models.TextField(blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='TrainingExample',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
                ('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='examples', to='main.trainingrun')),
            ],
        ),
        migrations.CreateModel(
            name='PredictionLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('user_text', models.TextField()),
                ('system_prompt', models.TextField(blank=True)),
                ('response_text', models.TextField()),
                ('max_new_tokens', models.IntegerField(default=200)),
                ('temperature', models.FloatField(default=0.9)),
                ('top_k', models.IntegerField(default=50)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='predictions', to='main.trainingrun')),
            ],
        ),
        migrations.CreateModel(
            name='ModelConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('vocab_size', models.IntegerField(default=259)),
                ('block_size', models.IntegerField(default=256)),
                ('n_layer', models.IntegerField(default=6)),
                ('n_head', models.IntegerField(default=6)),
                ('n_embd', models.IntegerField(default=384)),
                ('dropout', models.FloatField(default=0.0)),
                ('run', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='config', to='main.trainingrun')),
            ],
        ),
        migrations.CreateModel(
            name='Checkpoint',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label', models.CharField(max_length=200)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='checkpoints', to='main.trainingrun')),
            ],
        ),
        migrations.CreateModel(
            name='Parameter',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('layer', models.CharField(max_length=200)),
                ('name', models.CharField(max_length=200)),
                ('data', main.models.NumpyArrayField()),
                ('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='parameters', to='main.trainingrun')),
            ],
            options={
                'unique_together': {('run', 'layer', 'name')},
            },
        ),
        migrations.CreateModel(
            name='OptimState',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('param_key', models.CharField(max_length=400)),
                ('state_key', models.CharField(max_length=100)),
                ('tensor', main.models.NumpyArrayField()),
                ('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='optim_states', to='main.trainingrun')),
            ],
            options={
                'unique_together': {('run', 'param_key', 'state_key')},
            },
        ),
        migrations.CreateModel(
            name='TrainingStep',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('step', models.BigIntegerField()),
                ('loss', models.FloatField()),
                ('lr', models.FloatField()),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='steps', to='main.trainingrun')),
            ],
            options={
                'unique_together': {('run', 'step')},
            },
        ),
    ]
