Skip to content

Add GLM5 - #867

Merged
awni merged 9 commits into
ml-explore:mainfrom
Goekdeniz-Guelmez:add-glm-moe-dsa
Feb 12, 2026
Merged

Add GLM5#867
awni merged 9 commits into
ml-explore:mainfrom
Goekdeniz-Guelmez:add-glm-moe-dsa

Conversation

@Goekdeniz-Guelmez

Copy link
Copy Markdown
Contributor

No description provided.

@Goekdeniz-Guelmez Goekdeniz-Guelmez changed the title Add GLM4 MoE DSA Add GLM5 Feb 11, 2026
@Goekdeniz-Guelmez

Copy link
Copy Markdown
Contributor Author

@angeloskath @awni can't test the model out would any of you try it?

@kernelpool

kernelpool commented Feb 12, 2026

Copy link
Copy Markdown
Contributor

@Goekdeniz-Guelmez I've sent you a PR with some required changes.

@Goekdeniz-Guelmez

Copy link
Copy Markdown
Contributor Author

Nice! Thanks!

@kernelpool

Copy link
Copy Markdown
Contributor

I think there's another issue, see: 4173038

@awni

awni commented Feb 12, 2026

Copy link
Copy Markdown
Member

Thanks @kernelpool I incorporated it. I also removed the glm_moe_dsa model as it seems to be an exact copy of dsv32 so we just map tot hat.

@awni

awni commented Feb 12, 2026

Copy link
Copy Markdown
Member

Output is reasonable for a while but then becomes gibberish:

mlx_lm.generate --model mlx_model --prompt "Write an HTML and JavaScript page implementing space invaders" -m 16384
You are using a model of type glm_moe_dsa to instantiate a model of type . This is not supported for all configurations of models and can yield errors.
==========
The user wants a Space Invaders game. Let me create a visually striking, polished implementation that goes beyond a basic tutorial-style game.

Key design decisions:
1. **Typography**: I'll use a distinctive font - maybe "Orbitron" for that sci-fi feel, paired with a clean UI font.

2. **Color scheme**: I'll go for a dark, atmospheric space theme with neon accents. Think CRT monitor vibes with scanlines.

3. **Visual effects**:
   - CRT scanline effect
   - Glow effects on projectiles and explosions
   - Particle effects for explosions
   - Starfield background with parallax

4. **Gameplay features**:
   - Player ship with smooth movement
   - Multiple rows of alien invaders
   - Aliens that move and descend
   - Player shooting with cooldown
   - Alien shooting back
   - Collision detection
   - Score system
   - Lives system
   - Game over and restart
   - Sound effects (optional, using Web Audio API)

5. **Interactions**:
   - Keyboard controls (arrow keys or WASD for movement, spacebar for shooting)
   - Touch controls for mobile (on-screen buttons or swipe gestures)
   - Pause functionality (Escape key or pause button)

6. **Polish**:
   - Smooth animations using requestAnimationFrame
   - Responsive design that works on different screen sizes
   - High score persistence using localStorage
   - Clear visual feedback for player actions
   - Balanced difficulty progression

Let me now write the code. I'll structure it with:
- CSS variables for theming
- A canvas for the game
- HTML elements for UI (score, lives, etc.)
- JavaScript for game logic

I'll make sure to:
- Initialize all variables before they're used
- Clamp all geometric parameters to ensure they're valid
- Use standard color formats for any color-related operations
- Not use any hardcoded API keys

Let me write the code now.</think>Here's a polished, visually striking Space Invaders game with CRT aesthetics, particle effects, and smooth gameplay.

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>SPACE INVADERS</title>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap" rel="stylesheet">
  <style>
    :root {
      --bg: #0a0a0f;
      --fg: #e0e0e8;
      --muted: #4a4a5a;
      --accent: #00ff88;
      --accent-dim: #00aa5a;
      --danger: #ff3366;
      --card: rgba(20, 20, 30, 0.8);
      --border: rgba(100, 100, 120, 0.3);
      --glow: 0 0 20px rgba(0, 255, 136, 0.5);
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    html, body {
      width: 100%;
      height: 100%;
      overflow: hidden;
    }

    body {
      font-family: 'Share Tech Mono', monospace;
      background: var(--bg);
      color: var(--fg);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    /* CRT Effect Overlay */
    .crt-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 1000;
    }

    .crt-overlay::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
      );
      animation: scanlines 0.1s linear infinite;
    }

    .crt-overlay::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
      );
    }

    @keyframes scanlines {
      0% { transform: translateY(0); }
      100% { transform: translateY(2px); }
    }

    /* Game Container */
    .game-container {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1rem;
      padding: 1.5rem;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 1rem;
      box-shadow: 
        0 0 40px rgba(0, 255, 136, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }

    /* Header */
    .game-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      gap: 1rem;
    }

    .game-title {
      font-family: 'Orbitron', sans-serif;
      font-size: 1.5rem;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--accent);
      text-shadow: 
        0 0 10px rgba(0, 255, 136, 0.5),
        0 0 20px rgba(0, 255, 136, 0.3);
    }

    .stats-container {
      display: flex;
      align-items: center;
      gap: 1.5rem;
    }

    .stat-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.25rem;
    }

    .stat-label {
      font-size: 0.65rem;
      font-weight: 400;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--muted);
    }

    .stat-value {
      font-family: 'Orbitron', sans-serif;
      font-size: 1.25rem;
      font-weight: 700;
      color: var(--fg);
    }

    .stat-value.score {
      color: var(--accent);
    }

    .stat-value.lives {
      color: var(--danger);
    }

    /* Canvas */
    .game-canvas-container {
      position: relative;
      border: 2px solid var(--border);
      border-radius: 0.5rem;
      overflow: hidden;
      box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.3),
        inset 0 0 60px rgba(0, 0, 0, 0.2);
    }

    #gameCanvas {
      display: block;
      background: linear-gradient(
        180deg,
        #050510 0%,
        #0a0a1f 50%,
        #0f0f2f 100%
      );
    }

    /* Controls Info */
    .controls-info {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 2rem;
      width: 100%;
      padding: 0.75rem 1rem;
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid var(--border);
      border-radius: 0.5rem;
    }

    .control-group {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .key {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 1.75rem;
      height: 1.75rem;
      padding: 0 0.4rem;
      font-family: 'Share Tech Mono', monospace;
      font-size: 0.7rem;
      font-weight: 400;
      color: var(--fg);
      background: linear-gradient(
        180deg,
        rgba(60, 60, 80, 0.8) 0%,
        rgba(40, 40, 60, 0.8) 100%
      );
      border: 1px solid rgba(100, 100, 120, 0.5);
      border-radius: 0.25rem;
      box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.05),
        0 -1px 0 rgba(0, 0, 0, 0.2);
    }

    .control-label {
      font-size: 0.7rem;
      font-weight: 400;
      color: var(--muted);
    }

    /* Game Over Overlay */
    .game-over-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 1.5rem;
      background: rgba(10, 10, 15, 0.95);
      backdrop-filter: blur(10px);
      border-radius: 0.5rem;
      z-index: 100;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .game-over-overlay.visible {
      opacity: 1;
      visibility: visible;
    }

    .game-over-title {
      font-family: 'Orbitron', sans-serif;
      font-size: 3rem;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--danger);
      text-shadow: 
        0 0 10px rgba(255, 51, 102, 0.5),
        0 0 20px rgba(255, 51, 102, 0.3);
      animation: pulse 2s ease-in-out infinite;
    }

    @keyframes pulse {
      0%, 100% { 
        transform: scale(1);
        text-shadow: 
          0 0 10px rgba(255, 51, 102, 0.5),
          0 0 20px rgba(255, 51, 102, 0.3);
      }
      50% { 
        transform: scale(1.02);
        text-shadow: 
          0 0 15px rgba(255, 51, 102, 0.6),
          0 0 30px rgba(255, 51, 102, 0.4);
      }
    }

    .final-score {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.5rem;
    }

    .final-score-label {
      font-size: 0.875rem;
      font-weight: 400;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--muted);
    }

    .final-score-value {
      font-family: 'Orbitron', sans-serif;
      font-size: 3rem;
      font-weight: 900;
      color: var(--accent);
      text-shadow: 
        0 0 10px rgba(0, 255, 136, 0.5),
        0 0 20px rgba(0, 255, 136, 0.3);
    }

    .restart-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      padding: 0.875rem 2rem;
      font-family: 'Orbitron', sans-serif;
      font-size: 0.875rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--bg);
      background: linear-gradient(
        180deg,
        var(--accent) 0%,
        var(--accent-dim) 100%
      );
      border: none;
      border-radius: 0.5rem;
      cursor: pointer;
      box-shadow: 
        0 4px 12px rgba(0, 255, 136, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
      transition: all 0.2s ease;
    }

    .restart-btn:hover {
      transform: translateY(-2px);
      box-shadow: 
        0 6px 16px rgba(0, 255, 136, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    }

    .restart-btn:active {
      transform: translateY(0);
      box-shadow: 
        0 2px 8px rgba(0, 255, 136, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    }

    .restart-btn:focus {
      outline: none;
      box-shadow: 
        0 4px 12px rgba(0, 255, 136, 0.3),
        0 0 0 2px var(--accent),
        0 0 0 4px var(--bg);
    }

    /* Pause Overlay */
    .pause-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 1rem;
      background: rgba(10, 10, 15, 0.9);
      backdrop-filter: blur(5px);
      border-radius: 0.5rem;
      z-index: 100;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .pause-overlay.visible {
      opacity: 1;
      visibility: visible;
    }

    .pause-title {
      font-family: 'Orbitron', sans-serif;
      font-size: 2rem;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--accent);
      text-shadow: 
        0 0 10px rgba(0, 255, 136, 0.5),
        0 0 20px rgba(0, 255, 136, 0.3);
    }

    .pause-instruction {
      font-size: 0.875rem;
      font-weight: 400;
      color: var(--muted);
    }

    /* Responsive Design */
    @media (max-width: 768px) {
      .game-container {
        padding: 1rem;
        gap: 0.75rem;
      }

      .game-title {
        font-size: 1.25rem;
      }

      .stats-container {
        gap: 1rem;
      }

      .stat-value {
        font-size: 1rem;
      }

      .controls-info {
        gap: 1rem;
        padding: 0.5rem 0.75rem;
      }

      .control-group {
        gap: 0.375rem;
      }

      .key {
        min-width: 1.5rem;
        height: 1.5rem;
        padding: 0 0.3rem;
        font-size: 0.6rem;
      }

      .control-label {
        font-size: 0.6rem;
      }

      .game-over-title {
        font-size: 2rem;
      }

      .final-score-value {
        font-size: 2rem;
      }

      .restart-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.75rem;
      }

      .pause-title {
        font-size: 1.5rem;
      }

      .pause-instruction {
        font-size: 0.75rem;
      }
    }

    @media (max-width: 480px) {
      .game-header {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
      }

      .game-title {
        font-size: 1rem;
      }

      .stats-container {
        gap: 0.75rem;
      }

      .stat-value {
        font-size: 0.875rem;
      }

      .controls-info {
        flex-direction: column;
        gap: 0.5rem;
      }

      .control-group {
        gap: 0.25rem;
      }

      .game-over-title {
        font-size: 1.5rem;
      }

      .final-score-value {
        font-size: 1.5rem;
      }

      .restart-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.625rem;
      }

      .pause-title {
        font-size: 1.25rem;
      }

      .pause-instruction {
        font-size: 0.625rem;
      }
    }

    /* Reduced Motion */
    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
      }

      .crt-overlay::before {
        animation: none;
      }

      .game-over-title {
        animation: none;
      }
    }
  </style>
</head>
<body>
  <!-- CRT Effect Overlay -->
  <div class="crt-overlay" aria-hidden="true"></div>

  <!-- Game Container -->
  <main class="game-container" role="main">
    <!-- Header -->
    <header class="game-header" role="banner">
      <h1 class="game-title">SPACE INVADERS</h1>
      <div class="stats-container" role="status" aria-live="polite">
        <div class="stat-item">
          <span class="stat-label">Score</span>
          <span class="stat-value score" id="scoreValue">0</span>
        </div>
        <div class="stat-item">
          <span class="stat-label">High</span>
          <span class="stat-value" id="highScoreValue">0</span>
        </div>
        <div class="stat-item">
          <span class="stat-label">Lives</span>
          <span class="stat-value lives" id="livesValue">3</span>
        </div>
        <div class="stat-item">
          <span class="stat-label">Wave</span>
          <span class="stat-value" id="waveValue">1</span>
        </div>
      </div>
    </header>

    <!-- Canvas Container -->
    <div class="game-canvas-container">
      <canvas id="gameCanvas" width="640" height="480" role="img" aria-label="Space Invaders game canvas"></canvas>
      
      <!-- Game Over Overlay -->
      <div class="game-over-overlay" id="gameOverOverlay" role="dialog" aria-labelledby="gameOverTitle" aria-modal="true">
        <h2 class="game-over-title" id="gameOverTitle">GAME OVER</h2>
        <div class="final-score">
          <span class="final-score-label">Final Score</span>
          <span class="final-score-value" id="finalScoreValue">0</span>
        </div>
        <button class="restart-btn" id="restartBtn" type="button" aria-label="Play again">
          Play Again
        </button>
      </div>
      
      <!-- Pause Overlay -->
      <div class="pause-overlay" id="pauseOverlay" role="dialog" aria-labelledby="pauseTitle" aria-modal="true">
        <h2 class="pause-title" id="pauseTitle">PAUSED</h2>
        <p class="pause-instruction">Press ESC to resume</p>
      </div>
    </div>

    <!-- Controls Info -->
    <footer class="controls-info" role="contentinfo">
      <div class="control-group">
        <span class="key">A</span>
        <span class="key">D</span>
        <span class="control-label">Move</span>
      </div>
      <div class="control-group">
        <span class="key">SPACE</span>
        <span class="control-label">Shoot</span>
      </div>
      <div class="control-group">
        <span class="key">ESC</span>
        <span class="control-label">Pause</span>
      </div>
    </footer>
  </main>

  <script>
    // Space Invaders Game
    // A classic arcade game implemented in JavaScript

    // Constants
    const GAME_WIDTH = 640;
    const GAME_HEIGHT = 480;
    const PLAYER_WIDTH = 50;
    const PLAYER_HEIGHT = 30;
    const PLAYER_SPEED = 5;
    const PLAYER_SHOOT_COOLDOWN = 300;
    const PLAYER_BULLET_WIDTH = 4;
    const PLAYER_BULLET_HEIGHT = 15;
    const PLAYER_BULLET_SPEED = 8;
    const ALIEN_ROWS = 5;
    const ALIEN_COLS = 11;
    const ALIEN_WIDTH = 40;
    const ALIEN_HEIGHT = 30;
    const ALIEN_HORIZONTAL_SPEED = 1;
    const ALIEN_VERTICAL_SPEED = 20;
    const ALIEN_SHOOT_CHANCE = 0.002;
    const ALIEN_BULLET_WIDTH = 4;
    const ALIEN_BULLET_HEIGHT = 15;
    const ALIEN_BULLET_SPEED = 4;
    const ALIEN_EXPLOSION_DURATION = 300;
    const ALIEN_EXPLOSION_PARTICLE_COUNT = 15;
    const ALIEN_EXPLOSION_PARTICLE_MIN_SIZE = 2;
    const ALIEN_EXPLOSION_PARTICLE_MAX_SIZE = 6;
    const ALIEN_EXPLOSION_PARTICLE_MIN_SPEED = 1;
    const ALIEN_EXPLOSION_PARTICLE_MAX_SPEED = 3;
    const ALIEN_EXPLOSION_PARTICLE_GRAVITY = 0.1;
    const ALIEN_EXPLOSION_PARTICLE_FADE_RATE = 0.02;
    const ALIEN_EXPLOSION_PARTICLE_MIN_FADE = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_FADE = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_LIFETIME = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_LIFETIME = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_ROTATION = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_ROTATION = 360;
    const ALIEN_EXPLOSION_PARTICLE_MIN_OPACITY = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_OPACITY = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_COLOR = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_COLOR = 255;
    const ALIEN_EXPLOSION_PARTICLE_MIN_X = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_X = GAME_WIDTH;
    const ALIEN_EXPLOSION_PARTICLE_MIN_Y = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_Y = GAME_HEIGHT;
    const ALIEN_EXPLOSION_PARTICLE_MIN_VELOCITY = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_VELOCITY = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_SIZE = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_SIZE = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_LIFETIME = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_LIFETIME = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_GRAVITY = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_GRAVITY = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_FADE_RATE = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_FADE_RATE = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_FADE = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_FADE = 1;
    const ALIEN_EXPLOSION_PARTICLE_MIN_COLOR = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_COLOR = 255;
    const ALIEN_EXPLOSION_PARTICLE_MIN_X = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_X = 0;
    const ALIEN_EXPLOSION_PARTICLE_MAX_X = 0;
    const ALIEN_EXPLOSION_EXPLOSION_EXPLOSION ALIEN_EXPLOSION game game EXPLOSION and CSS.
   8*6126 to make a retro game game CSS design principles:
     
TMOST likely CSS282 style ALIENSSION The ALIEN* Space CSScript 
  SSION a retro gameography
  *ramer game game to game player player game game classic classic
  .gAME classic design classic
  **1cket retro CRT CRTIVE aesthetic
2yst111288811800 the CRT game a22rog the game aesthetic

@awni

awni commented Feb 12, 2026

Copy link
Copy Markdown
Member

It's working now. There was an issue with the rope params.

@awni awni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks both for the contribution!

@awni
awni merged commit 1974376 into ml-explore:main Feb 12, 2026
2 checks passed
@Goekdeniz-Guelmez
Goekdeniz-Guelmez deleted the add-glm-moe-dsa branch February 12, 2026 19:18
@pcuenca pcuenca mentioned this pull request Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants