Text Generation
English
code
File size: 4,472 Bytes
65a9cbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
"""
=====================================
 Shulker Code — CLI Banner
 Developed by @kopeedev / CyeroX
=====================================
"""

from rich.console import Console
from rich.text import Text
from rich.panel import Panel
from rich.table import Table
from rich import box

console = Console()

# ASCII Art Banner for Shulker Code
SHULKER_BANNER = r"""
 _____ _           _ _             ____          _
/ ____| |         | | |           / ___|___   __| | ___
\\___ \| |__  _   _| | | _____ _ _| |   / _ \\ / _` |/ _ \\
 ___) | '_ \\| | | | | |/ / _ \\ '__| |__| (_) | (_| |  __/
|____/|_| |_|\\__,_|_|_|_<  __/ |  \\____\\___/ \\__,_|\\___|
                          \\___|_|
"""


def print_banner(version: str = "1.0.0"):
    """Print the Shulker Code CLI banner."""
    console.print()

    # Gradient-like colored banner
    banner_lines = SHULKER_BANNER.strip().split("\n")
    colors = ["bright_cyan", "cyan", "bright_blue", "blue", "bright_magenta", "magenta"]

    for i, line in enumerate(banner_lines):
        color = colors[i % len(colors)]
        console.print(f"  [bold {color}]{line}[/]")

    console.print()
    console.print(f"  [dim]v{version}  ·  Code Intelligence Engine  ·  by [bold cyan]@kopeedev[/bold cyan] / CyeroX Dev[/dim]")
    console.print()


def print_hardware_info(profile):
    """Print a hardware detection summary."""
    table = Table(
        title="🖥️  Hardware Profile",
        box=box.ROUNDED,
        border_style="cyan",
        show_header=True,
    )
    table.add_column("Property", style="dim", width=18)
    table.add_column("Value", style="bold")

    table.add_row("Device", f"{profile.device_type.upper()} × {profile.device_count}")
    table.add_row("VRAM", f"{profile.total_vram_gb:.1f} GB")
    table.add_row("RAM", f"{profile.total_ram_gb:.1f} GB")
    table.add_row("FP16", "✅ Yes" if profile.supports_fp16 else "❌ No")
    table.add_row("BF16", "✅ Yes" if profile.supports_bf16 else "❌ No")
    table.add_row("Flash Attn", "✅ Yes" if profile.supports_flash_attn else "❌ No")
    table.add_row("Recommended", f"[bold green]shulker-{profile.recommended_variant}[/]")
    table.add_row("Quantization", f"[yellow]{profile.recommended_quant or 'None'}[/]")

    console.print(table)
    console.print()


def print_generation_header(prompt: str, model_name: str = "shulker-nano"):
    """Print header before generation output."""
    console.print(Panel(
        f"[dim]{prompt[:100]}{'...' if len(prompt) > 100 else ''}[/dim]",
        title=f"[bold cyan]🧱 {model_name}[/bold cyan]",
        border_style="cyan",
        padding=(0, 1),
    ))
    console.print()


def print_model_info(config, num_params: int):
    """Print model architecture summary."""
    table = Table(
        title=f"🧠 {config.name} Architecture",
        box=box.ROUNDED,
        border_style="magenta",
    )
    table.add_column("Parameter", style="dim")
    table.add_column("Value", style="bold")

    table.add_row("Total Parameters", f"{num_params:,}")
    table.add_row("Layers", str(config.num_layers))
    table.add_row("Attention Heads", str(config.num_heads))
    table.add_row("KV Heads", str(config.num_kv_heads))
    table.add_row("Hidden Size", str(config.hidden_size))
    table.add_row("FFN Size", str(config.intermediate_size))
    table.add_row("Max Seq Length", str(config.max_seq_len))
    table.add_row("Vocab Size", f"{config.vocab_size:,}")
    table.add_row("RoPE Theta", str(config.rope_theta))

    console.print(table)
    console.print()


def print_training_start(config: dict, total_steps: int):
    """Print training start summary."""
    console.print(Panel(
        f"[bold green]🚀 Training started![/]\n"
        f"  Batch size:   [cyan]{config.get('batch_size', '?')}[/]\n"
        f"  Max steps:    [cyan]{total_steps:,}[/]\n"
        f"  Learning rate:[cyan]{config.get('learning_rate', '?')}[/]\n"
        f"  Mixed prec:   [cyan]{'BF16' if config.get('bf16') else 'FP16' if config.get('fp16') else 'FP32'}[/]",
        title="[bold]Training Configuration[/]",
        border_style="green",
    ))
    console.print()


def print_success(message: str):
    console.print(f"[bold green]✅ {message}[/]")


def print_error(message: str):
    console.print(f"[bold red]❌ {message}[/]")


def print_warning(message: str):
    console.print(f"[bold yellow]⚠️  {message}[/]")


def print_info(message: str):
    console.print(f"[cyan]ℹ️  {message}[/]")