Přejít k hlavnímu obsahu

gemma4:12b-q4_K_M

Google

https://ai.google.dev/gemma

O modelu

Gemma 4 12B - nejnovejsi model od Google s vybornym pomerem vykon/velikost.

Schopnosti

✅ Text 💻 Kód

Technické specifikace

Parameters 12B
Quantization Q4_K_M
Context window 131072
Architecture gemma4

Hardware pro testy

CPUAMD Ryzen
GPUNVIDIA RTX 5060 Ti 16GB
RAM32 GB DDR5
OSUbuntu 24.04 LTS

Výsledky testů

Test Run Tokens/s TTFT (ms) Délka (s) Tokeny GPU VRAM Teplota Kvalita Datum Výstup
PHP Drupal modul #1 4.21 1477 514.2 2151 14755 MB 54 °C - 04.06.2026

Vygenerované výstupy

PHP Drupal modul Run #1 · 2151 tok · 4.2 tok/s
To create this module, follow the directory structure and file contents provided below. This follows Drupal 11 best practices, including PSR-4 namespacing, dependency injection, and PHP 8.3 features.

### Directory Structure
```text
hello_world_benchmark/
├── hello_world_benchmark.info.yml
├── hello_world_benchmark.routing.yml
├── hello_world_benchmark.services.yml
├── hello_world_benchmark.install
└── src/
    ├── Controller/
    │   └── HelloController.php
    └── Service/
        └── BenchmarkService.php
```

---

### 1. `hello_world_benchmark.info.yml`
This file defines the module's metadata.

```yaml
name: 'Hello World Benchmark'
type: module
description: 'A benchmark module for AI Arena testing.'
package: Custom
core_version_requirement: ^11
```

### 2. `hello_world_benchmark.routing.yml`
This defines the URL path and maps it to the controller.

```yaml
hello_world_benchmark.content:
  page:
    title: 'Hello World Benchmark'
    path: '/hello-world-benchmark'
    _controller: '\Drupal\hello_world_benchmark\Controller\HelloController::content'
    _permission: 'access content'
```

### 3. `src/Service/BenchmarkService.php`
A simple service using PHP 8.3 **readonly** properties.

```php
<?php

namespace Drupal\hello_world_benchmark\Service;

/**
 * A simple service for benchmark logic.
 */
final class BenchmarkService {

  /**
   * Use a readonly property as per PHP 8.3 requirements.
   */
  public readonly string $prefix = "Benchmark Status: ";

  /**
   * Returns a status message.
   *
   * @return string
   */
  public function getStatus(): string {
    return $this->prefix . "System Active";
  }
}
```

### 4. `hello_world_benchmark.services.yml`
Registers the service so it can be injected into other components.

```yaml
services:
  hello_world_benchmark.benchmark_service:
    class: Drupal\hello_world_benchmark\Service\BenchmarkService
```

### 5. `src/Controller/HelloController.php`
The controller that handles the request and returns the required string.

```php
<?php

namespace Drupal\hello_world_benchmark\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\hello_world_benchmark\Service\BenchmarkService;

/**
 * Provides the Hello World benchmark page.
 */
final class HelloController extends ControllerBase {

  public function __construct(
    protected readonly BenchmarkService $benchmarkService
  ) {}

  /**
   * Constructs a new HelloController object.
   *
   * @param \Drupal\hello_world_benchmark\Service\BenchmarkService $benchmarkService
   *   The benchmark service.
   */
  public static function create(ContainerInterface $container): self {
    return new static(
      $container->get('hello_world_benchmark.benchmark_service')
    );
  }

  /**
   * Returns the content for the hello-world-benchmark route.
   *
   * @return array
   */
  public function content(): array {
    $status = $this->benchmarkService->getStatus();
    
    return [
      '#markup' => $this->t('Hello World from AI Arena benchmark!'),
      '#suffix' => '<p><em>' . $status . '</em></p>',
    ];
  }
}
```

### 6. `hello_world_benchmark.install`
Defines the database schema for the custom table.

```php
<?php

/**
 * Implements hook_schema().
 */
function hello_world_benchmark_schema() {
  return [
    'hello_benchmark_messages' => [
      'description' => 'Stores benchmark messages.',
      'fields' => [
        'id' => [
          'type' => 'serial',
          'not null' => TRUE,
          'unsigned' => TRUE,
        ],
        'message' => [
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'default' => '',
        ],
        'created' => [
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ],
      ],
      'primary key' => ['id'],
    ],
  ];
}
```

---

### How to install:
1. Create a folder named `hello_world_benchmark` in your Drupal site's `/modules/custom/` directory.
2. Place the files inside according to the structure above.
3. Go to the **Extend** page in your Drupal admin dashboard (`/admin/modules`).
4. Search for "Hello World Benchmark" and enable it.
5. Visit `your-site-domain.com/hello-world-benchmark`.
X

Nezmeškejte novinky!

Přihlaste se k odběru novinek a aktualit.