DylanASHillier commited on
Commit
91325ae
·
verified ·
1 Parent(s): 1d3cb38

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +73 -22
README.md CHANGED
@@ -1,22 +1,73 @@
1
- ---
2
- license: apache-2.0
3
- dataset_info:
4
- features:
5
- - name: image
6
- dtype: image
7
- - name: target
8
- dtype: string
9
- - name: turn
10
- dtype: string
11
- splits:
12
- - name: train
13
- num_bytes: 82595245.0
14
- num_examples: 3500
15
- download_size: 81770022
16
- dataset_size: 82595245.0
17
- configs:
18
- - config_name: default
19
- data_files:
20
- - split: train
21
- path: data/train-*
22
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ dataset_info:
4
+ features:
5
+ - name: image
6
+ dtype: image
7
+ - name: target
8
+ dtype: string
9
+ - name: turn
10
+ dtype: string
11
+ splits:
12
+ - name: train
13
+ num_bytes: 82595245
14
+ num_examples: 3500
15
+ download_size: 81770022
16
+ dataset_size: 82595245
17
+ configs:
18
+ - config_name: default
19
+ data_files:
20
+ - split: train
21
+ path: data/train-*
22
+ task_categories:
23
+ - image-to-text
24
+ pretty_name: BIG-Bench Checkmate In One Move (Images)
25
+ ---
26
+
27
+ # Dataset Card for BIG-Bench Checkmate In One Move (Images)
28
+ ## Description
29
+ 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)
30
+ as originally made by Nitish Keskar (nkeskar@salesforce.com).
31
+ Copying the original task description:
32
+ >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.
33
+
34
+ This version simply replaces the text input with images of the board state before the checkmate move.
35
+ ## Example
36
+ ![Chess Game State](train/game_0.png)
37
+
38
+ turn: black
39
+
40
+ target: Rg5#
41
+
42
+ ## Generation Code
43
+ The code used to generate this was:
44
+ ```python
45
+ def svg_to_png(svg_data, output_file):
46
+ """Convert SVG data to PNG and save it"""
47
+ # Convert SVG to PNG using cairosvg
48
+ png_data = cairosvg.svg2png(bytestring=svg_data)
49
+
50
+ # Write the PNG data to the output file
51
+ with open(output_file, "wb") as f:
52
+ f.write(png_data)
53
+
54
+
55
+ def pgn_to_images(pgn, f_name):
56
+ """Convert a PGN file to an image of the final board position"""
57
+ pgn = io.StringIO(pgn)
58
+ game = chess.pgn.read_game(pgn)
59
+ board = game.board()
60
+ for move in game.mainline_moves():
61
+ board.push(move)
62
+ svg = chess.svg.board(board)
63
+ turn_str = "white" if board.turn == chess.WHITE else "black"
64
+ # use a temporary file to convert the SVG to PNG
65
+ with open("temp.svg", "w") as f:
66
+ f.write(svg)
67
+ with open("temp.svg", "rb") as f:
68
+ svg_data = f.read()
69
+ svg_to_png(svg_data, f_name)
70
+ os.remove("temp.svg")
71
+ return turn_str
72
+ ```
73
+ Thanks to the python chess library and cairosvg for making this possible.