Views
No views yet
Generate the model for more details../llama-cli --model ./DeepSeek-R1-0528-hf-256x20B-Q2_K_S-00001-of-00005.gguf --prompt "<|User|>Create a Flappy Bird game in Python.<|Assistant|>"1"""
2Create a Flappy Bird game in Python.<think>
3We are going to create a simple Flappy Bird game using Pygame.
4 The game will have:
5 - A bird (represented by a circle or an image) that can flap (jump) when the space bar is pressed.
6 - Pipes (obstacles) that move from the right to the left of the screen.
7 - The bird must navigate through the gaps between the pipes without colliding.
8 - The game ends if the bird collides with a pipe or the ground, or if it goes off the top of the screen.
9 - The score increases each time the bird passes a pair of pipes.
10
11 Steps:
12 1. Initialize Pygame and set up the display.
13 2. Define the game constants (screen size, colors, gravity, flap strength, pipe speed, etc.).
14 3. Create the bird: position, velocity, and a method for jumping.
15 4. Create the pipes: manage their positions and movement. We'll have a list of pipes.
16 5. Implement collision detection between the bird and the pipes, and between the bird and the ground/top.
17 6. Implement the main game loop: handle events, update positions, check collisions, draw everything.
18
19 We'll use a simple representation for the bird (a circle) and the pipes (rectangles).
20
21 Let's code accordingly.
22</think>
23# Flappy Bird Game in Python using Pygame
24
25Here's a complete implementation of the Flappy Bird game using Pygame:
26
27```python
28import pygame
29import random
30import sys
31
32# Initialize pygame
33pygame.init()
34
35# Game constants
36WIDTH, HEIGHT = 400, 600
37FPS = 60
38GRAVITY = 0.5
39FLAP_STRENGTH = -10
40PIPE_SPEED = 5
41PIPE_GAP = 200
42PIPE_SPAWN_FREQUENCY = 1500 # milliseconds
43GROUND_HEIGHT = 100
44
45# Colors
46SKY_BLUE = (113, 197, 207)
47GREEN = (111, 196, 70)
48DARK_GREEN = (76, 145, 65)
49BIRD_YELLOW = (255, 221, 45)
50BIRD_ORANGE = (255, 150, 0)
51WHITE = (255, 255, 255)
52BLACK = (0, 0, 0)
53"""
54
55too long to copy1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from auto_round import AutoRound
4
5model_name = "/models/DeepSeek-R1-0528-hf" ##must be BF16 model
6
7model = AutoModelForCausalLM.from_pretrained(model_name,
8 device_map="cpu", torch_dtype="auto")
9tokenizer = AutoTokenizer.from_pretrained(model_name)
10layer_config = {}
11for n, m in model.named_modules():
12 if n == "lm_head":
13 layer_config[n] = {"bits": 8}
14 elif isinstance(m, torch.nn.Linear) and (not "expert" in n or "shared_experts" in n) and n != "lm_head":
15 layer_config[n] = {"bits": 4}
16
17autoround = AutoRound(model, tokenizer, iters=0, layer_config=layer_config, batch_size=8, nsamples=512)
18autoround.quantize_and_save("/models/DeepSeek-R1-0528-q2ks", format="gguf:q2_k_s")