| compute_optical_flow |
Ran ran; our contract draft was wrong, not the code |
QuanjianSong/UniVST/src/cal_optica_flow.py code served (permissive licence) · get_code("9dc5ed9af1ae77a3") 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 4, dtype family float, shape (2, 2, 4, 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 torch
import torch.nn as nn
torch.manual_seed(0)
# Create a minimal optical flow model
class OpticalFlowModel(nn.Module):
def __init__(self):
super().__init__()
self.conv = nn.Conv2d(6, 2, kernel_size=3, padding=1)
def forward(self, image1, image2):
# Concatenate the two images and predict flow
x = torch.cat([image1, image2], dim=1)
flow = self.conv(x)
return flow
# Create model instance
model = OpticalFlowModel()
# Create small image tensors: batch_size=2, channels=3, height=4, width=3
image1 = torch.randn(2, 3, 4, 3)
image2 = torch.randn(2, 3, 4, 3)
ARGS = {
"model": model,
"image1": image1,
"image2": image2,
}
- 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 4, dtype family float, shape (2, 2, 4, 3) — shape (2, 2, 4, 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
|
| ddim_inversion |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
QuanjianSong/UniVST/inversion_tools/ddim_inversion.py code served (permissive licence) · get_code("1169106085f0f41b") 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 5, 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 torch
import torch.nn as nn
import os
from collections import namedtuple
torch.manual_seed(0)
class MockTokenizer:
def __init__(self):
self.model_max_length = 77
def __call__(self, texts, padding=None, max_length=None, truncation=False, return_tensors=None):
batch_size = len(texts)
seq_len = max_length or 77
input_ids = torch.randint(0, 1000, (batch_size, seq_len))
MockTokenizerOutput = namedtuple('TokenizerOutput', ['input_ids'])
return MockTokenizerOutput(input_ids=input_ids)
class MockTextEncoder(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(77, 8)
def forward(self, input_ids):
batch_size = input_ids.shape[0]
embeddings = torch.randn(batch_size, 77, 8)
return (embeddings,)
class MockUNet(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 4)
def forward(self, latents, t, encoder_hidden_states=None, ft_indices=None, ft_timesteps=None, ft_path=None):
noise_pred = torch.randn_like(latents)
return {'sample': noise_pred}
class MockDDIMScheduler:
def __init__(self):
self.num_inference_steps = 50
self.config = namedtuple('Config', ['num_train_timesteps'])(num_train_timesteps=1000)
self.timesteps = torch.linspace(999, 0, 50, dtype=torch.long)
self.alphas_cumprod = torch.linspace(0.9999, 0.0, 1000)
self.final_alpha_cumprod = 0.0
class MockPipeline:
def __init__(self):
self.tokenizer = MockTokenizer()
self.text_encoder = MockTextEncoder()
self.unet = MockUNet()
self.device = 'cpu'
ARGS = {
'pipeline': MockPipeline(),
'ddim_scheduler': MockDDIMScheduler(),
'video_latent': torch.randn(2, 4, 8, 8),
'num_inv_steps': 5,
'prompt': 'a test prompt',
'inversion_path': None,
'ft_indices': None,
'ft_timesteps': None,
'ft_path': None,
'is_opt': False,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 5, 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
|
| ddim_loop |
Ran ran; our contract draft was wrong, not the code |
QuanjianSong/UniVST/inversion_tools/ddim_inversion.py code served (permissive licence) · get_code("bf23aea5d38d1f03") 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 5, 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 torch
import torch.nn as nn
import numpy as np
from collections import namedtuple
from unittest.mock import Mock
torch.manual_seed(0)
# Mock tokenizer
class MockTokenizer:
def __init__(self):
self.model_max_length = 77
def __call__(self, texts, padding=None, max_length=None, truncation=False, return_tensors=None):
batch_size = len(texts)
seq_len = max_length or self.model_max_length
input_ids = torch.randint(0, 1000, (batch_size, seq_len))
return namedtuple('TokenizerOutput', ['input_ids'])(input_ids=input_ids)
# Mock text encoder
class MockTextEncoder(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(77, 8)
def forward(self, input_ids):
batch_size = input_ids.shape[0]
embeddings = torch.randn(batch_size, 77, 8)
return (embeddings,)
# Mock UNet
class MockUNet(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 4)
def forward(self, latents, t, encoder_hidden_states=None, ft_indices=None, ft_timesteps=None, ft_path=None):
batch_size = latents.shape[0]
noise_pred = torch.randn_like(latents)
return {'sample': noise_pred}
# Mock scheduler
class MockDDIMScheduler:
def __init__(self):
self.config = Mock()
self.config.num_train_timesteps = 1000
self.num_inference_steps = 50
self.timesteps = torch.linspace(999, 0, 50, dtype=torch.long)
self.alphas_cumprod = torch.linspace(0.9999, 0.0001, 1000)
self.final_alpha_cumprod = 0.0
# Mock pipeline
class MockPipeline:
def __init__(self):
self.tokenizer = MockTokenizer()
self.text_encoder = MockTextEncoder()
self.unet = MockUNet()
self.device = 'cpu'
pipeline = MockPipeline()
ddim_scheduler = MockDDIMScheduler()
latent = torch.randn(2, 4, 4, 3)
num_inv_steps = 5
prompt = "a beautiful landscape"
inversion_path = None
ft_indices = None
ft_timesteps = None
ft_path = None
ARGS = {
'pipeline': pipeline,
'ddim_scheduler': ddim_scheduler,
'latent': latent,
'num_inv_steps': num_inv_steps,
'prompt': prompt,
'inversion_path': inversion_path,
'ft_indices': ft_indices,
'ft_timesteps': ft_timesteps,
'ft_path': ft_path,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 5, 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
|
| ddim_loop_plus |
Ran ran; our contract draft was wrong, not the code |
QuanjianSong/UniVST/inversion_tools/ddim_inversion.py code served (permissive licence) · get_code("f8fec9be80913739") 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 5, 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 torch
import torch.nn as nn
import numpy as np
from unittest.mock import Mock, MagicMock
torch.manual_seed(0)
# Create a minimal tokenizer mock
class MockTokenizer:
def __init__(self):
self.model_max_length = 77
def __call__(self, texts, padding=None, max_length=None, truncation=None, return_tensors=None):
batch_size = len(texts)
result = Mock()
result.input_ids = torch.randint(0, 1000, (batch_size, max_length))
return result
# Create a minimal text encoder
class MockTextEncoder(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(1000, 8)
def forward(self, input_ids):
# Return tuple with embeddings as first element
batch_size, seq_len = input_ids.shape
embeddings = torch.randn(batch_size, seq_len, 8)
return (embeddings,)
# Create a minimal UNet
class MockUNet(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 4)
def forward(self, latents, timestep, encoder_hidden_states=None, ft_indices=None, ft_timesteps=None, ft_path=None):
noise_pred = torch.randn_like(latents)
return {'sample': noise_pred}
# Create a minimal DDIM scheduler
class MockDDIMScheduler:
def __init__(self):
self.config = Mock()
self.config.num_train_timesteps = 1000
self.num_inference_steps = 50
self.timesteps = torch.linspace(999, 0, 50).long()
# Create alphas_cumprod: should have 1000 elements
self.alphas_cumprod = torch.linspace(1.0, 0.1, 1000)
self.final_alpha_cumprod = 0.1
# Create a minimal pipeline
class MockPipeline:
def __init__(self):
self.tokenizer = MockTokenizer()
self.text_encoder = MockTextEncoder()
self.unet = MockUNet()
self.device = 'cpu'
# Construct arguments
pipeline = MockPipeline()
ddim_scheduler = MockDDIMScheduler()
latent = torch.randn(2, 4, 3, 5) # batch=2, channels=4, height=3, width=5
num_inv_steps = 3
prompt = "a beautiful landscape"
inversion_path = None # No file I/O
ft_indices = None
ft_timesteps = None
ft_path = None
ARGS = {
'pipeline': pipeline,
'ddim_scheduler': ddim_scheduler,
'latent': latent,
'num_inv_steps': num_inv_steps,
'prompt': prompt,
'inversion_path': inversion_path,
'ft_indices': ft_indices,
'ft_timesteps': ft_timesteps,
'ft_path': ft_path,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list, ndim 5, 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
|
| load_ddim_latents_at_t |
Ran ran, honoured the contract we drafted |
QuanjianSong/UniVST/src/util.py code served (permissive licence) · get_code("1f54bc9dcfec9407") 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 (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 os
import torch
import tempfile
import shutil
torch.manual_seed(0)
# Create a temporary directory to hold the latents files
temp_dir = tempfile.mkdtemp()
# Create sample latent tensors and save them
t_value = 5
sample_latent = torch.randn(2, 4)
# Save as x0 variant
x0_path = os.path.join(temp_dir, f'ddim_x0_{t_value}.pt')
torch.save(sample_latent, x0_path)
# Save as regular latents variant
latents_path = os.path.join(temp_dir, f'ddim_latents_{t_value}.pt')
torch.save(sample_latent, latents_path)
ARGS = {
't': t_value,
'ddim_latents_path': temp_dir,
'is_x0': False
}
- 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 (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
|
| load_image |
Ran ran, honoured the contract we drafted |
QuanjianSong/UniVST/src/cal_optica_flow.py code served (permissive licence) · get_code("b5d651334526030f") 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 3, dtype family int, shape (10, 15, 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 cv2
import numpy as np
import tempfile
import os
# Create a temporary image file for testing
temp_dir = tempfile.mkdtemp()
image_array = np.uint8(np.random.randint(0, 256, (10, 15, 3))) # Small BGR image
temp_image_path = os.path.join(temp_dir, "test_image.png")
cv2.imwrite(temp_image_path, image_array)
ARGS = {
"image_path": temp_image_path
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 3, dtype family int, shape (10, 15, 3) — shape (10, 15, 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
|
| mask_propogation |
Ran ran; our contract draft was wrong, not the code |
QuanjianSong/UniVST/src/mask_propagation.py code served (permissive licence) · get_code("3b0c2f3ede9c1b37") 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.functional as F
torch.manual_seed(0)
# Create small tensors with distinct sizes for different dimensions
# feat_src: normalized source features, used in matrix mult with feat_tar
# Shape should be (feature_dim, num_src) - let's use (4, 3)
feat_src = torch.randn(4, 3)
# feat_tar: target features that get normalized along dim=1 and squeezed
# Shape should be (1, num_tar, feature_dim) before squeeze, (num_tar, feature_dim) after
# Let's use (1, 5, 4) so after squeeze it's (5, 4)
feat_tar = torch.randn(1, 5, 4)
# segs: segmentation mask, used in torch.mm with aff
# aff will have shape (num_tar, num_src) = (5, 3)
# segs must be compatible: (num_segs, num_src) = (2, 3)
segs = torch.randn(2, 3)
# args: simple config object with temperature, topk, and sample_ratio
class Args:
def __init__(self):
self.temperature = 0.1
self.topk = 2
self.sample_ratio = 0.8
args = Args()
ARGS = {
"feat_src": feat_src,
"feat_tar": feat_tar,
"segs": segs,
"args": args
}
- 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 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
|
| norm_mask |
Ran ran; our contract draft was wrong, not the code |
QuanjianSong/UniVST/src/mask_propagation.py code served (permissive licence) · get_code("531244cdc63cdb47") 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 3, dtype family float, shape (3, 4, 5) 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
torch.manual_seed(0)
# The function expects a tensor with shape (c, h, w)
# where c is the number of channels
# It normalizes each channel independently
mask = torch.randn(3, 4, 5)
ARGS = {
"mask": mask
}
- 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 3, dtype family float, shape (3, 4, 5) — shape (3, 4, 5) 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
|
| preprocess_image |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
QuanjianSong/UniVST/src/cal_optica_flow.py code served (permissive licence) · get_code("ff721c733e7512f0") 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 4, dtype family float, shape (1, 3, 4, 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 torch
import numpy as np
torch.manual_seed(0)
# Create a small image as numpy array (height=4, width=3, channels=3)
image = np.random.randint(0, 256, size=(4, 3, 3), dtype=np.uint8)
# Set device to CPU
device = torch.device('cpu')
ARGS = {
'image': image,
'device': device
}
- 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 Tensor, ndim 4, dtype family float, shape (1, 3, 4, 3) — shape (1, 3, 4, 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
|
| read_feature |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
QuanjianSong/UniVST/src/mask_propagation.py code served (permissive licence) · get_code("8bbe84a3f6d6e241") 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 (12, 5) as a later run recorded it. 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, 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 tempfile
import os
torch.manual_seed(0)
# Create a temporary file with a saved tensor
# The function expects a path to a torch file
temp_dir = tempfile.mkdtemp()
temp_path = os.path.join(temp_dir, "feature.pt")
# Create a sample tensor: shape (num_frames, height, width, channels)
# Let's make it (2, 4, 3, 5) so we have 2 frames, 4 height, 3 width, 5 channels
sample_data = torch.randn(2, 4, 3, 5)
torch.save(sample_data, temp_path)
ARGS = {
"path": temp_path,
"frame_index": 0,
"return_h_w": False
}
- 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 (12, 5) — shape (12, 5) 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
|
| rf_inversion |
Ran ran; our contract draft was wrong, not the code |
QuanjianSong/UniVST/inversion_tools/flow_inversion.py code served (permissive licence) · get_code("cc4556fdffc74a1f") 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 (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
from unittest.mock import Mock
torch.manual_seed(0)
# Mock scheduler that provides sigmas
class MockScheduler:
def __init__(self):
self.sigmas = torch.linspace(0.9, 0.1, 50)
def set_timesteps(self, num_inference_steps, device):
self.sigmas = torch.linspace(0.9, 0.1, num_inference_steps).to(device)
# Mock transformer that takes the required inputs
class MockTransformer(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 4)
def forward(self, hidden_states, timestep, encoder_hidden_states, pooled_projections,
idx=None, ft_indices=None, ft_timesteps=None, ft_path=None, return_dict=False):
# Return velocity prediction
output = self.linear(hidden_states)
if return_dict:
return {"sample": output}
return (output,)
# Mock pipeline
class MockPipeline:
def __init__(self):
self.device = torch.device('cpu')
self.transformer = MockTransformer()
self.scheduler = MockScheduler()
def encode_prompt(self, prompt='', prompt_2='', prompt_3=''):
batch_size = 2
seq_len = 8
hidden_dim = 4
prompt_embeds = torch.randn(batch_size, seq_len, hidden_dim)
negative_prompt_embeds = torch.randn(batch_size, seq_len, hidden_dim)
pooled_prompt_embeds = torch.randn(batch_size, hidden_dim)
negative_pooled_prompt_embeds = torch.randn(batch_size, hidden_dim)
return prompt_embeds, negative_prompt_embeds, pooled_prompt_embeds, negative_pooled_prompt_embeds
def progress_bar(self, total):
# Return a context manager that does nothing
class ProgressBar:
def __enter__(self):
return self
def __exit__(self, *args):
pass
def update(self):
pass
return ProgressBar()
# Create pipeline instance
pipeline = MockPipeline()
# Create image latents (batch=2, channels=4)
image_latents = torch.randn(2, 4)
ARGS = {
'pipeline': pipeline,
'image_latents': image_latents,
'prompt': 'a test image',
'gamma': 0.5,
'num_inference_steps': 50,
'inversion_path': None,
'ft_indices': None,
'ft_timesteps': None,
'ft_path': None,
}
- 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 (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
|
| rf_solver |
Ran ran; our contract draft was wrong, not the code |
QuanjianSong/UniVST/inversion_tools/flow_inversion.py code served (permissive licence) · get_code("04eae86d12fb5ffc") 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 (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
torch.manual_seed(0)
# Create a minimal scheduler that provides set_timesteps and sigmas
class MinimalScheduler:
def __init__(self):
self.sigmas = None
def set_timesteps(self, num_inference_steps, device=None):
# Create sigmas as a descending sequence from 1.0 to 0.0
self.sigmas = torch.linspace(1.0, 0.0, num_inference_steps + 1, device=device)
# Create a minimal transformer that accepts the required inputs
class MinimalTransformer(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 4)
def forward(self, hidden_states, timestep, encoder_hidden_states, pooled_projections,
idx=None, ft_indices=None, ft_timesteps=None, ft_path=None, return_dict=False):
# Return a tensor matching hidden_states shape
output = self.linear(hidden_states)
if return_dict:
return {"sample": output}
return (output,)
# Create a minimal progress bar context manager
class MinimalProgressBar:
def __init__(self, total=None):
self.total = total
def __enter__(self):
return self
def __exit__(self, *args):
pass
def update(self):
pass
# Create a minimal pipeline with required methods and attributes
class MinimalPipeline:
def __init__(self):
self.scheduler = MinimalScheduler()
self.transformer = MinimalTransformer()
self.device = torch.device('cpu')
def encode_prompt(self, prompt='', prompt_2='', prompt_3=''):
# Return 4 embeddings tensors
prompt_embeds = torch.randn(2, 8, 4)
negative_prompt_embeds = torch.randn(2, 8, 4)
pooled_prompt_embeds = torch.randn(2, 4)
negative_pooled_prompt_embeds = torch.randn(2, 4)
return prompt_embeds, negative_prompt_embeds, pooled_prompt_embeds, negative_pooled_prompt_embeds
def progress_bar(self, total=None):
return MinimalProgressBar(total=total)
# Create instances
pipeline = MinimalPipeline()
image_latents = torch.randn(2, 4) # batch_size=2, latent_dim=4
ARGS = {
'pipeline': pipeline,
'image_latents': image_latents,
'prompt': 'a test prompt',
'num_inference_steps': 5,
'inversion_path': None,
'ft_indices': None,
'ft_timesteps': None,
'ft_path': None,
}
- 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 (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
|