| apply_pca |
Ran ran on a synthesized input |
MinishLab/model2vec/model2vec/distill/inference.py code served (permissive licence) · get_code("f977b771831e8cfd") 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 ndarray, ndim 2, dtype family float, shape (8, 3) 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 numpy as np
import logging
logging.basicConfig(level=logging.INFO)
# Create a small sample embedding matrix
# Shape: (n_samples=8, n_features=6)
embeddings = np.random.randn(8, 6).astype(np.float32)
ARGS = {
"embeddings": embeddings,
"pca_dims": 3,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 2, dtype family float, shape (8, 3) — shape (8, 3) 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
|
| approximate_function |
Ran ran, honoured the contract we drafted |
dleemiller/WordLlama/src/wordllama/adapters/binarizer.py code served (permissive licence) · get_code("09cf7bf4ad177244") 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 float, 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 math
torch_import_attempted = False
try:
import torch
torch_import_attempted = True
except:
pass
# The function approximate_function takes two parameters:
# x: a numeric value (int, float, or could be a scalar)
# o: a numeric value used as divisor in exponentiation
# Looking at the function body:
# - x is compared with 0
# - x is passed to math.pow with exponent 1/o
# - o is used in division (1/o)
# Both x and o should be numeric types
# Create simple numeric arguments
x_value = 2.5
o_value = 3.0
ARGS = {
"x": x_value,
"o": o_value,
}
- 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 float, 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
|
| binary_only |
Ran ran on a synthesized input |
dleemiller/WordLlama/src/wordllama/mode_decorators.py code served (permissive licence) · get_code("58271a558cadd0d5") 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 function. 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 functools import wraps
torch.manual_seed(0)
def binary_only(method):
"""Decorator to ensure the method is only called when using binary embeddings."""
@wraps(method)
def wrapper(self, *args, **kwargs):
if not self.binary:
raise ValueError(f"The method '{method.__name__}' is only implemented for binary embeddings.")
return method(self, *args, **kwargs)
return wrapper
class MockEmbeddingModel(nn.Module):
def __init__(self, binary=True):
super().__init__()
self.binary = binary
self.embedding = nn.Embedding(10, 4)
@binary_only
def encode(self, x):
return self.embedding(x)
def sample_method(self):
"""Sample method to be decorated."""
return "method executed"
class TestClass:
def __init__(self, binary=True):
self.binary = binary
@binary_only
def test_method(self, value=42):
return value * 2
# Create instances for testing
mock_model = MockEmbeddingModel(binary=True)
test_instance = TestClass(binary=True)
# Define decorator as the function parameter
ARGS = {
"method": sample_method
}
- 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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| collect_sentences |
Ran ran on a synthesized input |
twadada/swe4semantics/apply_pca_xling.py code served (permissive licence) · get_code("69e02678a3940a6f") 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 pickle
import numpy as np
import tempfile
import os
# Create a mock language detector
class MockLanguageDetector:
def detect_language_of(self, sent):
# Return a mock language object with iso_code_639_1
return MockLanguage()
class MockLanguage:
class ISOCode:
def __init__(self):
self.name = "EN"
def __init__(self):
self.iso_code_639_1 = self.ISOCode()
# Create a temporary pickle file with word2sent dictionary
temp_dir = tempfile.mkdtemp()
word2sent_path = os.path.join(temp_dir, "word2sent.pkl")
# Create sample word2sent dictionary with sentences
word2sent = {
"hello": ["hello world"] * 15,
"world": ["world peace"] * 12,
"test": ["test sentence one", "test sentence two", "test sentence three"] * 4,
}
with open(word2sent_path, 'wb') as f:
pickle.dump(word2sent, f)
# Create detector instance
detector = MockLanguageDetector()
ARGS = {
"word2sent_path": word2sent_path,
"target_lang": "en",
"detector": detector,
"max_sents": 100000
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — 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
|
| compute_weights |
Ran ran on a synthesized input |
MinishLab/model2vec/model2vec/distill/inference.py code served (permissive licence) · get_code("c0e21d259c6de207") 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 ndarray, ndim 1, dtype family float, shape (100,) 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 numpy as np
import logging
logging.basicConfig(level=logging.INFO)
# Define arguments for compute_weights function
ARGS = {
"n_embeddings": 100,
"sif_coefficient": 0.999
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (100,) — shape (100,) 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
|
| contrastive_loss |
Ran ran on a synthesized input |
twadada/swe4semantics/train_xling.py code served (permissive licence) · get_code("bc033863eb7b03a6") 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 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 torch.nn.functional as F
torch.manual_seed(0)
# The function takes two similarity matrices (sim_s and sim_t)
# and computes a contrastive loss using log_softmax and softmax
# Both parameters should be 2D tensors (batch_size, num_classes/logits)
# Create small tensors with distinct dimensions for clarity
batch_size = 2
num_logits = 4
# sim_s: student similarities - will have log_softmax applied
sim_s = torch.randn(batch_size, num_logits)
# sim_t: teacher similarities - will have softmax applied
sim_t = torch.randn(batch_size, num_logits)
ARGS = {
"sim_s": sim_s,
"sim_t": sim_t,
}
- 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 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
|
| create_embeddings |
Ran ran on a synthesized input |
MinishLab/model2vec/model2vec/distill/inference.py code served (permissive licence) · get_code("f50a4fe67500f002") 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 ndarray, ndim 2, dtype family float, shape (2, 4) 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
import numpy as np
from enum import Enum
from transformers.modeling_outputs import BaseModelOutputWithPoolingAndCrossAttentions
torch.manual_seed(0)
class PoolingMode(str, Enum):
MEAN = 'mean'
LAST = 'last'
FIRST = 'first'
POOLER = 'pooler'
class MockModel(nn.Module):
"""Minimal mock model that satisfies PreTrainedModel interface for testing."""
def __init__(self, hidden_size=4, vocab_size=100):
super().__init__()
self.hidden_size = hidden_size
self.device_attr = 'cpu'
self.linear = nn.Linear(hidden_size, hidden_size)
self.pooler = nn.Linear(hidden_size, hidden_size)
@property
def device(self):
return self.device_attr
def forward(self, input_ids, attention_mask=None, **kwargs):
batch_size = input_ids.shape[0]
seq_len = input_ids.shape[1]
# Create dummy last_hidden_state
last_hidden_state = torch.randn(batch_size, seq_len, self.hidden_size)
# Create dummy pooler_output
pooler_output = torch.randn(batch_size, self.hidden_size)
return BaseModelOutputWithPoolingAndCrossAttentions(
last_hidden_state=last_hidden_state,
pooler_output=pooler_output
)
def to(self, device):
self.device_attr = device
return super().to(device)
def eval(self):
return super().eval()
# Create mock model
model = MockModel(hidden_size=4, vocab_size=100)
# Create small tokenized input: list of token sequences
# Each sequence is a list of token ids
tokenized = [
[1, 2, 3, 4],
[5, 6, 7],
]
# Device
device = 'cpu'
# Pad token id
pad_token_id = 0
# Pooling mode
pooling = PoolingMode.MEAN
ARGS = {
'model': model,
'tokenized': tokenized,
'device': device,
'pad_token_id': pad_token_id,
'pooling': pooling,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch, tqdm, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
|
| dense_only |
Ran ran on a synthesized input |
dleemiller/WordLlama/src/wordllama/mode_decorators.py code served (permissive licence) · get_code("dd25f90bf6f229e8") 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 function. 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 functools import wraps
torch.manual_seed(0)
# Define a small stand-in class that has the required 'binary' attribute
class EmbeddingModel:
def __init__(self, binary=False):
self.binary = binary
def some_method(self):
"""A method that would be decorated with @dense_only"""
return "method executed"
# Create a decorated method for testing
def dense_only(method):
"""Decorator to ensure the method is only called when using dense embeddings."""
@wraps(method)
def wrapper(self, *args, **kwargs):
if self.binary:
raise ValueError(f"The method '{method.__name__}' is only implemented for dense embeddings.")
return method(self, *args, **kwargs)
return wrapper
# Apply decorator to a test method
class TestEmbedding:
def __init__(self, binary=False):
self.binary = binary
@dense_only
def process(self):
return "processing with dense embeddings"
# Create instances to test the decorator
instance_dense = TestEmbedding(binary=False)
instance_binary = TestEmbedding(binary=True)
# The decorator function itself takes a method as parameter
def sample_method(self):
return "test"
ARGS = {
"method": sample_method
}
- 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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| encode_sentences |
Ran ran on a synthesized input |
twadada/swe4semantics/apply_pca.py code served (permissive licence) · get_code("4a593281de8cc870") 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 ndarray, ndim 2, dtype family float, shape (2, 4) 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 numpy as np
from unittest.mock import Mock
# Create a mock word2vec dictionary with small embeddings
word2vec = {
'hello': np.array([0.1, 0.2, 0.3, 0.4]),
'world': np.array([0.5, 0.6, 0.7, 0.8]),
'foo': np.array([0.2, 0.3, 0.4, 0.5]),
'bar': np.array([0.3, 0.4, 0.5, 0.6]),
'test': np.array([0.4, 0.5, 0.6, 0.7]),
'sentence': np.array([0.1, 0.1, 0.1, 0.1]),
'this': np.array([0.2, 0.2, 0.2, 0.2]),
'is': np.array([0.3, 0.3, 0.3, 0.3]),
'a': np.array([0.4, 0.4, 0.4, 0.4]),
}
# Create mock tokenizer with required methods
mock_tokenizer = Mock()
mock_backend_tokenizer = Mock()
mock_pre_tokenizer = Mock()
# Define pre_tokenize_str to return tuples of (word, (start, end))
def pre_tokenize_str_fn(text):
words = text.split()
result = [(w, (i, i+1)) for i, w in enumerate(words)]
return result
mock_pre_tokenizer.pre_tokenize_str = pre_tokenize_str_fn
mock_backend_tokenizer.pre_tokenizer = mock_pre_tokenizer
mock_tokenizer.backend_tokenizer = mock_backend_tokenizer
# Create mock model_tokenizer with tokenize method
mock_model_tokenizer = Mock()
def tokenize_fn(word):
# Simple tokenization: return character-level tokens
return list(word)
mock_model_tokenizer.tokenize = tokenize_fn
# Create test sentences
sents = [
'hello world',
'foo bar test',
]
ARGS = {
'tokenizer': mock_tokenizer,
'word2vec': word2vec,
'sents': sents,
'model_tokenizer': mock_model_tokenizer,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
|
| encode_text |
Ran ran on a synthesized input |
twadada/swe4semantics/util.py code served (permissive licence) · get_code("51357003448ec154") 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 ndarray, ndim 1, dtype family float, shape (4,) 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 numpy as np
class SimpleWordTokenizer:
def __call__(self, text):
# Returns list of (word, pos) tuples
words = text.split()
return [(w, i) for i, w in enumerate(words)]
class SimpleModelTokenizer:
def tokenize(self, word):
# Returns list of subword tokens
if len(word) > 2:
return [word[:2], '##' + word[2:]]
return [word]
# Create a small word2vec dictionary (word -> embedding)
word2vec = {
'hello': np.array([0.1, 0.2, 0.3, 0.4]),
'world': np.array([0.5, 0.6, 0.7, 0.8]),
'hel': np.array([0.15, 0.25, 0.35, 0.45]),
'test': np.array([0.2, 0.3, 0.4, 0.5]),
}
punct_list = ['.', ',', '!', '?', ';', ':']
ARGS = {
'text': 'hello world test',
'word_tokenizer': SimpleWordTokenizer(),
'model_tokenizer': SimpleModelTokenizer(),
'punct_list': punct_list,
'word2vec': word2vec,
'edim': 4,
'normalise': True,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) 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
|
| encode_text_xling |
Ran ran on a synthesized input |
twadada/swe4semantics/util.py code served (permissive licence) · get_code("c5b4dcb8d8305191") 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 ndarray, ndim 1, dtype family float, shape (4,) 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 numpy as np
class MockWordTokenizer:
def __call__(self, text):
# Returns list of tuples where first element is the token
words = text.split()
return [(w, 0) for w in words]
class MockModelTokenizer:
def tokenize(self, text):
# Returns list of subword tokens, some with ## prefix for continuation
if text == "hello":
return ["hello"]
elif text == "world":
return ["world"]
elif text == "test":
return ["test"]
else:
# For subword tokenization
return [text[:2], "##" + text[2:]] if len(text) > 2 else [text]
# Create a small word2vec dictionary mapping words to embeddings
word2vec = {
"hello": np.array([0.1, 0.2, 0.3, 0.4]),
"world": np.array([0.5, 0.6, 0.7, 0.8]),
"test": np.array([0.2, 0.3, 0.4, 0.5]),
"he": np.array([0.15, 0.25, 0.35, 0.45]),
"lo": np.array([0.11, 0.22, 0.33, 0.44]),
}
# Punctuation list
punct_list = {".", ",", "!", "?", ";", ":"}
ARGS = {
"lang": "en",
"text": "hello world test",
"word_tokenizer": MockWordTokenizer(),
"model_tokenizer": MockModelTokenizer(),
"punct_list": punct_list,
"word2vec": word2vec,
"edim": 4,
"normalise": True,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (4,) — shape (4,) 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
|
| evaluate_single_or_multi_label |
Ran ran on a synthesized input |
MinishLab/model2vec/model2vec/inference/evaluation.py code served (permissive licence) · get_code("916dbf02798a730a") 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 numpy as np
# Single-label case with integer labels
predictions_single = np.array([0, 1, 2, 0])
y_single = [0, 1, 1, 0]
ARGS = {
"predictions": predictions_single,
"y": y_single,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — 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
|
| identify_word_indices |
Ran ran on a synthesized input |
twadada/swe4semantics/extract_embs.py code served (permissive licence) · get_code("a9c6c44e3bbf7f00") 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 numpy as np
class MockTokenizer:
def convert_ids_to_tokens(self, token_ids):
# Return mock tokens that can be decoded
# Using simple mapping: 0->'a', 1->'b', 2->'c', etc.
tokens = []
for tid in token_ids:
if tid == 0:
tokens.append('a')
elif tid == 1:
tokens.append('b')
elif tid == 2:
tokens.append('c')
elif tid == 3:
tokens.append('▁d') # with space marker
else:
tokens.append('x')
return tokens
# Create batch_ids: list of lists, each representing token ids in a sentence
batch_ids = [
[0, 1, 2, 3, 0, 1], # first sentence
[2, 0, 1, 2, 0], # second sentence
]
# Define a token to search for (as string)
token = "a"
# Define token_ids (ids corresponding to the token to find)
token_ids = [0]
# Create tokenizer
tokenizer = MockTokenizer()
# Other parameters
init_idx = 0
subword = False
ARGS = {
'batch_ids': batch_ids,
'token': token,
'token_ids': token_ids,
'tokenizer': tokenizer,
'init_idx': init_idx,
'subword': subword,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — 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
|
| merge_word_vectors |
Ran ran on a synthesized input |
twadada/swe4semantics/apply_pca_xling.py code served (permissive licence) · get_code("2dd0e5f64e28e235") 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
import numpy as np
torch.manual_seed(0)
# Create small word2vec dictionaries (word -> vector mapping)
# Each dictionary maps words to numpy arrays representing vectors
w2v_1 = {
'hello': np.array([0.1, 0.2, 0.3, 0.4]),
'world': np.array([0.5, 0.6, 0.7, 0.8]),
'python': np.array([0.9, 1.0, 1.1, 1.2]),
}
w2v_2 = {
'hello': np.array([0.15, 0.25, 0.35, 0.45]),
'world': np.array([0.55, 0.65, 0.75, 0.85]),
'code': np.array([1.3, 1.4, 1.5, 1.6]),
}
w2v_3 = {
'python': np.array([0.95, 1.05, 1.15, 1.25]),
'code': np.array([1.35, 1.45, 1.55, 1.65]),
'merge': np.array([2.0, 2.1, 2.2, 2.3]),
}
word2vec_list = [w2v_1, w2v_2, w2v_3]
ARGS = {
'word2vec_list': word2vec_list
}
- 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 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
|
| quantize_and_reduce_dim |
Ran ran on a synthesized input |
MinishLab/model2vec/model2vec/quantization.py code served (permissive licence) · get_code("a61103d9c8d1b43e") 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 ndarray, ndim 2, dtype family float, shape (2, 3) 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 numpy as np
from enum import Enum
class DType(str, Enum):
Float16 = 'float16'
Float32 = 'float32'
Float64 = 'float64'
Int8 = 'int8'
dtype_map = {DType.Float16: np.float16, DType.Float32: np.float32, DType.Float64: np.float64, DType.Int8: np.int8}
def quantize_embeddings(embeddings: np.ndarray, quantize_to: DType) -> np.ndarray:
"""Quantize embeddings to a specified data type to reduce memory usage.
:param embeddings: The embeddings to quantize, as a numpy array.
:param quantize_to: The data type to quantize to.
:return: The quantized embeddings.
:raises ValueError: If the quantization type is not valid.
"""
mapped_dtype = dtype_map[quantize_to]
if embeddings.dtype == mapped_dtype:
return embeddings
if quantize_to in {DType.Float16, DType.Float32, DType.Float64}:
return embeddings.astype(mapped_dtype)
elif quantize_to == DType.Int8:
scale = np.max(np.abs(embeddings)) / 127.0
buf = embeddings.astype(np.float16, copy=True)
np.divide(buf, scale, out=buf)
np.rint(buf, out=buf)
np.clip(buf, -127, 127, out=buf)
quantized = buf.astype(np.int8)
return quantized
else:
raise ValueError('Not a valid enum member of DType.')
def quantize_and_reduce_dim(embeddings: np.ndarray, quantize_to: str | DType | None, dimensionality: int | None) -> np.ndarray:
"""Quantize embeddings to a datatype and reduce dimensionality.
:param embeddings: The embeddings to quantize and reduce, as a numpy array.
:param quantize_to: The data type to quantize to. If None, no quantization is performed.
:param dimensionality: The number of dimensions to keep. If None, no dimensionality reduction is performed.
:return: The quantized and reduced embeddings.
:raises ValueError: If the passed dimensionality is not None and greater than the model dimensionality.
"""
if quantize_to is not None:
quantize_to = DType(quantize_to)
embeddings = quantize_embeddings(embeddings, quantize_to)
if dimensionality is not None:
if dimensionality > embeddings.shape[1]:
raise ValueError(f'Dimensionality {dimensionality} is greater than the model dimensionality {embeddings.shape[1]}')
embeddings = embeddings[:, :dimensionality]
return embeddings
np.random.seed(0)
embeddings = np.random.randn(2, 4).astype(np.float32)
ARGS = {
'embeddings': embeddings,
'quantize_to': DType.Float32,
'dimensionality': 3,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) 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
|
| quantize_embeddings |
Ran ran on a synthesized input |
MinishLab/model2vec/model2vec/quantization.py code served (permissive licence) · get_code("6062e9d596058d89") 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 ndarray, ndim 2, dtype family float, shape (2, 4) 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 numpy as np
from enum import Enum
class DType(str, Enum):
Float16 = 'float16'
Float32 = 'float32'
Float64 = 'float64'
Int8 = 'int8'
dtype_map = {DType.Float16: np.float16, DType.Float32: np.float32, DType.Float64: np.float64, DType.Int8: np.int8}
def quantize_embeddings(embeddings: np.ndarray, quantize_to: DType) -> np.ndarray:
"""Quantize embeddings to a specified data type to reduce memory usage.
:param embeddings: The embeddings to quantize, as a numpy array.
:param quantize_to: The data type to quantize to.
:return: The quantized embeddings.
:raises ValueError: If the quantization type is not valid.
"""
mapped_dtype = dtype_map[quantize_to]
if embeddings.dtype == mapped_dtype:
return embeddings
if quantize_to in {DType.Float16, DType.Float32, DType.Float64}:
return embeddings.astype(mapped_dtype)
elif quantize_to == DType.Int8:
scale = np.max(np.abs(embeddings)) / 127.0
buf = embeddings.astype(np.float16, copy=True)
np.divide(buf, scale, out=buf)
np.rint(buf, out=buf)
np.clip(buf, -127, 127, out=buf)
quantized = buf.astype(np.int8)
return quantized
else:
raise ValueError('Not a valid enum member of DType.')
# Create small embeddings array (2 samples, 4 dimensions)
embeddings = np.random.randn(2, 4).astype(np.float32)
ARGS = {
'embeddings': embeddings,
'quantize_to': DType.Float16
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
|
| read_existing_vocabulary |
Ran ran on a synthesized input |
twadada/swe4semantics/extract_embs.py code served (permissive licence) · get_code("14c9bef631548267") 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 set. 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 os
import tempfile
# Create a temporary file with vocabulary data
temp_dir = tempfile.mkdtemp()
count_file = os.path.join(temp_dir, "vocab_counts.txt")
# Write sample vocabulary data to the file
with open(count_file, 'w') as f:
f.write("hello 100\n")
f.write("world 50\n")
f.write("test 25\n")
f.write("</s> 1000\n") # special end token
ARGS = {
"count_file": count_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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
|
| select_optimal_device |
Ran ran on a synthesized input |
MinishLab/model2vec/model2vec/distill/utils.py code served (permissive licence) · get_code("951c3eaccb80dafe") 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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from packaging import version
torch.manual_seed(0)
# The function select_optimal_device takes a single parameter:
# device: str | None - The device to use, or None for automatic selection
# Test cases:
# 1. device=None (automatic selection)
# 2. device='cpu' (explicit CPU)
# 3. device='mps' (explicit MPS - may raise if broken)
# 4. device='cuda' (explicit CUDA - may raise if not available)
# We'll use None for the basic case since it exercises the auto-selection logic
ARGS = {
'device': None
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- packaging, 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
|
| encode_batch_with_padding |
Not yet run unverified (harvested, no recorded run) |
twadada/swe4semantics/extract_embs.py code served (permissive licence) · get_code("5ef8c214726b2b02") How it ran |
| encode_bilingual |
Not yet run unverified (harvested, no recorded run) |
twadada/swe4semantics/apply_pca_xling.py code served (permissive licence) · get_code("3f0af3ab0ecd4794") How it ran |
| load_w2v |
Not yet run unverified (harvested, no recorded run) |
twadada/swe4semantics/util.py code served (permissive licence) · get_code("8f3ae471496c40f1") How it ran |
| quantize_vocabulary |
Not yet run unverified (harvested, no recorded run) |
MinishLab/model2vec/model2vec/vocabulary_quantization.py code served (permissive licence) · get_code("27d601dc73cf7436") How it ran |