Download loda-rust/rust_project/loda-rust-cli/src/subcommand_arc.rs from Alignment-Lab-AI/ARC-stuff: direct link, hf CLI and curl.
- Browser
- Download file 3.89 kB
-
https://huggingface.co/datasets/Alignment-Lab-AI/ARC-stuff/resolve/main/loda-rust/rust_project/loda-rust-cli/src/subcommand_arc.rs
- Command line
-
hf download hf://datasets/Alignment-Lab-AI/ARC-stuff/loda-rust/rust_project/loda-rust-cli/src/subcommand_arc.rs
-
curl -L -o subcommand_arc.rs https://huggingface.co/datasets/Alignment-Lab-AI/ARC-stuff/resolve/main/loda-rust/rust_project/loda-rust-cli/src/subcommand_arc.rs
3.89 kB
| //! The `loda-rust arc` subcommands, perform experiments with the `Abstraction and Reasoning Corpus`. | |
| use std::path::PathBuf; | |
| use crate::arc::{SubcommandARCSize, SubcommandARCWeb, TraverseProgramsAndModels}; | |
| pub enum SubcommandARCMode { | |
| /// Check that all the existing solutions still works. | |
| CheckAllExistingSolutions, | |
| /// Populate the `solutions.csv` file by trying out all puzzles with all solutions. | |
| GenerateSolutionCSV, | |
| /// Eval a single task with all the existing solutions. | |
| EvalSingleTask { pattern: String }, | |
| /// The code being executed inside the docker image submitted for the `ARCathon` contest. | |
| Competition, | |
| /// Traverse all puzzles and classify each puzzle. | |
| LabelAllPuzzles, | |
| /// Create a file with training data. | |
| ExportDataset, | |
| /// Run all tasks using the specified solver. | |
| /// | |
| /// where `name_of_solver` is one of: | |
| /// - `lr` is logistic regression. | |
| /// - `one` is `SolveOneColor`. | |
| SolveWithSpecificSolver { name_of_solver: String }, | |
| /// Predict the output sizes for a single ARC task. | |
| PredictOutputSizesForSingleTask { task_json_file: PathBuf }, | |
| /// Traverse the task json files, and assign a number of histogram comparisons. | |
| MetadataHistogram { count: u16, seed: u64, task_json_directory: PathBuf }, | |
| } | |
| pub struct SubcommandARC; | |
| impl SubcommandARC { | |
| pub fn run(_mode: SubcommandARCMode) -> anyhow::Result<()> { | |
| panic!("loda-rust-arc feature is not enabled"); | |
| } | |
| pub fn run(mode: SubcommandARCMode) -> anyhow::Result<()> { | |
| use crate::arc::GenerateDataset; | |
| use crate::arc::SubcommandARCMetadata; | |
| match mode { | |
| SubcommandARCMode::CheckAllExistingSolutions => { | |
| return TraverseProgramsAndModels::check_all_existing_solutions(); | |
| }, | |
| SubcommandARCMode::GenerateSolutionCSV => { | |
| return TraverseProgramsAndModels::generate_solution_csv(); | |
| }, | |
| SubcommandARCMode::EvalSingleTask { pattern } => { | |
| return TraverseProgramsAndModels::eval_single_task_with_all_existing_solutions(pattern); | |
| }, | |
| SubcommandARCMode::Competition => { | |
| return TraverseProgramsAndModels::arc_competition(); | |
| }, | |
| SubcommandARCMode::LabelAllPuzzles => { | |
| return TraverseProgramsAndModels::label_all_puzzles(); | |
| }, | |
| SubcommandARCMode::ExportDataset => { | |
| // let path: PathBuf = PathBuf::from("/Users/neoneye/Downloads/histogram-comparisons.jsonl"); | |
| // GenerateDataset::generate_dataset_huge(&path)?; | |
| // GenerateDataset::generate_dataset_small(&path)?; | |
| // return Ok(()); | |
| return TraverseProgramsAndModels::export_dataset(); | |
| }, | |
| SubcommandARCMode::SolveWithSpecificSolver { name_of_solver } => { | |
| return TraverseProgramsAndModels::solve_with_specific_solver(&name_of_solver); | |
| }, | |
| SubcommandARCMode::PredictOutputSizesForSingleTask { task_json_file } => { | |
| return SubcommandARCSize::run(&task_json_file); | |
| }, | |
| SubcommandARCMode::MetadataHistogram { count, seed, task_json_directory } => { | |
| return SubcommandARCMetadata::run(count, seed, &task_json_directory); | |
| }, | |
| } | |
| } | |
| pub async fn run_web_server() -> anyhow::Result<()> { | |
| panic!("loda-rust-arc feature is not enabled"); | |
| } | |
| pub async fn run_web_server() -> anyhow::Result<()> { | |
| SubcommandARCWeb::run_web_server().await | |
| } | |
| } | |