rust-r2 / README.md
Shadow0482's picture
Add Rust question/code dataset
df98c44 verified
|
Raw History Blame Contribute Delete
3.32 kB
metadata
license: other
task_categories:
  - text-generation
language:
  - en
tags:
  - rust
  - code
  - instruction-tuning
  - synthetic
size_categories:
  - n<1K
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*.parquet

Rust code instruction dataset

410 pairs of (question, real Rust code) built from 6 open-source GitHub repositories.

Each answer is original Rust source. Each question was written by nvidia/nemotron-3.5-lightning-30b-a3b from the code context; the model does not generate the answer.

Source repositories

repository commit license files chunks rows
TheAlgorithms/Rust fed66cb0c7 MIT 421 174 163
reyamira/models 73997bf31e MIT 78 29 23
AreevAI/flowcat 9eb2999c33 Apache-2.0 192 88 66
cortex/ripasso 25f855dfc3 GPL-3.0-only 22 21 18
brentongunning/rust-sv f2c9e939b3 MIT 54 22 21
lightningdevkit/rust-lightning 48e8d4745e Apache-2.0 OR MIT 257 138 119

Rows by kind

kind rows
file 410

Example

Question

I need a Rust module that declares several backtracking algorithm submodules and re-exports their public functions. The module should define submodules named all_combination_of_size_k, graph_coloring, hamiltonian_cycle, knight_tour, n_queens, parentheses_generator, permutations, rat_in_maze, subset_sum, and sudoku. It must re-export exactly these functions with these exact names: generate_all_combinations, generate_colorings, find_hamiltonian_cycle, find_knight_tour, n_queens_solver, generate_parentheses, permute, find_path_in_maze, has_subset_with_sum, and sudoku_solver. Please generate the module declarations and pub use statements that match this structure.

Answer (TheAlgorithms/Rust - src/backtracking/mod.rs)

mod all_combination_of_size_k;
mod graph_coloring;
mod hamiltonian_cycle;
mod knight_tour;
mod n_queens;
mod parentheses_generator;
mod permutations;
mod rat_in_maze;
mod subset_sum;
mod sudoku;

pub use all_combination_of_size_k::generate_all_combinations;
pub use graph_coloring::generate_colorings;
pub use hamiltonian_cycle::find_hamiltonian_cycle;
pub use knight_tour::find_knight_tour;
pub use n_queens::n_queens_solver;
pub use parentheses_generator::generate_parentheses;
pub use permutations::permute;
pub use rat_in_maze::find_path_in_maze;
pub use subset_sum::has_subset_with_sum;
pub use sudoku::sudoku_solver;

Usage

from datasets import load_dataset

dataset = load_dataset("Shadow0482/rust", split="train")
print(dataset[0]["question"])
print(dataset[0]["answer"])

License and attribution

Code in answer remains under the license of the source repository shown in the license and repo_url columns. Follow that license when redistributing or training on the data. The questions are synthetic; follow the terms of the model provider used to create them.