| add_new_token |
Ran ran; our contract draft was wrong, not the code |
nahyeonkaty/textboost/src/textboost/ti_utils.py code served (permissive licence) · get_code("880d2ac0a7cd3e47") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned NewToken. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
from dataclasses import dataclass
torch.manual_seed(0)
# Stand-in tokenizer class
class SimpleTokenizer:
def __init__(self):
self.vocab = {
'the': 0, 'quick': 1, 'brown': 2, 'fox': 3,
'jumps': 4, 'over': 5, 'lazy': 6, 'dog': 7
}
self.id_to_token = {v: k for k, v in self.vocab.items()}
self.next_id = len(self.vocab)
def encode(self, text, add_special_tokens=False):
tokens = text.split()
return [self.vocab.get(token, self.next_id - 1) for token in tokens]
def add_tokens(self, tokens):
count = 0
for token in tokens:
if token not in self.vocab:
self.vocab[token] = self.next_id
self.id_to_token[self.next_id] = token
self.next_id += 1
count += 1
return count
def convert_tokens_to_ids(self, tokens):
return [self.vocab[token] for token in tokens]
def __len__(self):
return self.next_id
# Stand-in text encoder class
class SimpleTextEncoder(nn.Module):
def __init__(self, vocab_size=8, embedding_dim=4):
super().__init__()
self.embeddings = nn.Embedding(vocab_size, embedding_dim)
def resize_token_embeddings(self, new_size):
old_size = self.embeddings.num_embeddings
if new_size > old_size:
new_embeddings = nn.Embedding(new_size, self.embeddings.embedding_dim)
new_embeddings.weight.data[:old_size] = self.embeddings.weight.data
self.embeddings = new_embeddings
def get_input_embeddings(self):
return self.embeddings
# Create tokenizer and encoder
tokenizer = SimpleTokenizer()
text_encoder = SimpleTextEncoder(vocab_size=len(tokenizer), embedding_dim=4)
# Define ARGS
ARGS = {
'tokenizer': tokenizer,
'text_encoder': text_encoder,
'placeholder': '<new_token>',
'init_token': 'quick brown',
'pad_style': 'tb',
'joiner': ' '
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type NewToken — a NewToken output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a NewToken output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| forced_weight_norm |
Ran ran; our contract draft was wrong, not the code |
nahyeonkaty/textboost/src/textboost/ti_utils.py code served (permissive licence) · get_code("5c98bd294f643a86") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (3, 1) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
# Create a minimal text encoder with get_input_embeddings() method
class MinimalTextEncoder(nn.Module):
def __init__(self, vocab_size=10, embedding_dim=4):
super().__init__()
self.embeddings = nn.Embedding(vocab_size, embedding_dim)
def get_input_embeddings(self):
return self.embeddings
# Instantiate the text encoder
text_encoder = MinimalTextEncoder(vocab_size=10, embedding_dim=4)
# Define arguments for forced_weight_norm
ARGS = {
"text_encoder": text_encoder,
"index": [0, 2, 5], # list of indices
"magnitude": 1.0
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float, shape (3, 1) — shape (3, 1) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| generator_build |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
nahyeonkaty/textboost/src/textboost/generator_builder.py code served (permissive licence) · get_code("612bf864a644221b") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
from peft import LoraConfig
from collections.abc import Sequence
torch.manual_seed(0)
# Build a minimal generator module that has the structure expected by the function
class MinimalAttention(nn.Module):
def __init__(self, use_attn2=False):
super().__init__()
self.use_attn2 = use_attn2
if use_attn2:
# For attn2 case (cross-attention)
self.attn2 = nn.Module()
self.attn2.to_k = nn.Linear(4, 4)
self.attn2.to_v = nn.Linear(4, 4)
else:
# For standard self-attention
self.to_q = nn.Linear(4, 4)
self.to_k = nn.Linear(4, 4)
self.to_v = nn.Linear(4, 4)
self.to_out = nn.Sequential(nn.Linear(4, 4))
class MinimalGenerator(nn.Module):
def __init__(self, use_attn2=False):
super().__init__()
self.attention = MinimalAttention(use_attn2=use_attn2)
def forward(self, x):
return x
# Create a generator instance for testing
generator = MinimalGenerator(use_attn2=False)
# Create a generator with add_adapter support (for LoRA testing)
class LoRACapableGenerator(nn.Module):
def __init__(self):
super().__init__()
self.attention = MinimalAttention(use_attn2=False)
self._peft_config = {}
def add_adapter(self, config):
# Minimal mock implementation of add_adapter
self._peft_config['default'] = config
# Mark LoRA parameters as trainable
for name, module in self.named_modules():
if any(target in name for target in config.target_modules):
if hasattr(module, 'weight'):
# Create a mock LoRA parameter
lora_weight = nn.Parameter(torch.randn(4, 4))
setattr(module, 'lora_weight', lora_weight)
def forward(self, x):
return x
generator_lora = LoRACapableGenerator()
# Define the ARGS dictionary with all parameters
ARGS = {
'generator': generator,
'mode': 'none',
'lora_rank': 0,
'lora_target_modules': None,
'kv_patterns': None,
'lora_alpha': None,
'init_lora_weights': 'gaussian',
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- peft, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| get_images_path |
Ran ran; our contract draft was wrong, not the code |
nahyeonkaty/textboost/src/textboost/datasets.py code served (permissive licence) · get_code("49ba8cbb960e2237") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
from pathlib import Path
import tempfile
import os
# Create a temporary directory with some test files
temp_dir = tempfile.mkdtemp()
# Create some test image files
test_image_files = ['test1.jpg', 'test2.png', 'test3.gif']
for filename in test_image_files:
filepath = os.path.join(temp_dir, filename)
# Create empty files with image extensions
Path(filepath).touch()
# Also create a non-image file to test filtering
Path(os.path.join(temp_dir, 'test.txt')).touch()
ARGS = {
'data_root': temp_dir,
'max_samples': None,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- PIL — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| get_prompts |
Ran ran; our contract draft was wrong, not the code |
nahyeonkaty/textboost/src/textboost/evaluation/core.py code served (permissive licence) · get_code("f2e38d770c4f705f") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import os
import tempfile
from typing import List, Optional
# Create a temporary prompts file for testing
temp_dir = tempfile.mkdtemp()
prompts_file = os.path.join(temp_dir, "test_prompts.txt")
with open(prompts_file, 'w', encoding='utf-8') as f:
f.write("a cat in the forest\n")
f.write("a dog on the beach\n")
f.write("a bird in the sky\n")
# Define test prompts list
test_prompts_list = [
"a {} in the desert",
"a {} in the mountains",
"a {} in the ocean"
]
# Construct ARGS dict with all parameters for get_prompts
ARGS = {
'prompts_file': None,
'prompts_list': None,
'use_defaults': True
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| is_image_file |
Ran ran, violated the contract we drafted |
nahyeonkaty/textboost/src/textboost/datasets.py code served (permissive licence) · get_code("72fcd818096aee74") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
from pathlib import Path
ARGS = {
"file_path": "test_image.png"
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- PIL — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| is_live |
Ran ran, violated the contract we drafted |
nahyeonkaty/textboost/src/textboost/evaluation/dreambooth.py code served (permissive licence) · get_code("294cbd4a861df6d7") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import numpy as np
INSTANCES = {'backpack': 'backpack', 'backpack_dog': 'backpack', 'bear_plushie': 'stuffed animal', 'berry_bowl': 'bowl', 'can': 'can', 'candle': 'candle', 'cat': 'cat', 'cat2': 'cat', 'clock': 'clock', 'colorful_sneaker': 'sneaker', 'dog': 'dog', 'dog2': 'dog', 'dog3': 'dog', 'dog5': 'dog', 'dog6': 'dog', 'dog7': 'dog', 'dog8': 'dog', 'duck_toy': 'toy', 'fancy_boot': 'boot', 'grey_sloth_plushie': 'stuffed animal', 'monster_toy': 'toy', 'pink_sunglasses': 'glasses', 'poop_emoji': 'toy', 'rc_car': 'toy', 'red_cartoon': 'cartoon', 'robot_toy': 'toy', 'shiny_sneaker': 'sneaker', 'teapot': 'teapot', 'vase': 'vase', 'wolf_plushie': 'stuffed animal'}
def is_live(instance):
cls = INSTANCES[instance]
return cls in ('dog', 'cat')
ARGS = {
'instance': 'dog'
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| load_new_token |
Ran ran; our contract draft was wrong, not the code |
nahyeonkaty/textboost/src/textboost/ti_utils.py code served (permissive licence) · get_code("95f9712e08dc49d3") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
# Create a minimal tokenizer stand-in
class MinimalTokenizer:
def __init__(self):
self.vocab_size = 100
self.tokens = {}
self.id_counter = self.vocab_size
def add_tokens(self, new_tokens):
for token in new_tokens:
if token not in self.tokens:
self.tokens[token] = self.id_counter
self.id_counter += 1
def convert_tokens_to_ids(self, tokens):
return [self.tokens[token] for token in tokens]
def __len__(self):
return self.vocab_size + len(self.tokens)
# Create a minimal text encoder
class MinimalTextEncoder(nn.Module):
def __init__(self, vocab_size=100, embedding_dim=4):
super().__init__()
self.embeddings = nn.Embedding(vocab_size, embedding_dim)
def get_input_embeddings(self):
return self.embeddings
def resize_token_embeddings(self, new_size):
old_embeddings = self.embeddings
self.embeddings = nn.Embedding(new_size, old_embeddings.embedding_dim)
self.embeddings.weight.data[:old_embeddings.num_embeddings] = old_embeddings.weight.data
text_encoder = MinimalTextEncoder(vocab_size=100, embedding_dim=4)
tokenizer = MinimalTokenizer()
placeholder = "<my_token>"
learned_embedding = torch.randn(2, 4) # 2 vectors of dimension 4
joiner = ' '
ARGS = {
'text_encoder': text_encoder,
'tokenizer': tokenizer,
'placeholder': placeholder,
'learned_embedding': learned_embedding,
'joiner': joiner,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| load_prompts_from_file |
Ran ran; our contract draft was wrong, not the code |
nahyeonkaty/textboost/src/textboost/evaluation/core.py code served (permissive licence) · get_code("8802c8bb9eabf0f5") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import os
import tempfile
# Create a temporary file with sample prompts
temp_dir = tempfile.mkdtemp()
prompts_file = os.path.join(temp_dir, "prompts.txt")
with open(prompts_file, 'w', encoding='utf-8') as f:
f.write("What is machine learning?\n")
f.write("Explain neural networks\n")
f.write("Tell me about Python\n")
ARGS = {
'prompts_file': prompts_file
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| make_expand_adapter_key |
Ran ran; our contract draft was wrong, not the code |
nahyeonkaty/textboost/src/textboost/expand_bank.py code served (permissive licence) · get_code("bcd8d413e1a72650") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
# The function make_expand_adapter_key takes a layer_name string and replaces
# dots with double underscores. It's a simple string transformation function.
# No complex objects needed - just a string parameter.
ARGS = {
"layer_name": "transformer.layer.0.attention"
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| tokenize_prompt |
Ran ran; our contract draft was wrong, not the code |
nahyeonkaty/textboost/src/textboost/datasets.py code served (permissive licence) · get_code("424823a175dc433e") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
torch.manual_seed(0)
class MockTokenizer:
def __init__(self):
self.model_max_length = 77
def __call__(self, prompt, truncation=False, padding=None, max_length=None, return_tensors=None):
# Simulate tokenizer output
# Returns a dict with 'input_ids' and 'attention_mask' as tensors
batch_size = 1
seq_len = max_length if max_length else 10
input_ids = torch.randint(0, 1000, (batch_size, seq_len))
attention_mask = torch.ones((batch_size, seq_len))
return {
'input_ids': input_ids,
'attention_mask': attention_mask
}
tokenizer = MockTokenizer()
prompt = "A beautiful landscape with mountains and rivers"
tokenizer_max_length = None
ARGS = {
'tokenizer': tokenizer,
'prompt': prompt,
'tokenizer_max_length': tokenizer_max_length
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| attach_adapters_to_model |
Not yet run unverified (harvested, no recorded run) |
nahyeonkaty/textboost/src/textboost/adapters.py code served (permissive licence) · get_code("fec6bb93784f10f0") How it ran |
| custom_lora_forward |
Not yet run unverified (harvested, no recorded run) |
nahyeonkaty/textboost/src/textboost/attention_processor.py code served (permissive licence) · get_code("5fa7f7068bb368b3") How it ran |
| discover_instances |
Not yet run unverified (harvested, no recorded run) |
nahyeonkaty/textboost/src/textboost/evaluation/core.py code served (permissive licence) · get_code("809de9bd5d464d12") How it ran |