Dataset Viewer
The dataset viewer is not available for this split.
Cannot extract the features (columns) for the split 'train' of the config 'default' of the dataset.
Error code:   FeaturesError
Exception:    ArrowInvalid
Message:      Schema at index 1 was different: 
in: struct<data: string, type: string>
out: struct<data: string, type: string>
client: string
vs
href: string
title: string
detail: string
challenge_hash: string
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/split/first_rows.py", line 228, in compute_first_rows_from_streaming_response
                  iterable_dataset = iterable_dataset._resolve_features()
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 3422, in _resolve_features
                  features = _infer_features_from_batch(self.with_format(None)._head())
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 2187, in _head
                  return next(iter(self.iter(batch_size=n)))
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 2391, in iter
                  for key, example in iterator:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1882, in __iter__
                  for key, pa_table in self._iter_arrow():
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1904, in _iter_arrow
                  yield from self.ex_iterable._iter_arrow()
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 527, in _iter_arrow
                  yield new_key, pa.Table.from_batches(chunks_buffer)
                File "pyarrow/table.pxi", line 4116, in pyarrow.lib.Table.from_batches
                File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: Schema at index 1 was different: 
              in: struct<data: string, type: string>
              out: struct<data: string, type: string>
              client: string
              vs
              href: string
              title: string
              detail: string
              challenge_hash: string

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

Challenges and descriptions from vimgolf.com

Scraper code at: https://github.com/James4Ever0/agi_computer_control/tree/master/scrape_vimgolf_challenges_and_solutions

Dataclasses used in: https://github.com/James4Ever0/vimgolf-gym/blob/main/vimgolf_gym/dataclasses.py

File structure:

challenges
     |_ <challenge_hash>
              |_ metadata.json
              |_ challenge.json
              |_ worst_solution.json

worst_solution.json is scraped from vimgolf.com.

Anonymous viewer can only view the worst solution, or the solution with the highest score/stop.

Registered users can only view solutions higher than their submissions in the same challenge.

from pydantic import BaseModel

class VimGolfWorstSolution(BaseModel):
    """Represents a worst solution entry in VimGolf.
    
    Attributes:
        rank: The rank of the solution (provided as a string in the reference).
        solution: The sequence of Vim keystrokes used in the solution.
        header: Descriptive header containing user and challenge details.
    """
    rank: str
    solution: str
    header: str

The header can be further parsed using the following code:

from parse import parse
from datetime import datetime


class VimGolfParsedPublicSolutionHeader(BaseModel):
    """Represents the header of a VimGolf public solution entry.

    Attributes:
        rank: The rank of the solution (provided as a string in the reference).
        score: The score of the solution (provided as a string in the reference).
        user_name: The name of the user who submitted the solution.
        user_id: The ID of the user who submitted the solution.
        date: The date the solution was submitted.
    """

    rank: str
    score: str
    user_name: str
    user_id: str
    date: datetime


def parse_public_solution_header(input_str: str) -> VimGolfParsedPublicSolutionHeader:
    """Parse the public solution header string"""
    template = "#{rank} {user_name} / @{user_id} - Score: {score} - {month}/{day}/{year} @ {hour}:{minute}"

    # Parse the input string using the template
    parsed_data = parse(template, input_str)

    # Convert parsed fields to integers and process the year
    month = int(parsed_data["month"])
    day = int(parsed_data["day"])
    year = int(parsed_data["year"])
    hour = int(parsed_data["hour"])
    minute = int(parsed_data["minute"])

    # Adjust two-digit year to four digits
    full_year = year + 2000 if year < 70 else year + 1900

    # Create a datetime object and format the timestamp
    dt = datetime(full_year, month, day, hour, minute)
    timestamp = dt.strftime("%Y-%m-%d %H:%M:%S")

    ret = VimGolfParsedPublicSolutionHeader(
        rank=parsed_data["rank"],
        user_name=parsed_data["user_name"],
        user_id=parsed_data["user_id"],
        score=parsed_data["score"],
        timestamp=timestamp,
    )
    return ret

metadata.json is for storing descriptions of the current challenge.

from pydantic import BaseModel

class VimGolfChallengeMetadata(BaseModel):
    """
    Represents metadata for a VimGolf challenge.
    
    Attributes:
        href: URL path to the challenge.
        title: Name/description of the challenge.
        detail: Explanation of the challenge task.
        challenge_hash: Unique identifier hash for the challenge.
    """
    href: str
    title: str
    detail: str
    challenge_hash: str

challenge.json is the definition of the challenge.

from pydantic import BaseModel, Field

class VimGolfChallengeDefinition(BaseModel):
    """
    Represents a VimGolf challenge definition including input/output code and client information.
    
    Attributes:
        input: Starting code and its type (nested model)
        output: Expected solution code and its type (nested model)
        client_version: Version of the client that created the challenge
    """
    class InputOutputModel(BaseModel):
        """
        Nested model for input/output code definitions.
        
        Attributes:
            data: The actual code content
            type: Programming language identifier (e.g., 'rb' for Ruby)
        """
        data: str
        type: str

    input: InputOutputModel = Field(..., alias="in")
    output: InputOutputModel = Field(..., alias="out")
    client_version: str = Field(..., alias="client")

    class Config:
        validate_by_name = True

Code for loading data from json:

from pydantic import BaseModel
import json
from pathlib import Path

def parse_json_file(file_path: Path, model: type[BaseModel]) -> BaseModel:
    """Parse a JSON file into a specified Pydantic model"""
    with open(file_path, "r", encoding="utf-8") as f:
        data = json.load(f)
    return model.parse_obj(data)

# Usage example
if __name__ == "__main__":
    # Example paths (replace with actual file paths)
    metadata_path = Path("challenge_metadata.json")
    definition_path = Path("challenge_definition.json")
    
    # Parse metadata
    metadata = parse_json_file(metadata_path, VimGolfChallengeMetadata)
    print(f"Challenge Title: {metadata.title}")
    
    # Parse challenge definition
    challenge_def = parse_json_file(definition_path, VimGolfChallengeDefinition)
    print(f"Input Code Type: {challenge_def.input.type}")
    print(f"Client Version: {challenge_def.client}")
Downloads last month
205