five

yp-edu/stockfish-debug

收藏
Hugging Face2024-03-04 更新2024-03-04 收录
下载链接:
https://hf-mirror.com/datasets/yp-edu/stockfish-debug
下载链接
链接失效反馈
官方服务:
资源简介:
--- license: mit source_datasets: - BlueSunflower/chess_games_base configs: - config_name: default data_files: - split: train path: "train.jsonl" - split: test path: "test.jsonl" dataset_info: features: - name: fen dtype: string - name: move dtype: string - name: result dtype: string --- # Dataset Card for stockfish-debug See my [blog post](https://yp-edu.github.io/projects/training-gpt2-on-stockfish-games) for additional details. ## Columns The datase contain the following columns: - **fen:** The FEN string of the board. - **move:** The move that was played. - **result:** The result of the game (with `"-"` for unfinished games). ## Data details Pre-processing of the Stockfish games provided by [BlueSunflower/chess_games_base](https://huggingface.co/datasets/BlueSunflower/chess_games_base). Code used: ```python import jsonlines import chess import tqdm def preprocess_games(in_path, out_path): with jsonlines.open(in_path) as reader: with jsonlines.open(out_path, "w") as writer: for obj in tqdm.tqdm(reader): state_action = [] parsed_moves = [m for m in obj["moves"].split() if not m.endswith(".")] board = chess.Board() for m in parsed_moves: fen = board.fen() move = board.push_san(m) state_action.append({"fen": fen, "move":move.uci()}) outcome = board.outcome() if outcome is None: result = "-" else: result = outcome.result() writer.write_all([ {**sa, "result":result} for sa in state_action ]) ``` ## Use the Dataset Using basic `dataset` code: ```python from datasets import load_dataset dataset = load_dataset("yp-edu/stockfish-debug") ```
提供机构:
yp-edu
原始信息汇总

数据集卡片 for stockfish-debug

列信息

数据集包含以下列:

  • fen: 棋盘的FEN字符串。
  • move: 所下的棋步。
  • result: 游戏的结果(未完成的游戏用"-"表示)。

数据详情

预处理

Stockfish游戏数据由BlueSunflower/chess_games_base提供,预处理代码如下:

python import jsonlines import chess import tqdm

def preprocess_games(in_path, out_path): with jsonlines.open(in_path) as reader: with jsonlines.open(out_path, "w") as writer: for obj in tqdm.tqdm(reader): state_action = [] parsed_moves = [m for m in obj["moves"].split() if not m.endswith(".")] board = chess.Board() for m in parsed_moves: fen = board.fen() move = board.push_san(m) state_action.append({"fen": fen, "move":move.uci()}) outcome = board.outcome() if outcome is None: result = "-" else: result = outcome.result() writer.write_all([ {**sa, "result":result} for sa in state_action ])

数据文件

  • 训练集: train.jsonl
  • 测试集: test.jsonl

使用数据集

使用基本的dataset代码:

python from datasets import load_dataset

dataset = load_dataset("yp-edu/stockfish-debug")

5,000+
优质数据集
54 个
任务类型
进入经典数据集
二维码
社区交流群

面向社区/商业的数据集话题

二维码
科研交流群

面向高校/科研机构的开源数据集话题

数据驱动未来

携手共赢发展

商业合作