lucataco/wizardcoder-33b-v1.1-gguf 📝🔢 → 📝

▶️ 17.5K runs 📅 Jan 2024 ⚙️ Cog 0.8.6 🔗 GitHub 📄 Paper ⚖️ License
code-generation text-generation

About

WizardCoder: Empowering Code Large Language Models with Evol-Instruct

Example Output

Prompt:

"Write a snake game in Python"

Output

Writing a complete snake game with graphics and sound effects would be quite long, but here's a simple version of it using the pygame library:

import pygame
from random import randint

# Initialize Pygame
pygame.init()

# Define some colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)

# Set the width and height of each snake segment
segment_width = 15
segment_height = 15

# Margin between each cell
margin = 3

# Create a 2 dimensional array. A two dimensional
# array is simply a list of lists.
grid = []
for row in range(10):
    # Add an empty array that will hold each cell
    # in this row
    grid.append([])
    for column in range(10):
        grid[row].append(0)  # Append a cell

# Set initial position of snake
x_pos = 5
y_pos = 5
grid[x_pos][y_pos] = 's'
snake_segments = [[x_pos, y_pos]]

# Generate random apple position
apple_position = [randint(0, 9), randint(0, 9)]
while grid[apple_position[0]][apple_position[1]] != 0:
    apple_position = [randint(0, 9), randint(0, 9)]
grid[apple_position[0]][apple_position[1]] = 'a'

# Set title of screen
pygame.display.set_caption("Snake Game")

clock = pygame.time.Clock()

done = False
direction = "right"
score = 0
while not done:
    for event in pygame.event.get():  # User did something
        if event.type == pygame.QUIT:  # If user clicked close
            done = True  # Flag that we are done so we exit this loop
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_LEFT and direction != "right":
                direction = "left"
            elif event.key == pygame.K_RIGHT and direction != "left":
                direction = "right"
            elif event.key == pygame.K_UP and direction != "down":
                direction = "up"
            elif event.key == pygame.K_DOWN and direction != "up":
                direction = "down"
    # Move the snake
    if direction == "right":
        x_pos += 1
    if direction == "left":
        x_pos -= 1
    if direction == "down":
        y_pos += 1
    if direction == "up":
        y_pos -= 1
    
    # Check for collision with apple
    if [x_pos, y_pos] == apple_position:
        score += 1
        snake_segments.append([x_pos, y_pos])
        grid[apple_position[0]][apple_position[1]] = 0
        while grid[apple_position[0]][apple_position[1]] != 0:
            apple_position = [randint(0, 9), randint(0, 9)]
        grid[apple_position[0]][apple_position[1]] = 'a'
    
    # Check for collision with wall or itself
    if x_pos > 9 or y_pos > 9 or x_pos < 0 or y_pos < 0 or [x_pos, y_pos] in snake_segments:
        done = True
    
    # Move the rest of the body
    for i in range(len(snake_segments) - 1, 0, -1):
        snake_segments[i] = snake_segments[i-1].copy()
    snake_segments[0] = [x_pos, y_pos]
    
    # Clear the screen
    grid = [[0 for _ in range(10)] for _ in range(10)]
    for segment in snake_segments:
        grid[segment[0]][segment[1]] = 's'
    grid[apple_position[0]][apple_position[1]] = 'a'
    
    # Draw the grid
    for row in range(10):
        for column in range(10):
            color = WHITE
            if grid[row][column] == 's':
                color = GREEN
            elif grid[row][column] == 'a':
                color = RED
            
            pygame.draw.rect(screen,
                             color,
                             [(margin+segment_width)*column+margin,
                              (margin+segment_height)*row+margin,
                              segment_width,
                              segment_height])
    # Limit to 10 frames per second
    clock.tick(5)
    
    # Go ahead and update the screen with what we've drawn.
    pygame.display.flip()
# Be IDLE friendly. If you forget this line, the program will 'hang'
# on exit.
pygame.quit()

Performance Metrics

68.40s Prediction Time
120.66s Total Time
All Input Parameters
{
  "prompt": "Write a snake game in Python",
  "temperature": 0.7,
  "system_prompt": "Below is an instruction that describes a task. Write a response that appropriately completes the request.",
  "max_new_tokens": -1,
  "repeat_penalty": 1.1,
  "prompt_template": "{system_prompt}\n\n### Instruction:\n{prompt}\n\n### Response:"
}
Input Parameters
prompt (required) Type: string
Instruction for model
temperature Type: numberDefault: 0.7
This parameter used to control the 'warmth' or responsiveness of an AI model based on the LLaMA architecture. It adjusts how likely the model is to generate new, unexpected information versus sticking closely to what it has been trained on. A higher value for this parameter can lead to more creative and diverse responses, while a lower value results in safer, more conservative answers that are closer to those found in its training data. This parameter is particularly useful when fine-tuning models for specific tasks where you want to balance between generating novel insights and maintaining accuracy and coherence.
system_prompt Type: stringDefault: Below is an instruction that describes a task. Write a response that appropriately completes the request.
System prompt for the model, helps guides model behaviour.
max_new_tokens Type: integerDefault: -1
Maximum new tokens to generate.
repeat_penalty Type: numberDefault: 1.1
This parameter plays a role in controlling the behavior of an AI language model during conversation or text generation. Its purpose is to discourage the model from repeating itself too often by increasing the likelihood of following up with different content after each response. By adjusting this parameter, users can influence the model's tendency to either stay within familiar topics (lower penalty) or explore new ones (higher penalty). For instance, setting a high repeat penalty might result in more varied and dynamic conversations, whereas a low penalty could be suitable for scenarios where consistency and predictability are preferred.
prompt_template Type: stringDefault: {system_prompt} ### Instruction: {prompt} ### Response:
Template to pass to model. Override if you are providing multi-turn instructions.
Output Schema

Output

Type: arrayItems Type: string

Example Execution Logs
llama_print_timings:        load time =     311.63 ms
llama_print_timings:      sample time =     168.09 ms /  1289 runs   (    0.13 ms per token,  7668.69 tokens per second)
llama_print_timings: prompt eval time =     311.51 ms /    38 tokens (    8.20 ms per token,   121.99 tokens per second)
llama_print_timings:        eval time =   62655.76 ms /  1288 runs   (   48.65 ms per token,    20.56 tokens per second)
llama_print_timings:       total time =   66659.95 ms /  1326 tokens
Version Details
Version ID
bbf93cee2c2b446f0ff426ae81a9b61c5ebd8972a21f734fe035513b6fafe615
Version Created
January 23, 2024
Run on Replicate →