--- license: apache-2.0 dataset_info: features: - name: image dtype: image - name: target dtype: string - name: turn dtype: string splits: - name: train num_bytes: 82595245 num_examples: 3500 download_size: 81770022 dataset_size: 82595245 configs: - config_name: default data_files: - split: train path: data/train-* task_categories: - image-to-text pretty_name: BIG-Bench Checkmate In One Move (Images) --- # Dataset Card for BIG-Bench Checkmate In One Move (Images) ## Description This is an adapted version of the [BIG-Bench Checkmate in One Move task](https://github.com/google/BIG-bench/tree/main/bigbench/benchmark_tasks/checkmate_in_one) as originally made by Nitish Keskar (nkeskar@salesforce.com). Copying the original task description: >The goal of this task is to probe the ability of language models to play chess in standard algebraic notation (SAN). The input to the model is a sequence of moves such that a next possible move is a checkmate. We curate 3,500 games and measure the performance of the system in exact match accuracy. This version simply replaces the text input with images of the board state before the checkmate move. ## Example ![Chess Game State](game_0.png) turn: black target: Rg5# ## Generation Code The code used to generate this was: ```python def svg_to_png(svg_data, output_file): """Convert SVG data to PNG and save it""" # Convert SVG to PNG using cairosvg png_data = cairosvg.svg2png(bytestring=svg_data) # Write the PNG data to the output file with open(output_file, "wb") as f: f.write(png_data) def pgn_to_images(pgn, f_name): """Convert a PGN file to an image of the final board position""" pgn = io.StringIO(pgn) game = chess.pgn.read_game(pgn) board = game.board() for move in game.mainline_moves(): board.push(move) svg = chess.svg.board(board) turn_str = "white" if board.turn == chess.WHITE else "black" # use a temporary file to convert the SVG to PNG with open("temp.svg", "w") as f: f.write(svg) with open("temp.svg", "rb") as f: svg_data = f.read() svg_to_png(svg_data, f_name) os.remove("temp.svg") return turn_str ``` Thanks to the python chess library and cairosvg for making this possible.