Text Generation
PEFT
Safetensors
zerolang
reinforcement-learning
verifiers
code-editing
tool-use
graph-editing
laguna-xs2
lora
fine-tune
Instructions to use poolside-laguna-hackathon/zerolang-editing with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use poolside-laguna-hackathon/zerolang-editing with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
File size: 5,887 Bytes
bb1b296 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | """Task construction helpers for synthetic Zerolang editing rows."""
from __future__ import annotations
from typing import Any
def _source(text: str) -> str:
return text.strip() + "\n"
def _write_program(message: str, *, raises: bool = True) -> str:
raises_suffix = " raises" if raises else ""
return _source(
f"""
pub fn main(world: World) -> Void{raises_suffix} {{
check world.out.write("{message}\\n")
}}
"""
)
def _literal_task(
task_id: str, old: str, new: str, goal: str | None = None, *, split: str = "eval"
) -> dict[str, Any]:
return {
"id": task_id,
"split": split,
"category": "graph_patch_literal",
"goal": goal or f'Replace the string literal "{old}\\n" with "{new}\\n".',
"source": _write_program(old),
"target_source": _write_program(new),
}
def _branch_literal_task(
task_id: str, helper: str, old: str, new: str, *, split: str = "eval"
) -> dict[str, Any]:
return {
"id": task_id,
"split": split,
"category": "graph_patch_literal",
"goal": (
"Keep the helper-controlled branch intact and update only the string "
f'literal from "{old}\\n" to "{new}\\n".'
),
"source": _source(
f"""
fn {helper}() -> i32 {{
return 1
}}
pub fn main(world: World) -> Void raises {{
if {helper}() == 1 {{
check world.out.write("{old}\\n")
}}
}}
"""
),
"target_source": _source(
f"""
fn {helper}() -> i32 {{
return 1
}}
pub fn main(world: World) -> Void raises {{
if {helper}() == 1 {{
check world.out.write("{new}\\n")
}}
}}
"""
),
}
def _helper_task(
task_id: str,
helper: str,
source_expr: str,
target_expr: str,
expected: int,
output: str,
*,
split: str = "eval",
) -> dict[str, Any]:
return {
"id": task_id,
"split": split,
"category": "semantic_update",
"goal": (
f"Update {helper}() so it returns {expected} and the existing main "
f"branch prints {output}."
),
"source": _source(
f"""
fn {helper}() -> i32 {{
return {source_expr}
}}
pub fn main(world: World) -> Void raises {{
if {helper}() == {expected} {{
check world.out.write("{output}\\n")
}}
}}
"""
),
"target_source": _source(
f"""
fn {helper}() -> i32 {{
return {target_expr}
}}
pub fn main(world: World) -> Void raises {{
if {helper}() == {expected} {{
check world.out.write("{output}\\n")
}}
}}
"""
),
}
def _two_helper_task(
task_id: str,
helper: str,
other: str,
source_expr: str,
target_expr: str,
other_expr: str,
expected: int,
*,
split: str = "eval",
) -> dict[str, Any]:
return {
"id": task_id,
"split": split,
"category": "semantic_update",
"goal": (
f"Update only {helper}() so main writes ok when the comparison succeeds; "
f"leave {other}() unchanged."
),
"source": _source(
f"""
fn {helper}() -> i32 {{
return {source_expr}
}}
fn {other}() -> i32 {{
return {other_expr}
}}
pub fn main(world: World) -> Void raises {{
if {helper}() == {expected} {{
check world.out.write("ok\\n")
}}
}}
"""
),
"target_source": _source(
f"""
fn {helper}() -> i32 {{
return {target_expr}
}}
fn {other}() -> i32 {{
return {other_expr}
}}
pub fn main(world: World) -> Void raises {{
if {helper}() == {expected} {{
check world.out.write("ok\\n")
}}
}}
"""
),
}
def _call_task(
task_id: str, source_args: str, target_args: str, expected: int, *, split: str = "eval"
) -> dict[str, Any]:
return {
"id": task_id,
"split": split,
"category": "call_update",
"goal": "Keep add unchanged, but edit one call argument so the comparison is true.",
"source": _source(
f"""
fn add(a: i32, b: i32) -> i32 {{
return a + b
}}
pub fn main(world: World) -> Void raises {{
if add({source_args}) == {expected} {{
check world.out.write("ok\\n")
}}
}}
"""
),
"target_source": _source(
f"""
fn add(a: i32, b: i32) -> i32 {{
return a + b
}}
pub fn main(world: World) -> Void raises {{
if add({target_args}) == {expected} {{
check world.out.write("ok\\n")
}}
}}
"""
),
}
def _condition_task(
task_id: str,
helper: str,
returned: int,
source_compare: int,
output: str,
*,
split: str = "eval",
) -> dict[str, Any]:
return {
"id": task_id,
"split": split,
"category": "condition_update",
"goal": (
"Edit the comparison literal so the branch is true without changing "
f"{helper}() or the output string."
),
"source": _source(
f"""
fn {helper}() -> i32 {{
return {returned}
}}
pub fn main(world: World) -> Void raises {{
if {helper}() == {source_compare} {{
check world.out.write("{output}\\n")
}}
}}
"""
),
"target_source": _source(
f"""
fn {helper}() -> i32 {{
return {returned}
}}
pub fn main(world: World) -> Void raises {{
if {helper}() == {returned} {{
check world.out.write("{output}\\n")
}}
}}
"""
),
}
def _diagnostic_task(task_id: str, message: str, *, split: str = "eval") -> dict[str, Any]:
return {
"id": task_id,
"split": split,
"category": "diagnostic_repair",
"goal": "Repair the main signature so the existing world.out.write check is valid.",
"source": _write_program(message, raises=False),
"target_source": _write_program(message, raises=True),
}
|