mihirma commited on
Commit
04c73cc
·
verified ·
1 Parent(s): a29c059

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-017fe428-81b7-48ec-8848-dde0366a0c2a1757261820226-2025_09_07-18.17.06.429/source.csv +13 -0
  2. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-01a8ecdc-729d-4ad7-9ea8-2c12971703011753434484022-2025_07_25-11.08.10.182/source.csv +0 -0
  3. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-03ba0d47-b31c-4c6c-ac79-ac489ea685411761933076688-2025_10_31-18.51.24.953/source.csv +0 -0
  4. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-0634b88a-747c-4356-abf7-e80a884442f51767715067534-2026_01_06-16.57.53.582/source.csv +2 -0
  5. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-0a104ef7-eb3a-4bff-84cc-f1eba2333f781767712241927-2026_01_06-16.10.55.632/source.csv +0 -0
  6. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-0f7f1a2c-8092-4a29-81e5-3d0f406b88711751465682686-2025_07_02-16.15.28.930/source.csv +0 -0
  7. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-10359e68-1b5b-4730-84bf-01e804b840591763052516161-2025_11_13-17.48.55.56/source.csv +0 -0
  8. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-1038e164-bc79-4edf-bc8b-4394e2f9188d1765559214036-2025_12_12-18.07.02.978/source.csv +0 -0
  9. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-103cfa3b-0cf6-479d-9d0f-3199e66c08ab1762947750775-2025_11_12-12.42.37.529/source.csv +0 -0
  10. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-1134a6dd-0fdc-4082-97df-46605fc3467b1764867592018-2025_12_04-18.00.02.650/source.csv +115 -0
  11. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-146ef5d6-6a61-4524-a0b3-945e53eb2cf21759396751223-2025_10_02-11.19.16.424/source.csv +0 -0
  12. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-14c33a6c-d06d-421b-aaef-66e0673e81a31753986093740-2025_07_31-20.21.52.136/source.csv +0 -0
  13. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-176105a9-1ac4-42e7-95d3-723f8a10a1311758800956713-2025_09_25-13.49.25.76/source.csv +72 -0
  14. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-1d1c9d40-4350-4512-82d6-f9fdf36759211756538623431-2025_08_30-08.23.49.356/source.csv +0 -0
  15. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-1e1272f3-7d2e-4b26-8662-ef59b0a62e821764410118523-2025_11_29-10.55.25.324/source.csv +0 -0
  16. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-20e92700-59ad-46ef-a859-4a9a5ba9057e1764863456200-2025_12_04-16.51.02.701/source.csv +0 -0
  17. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-210e88c5-c80c-4b42-a393-717923a05daf1751602893995-2025_07_04-06.22.30.835/source.csv +162 -0
  18. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-23fb2c21-9401-4393-bc27-ac58a13784d01764494621673-2025_11_30-10.23.55.182/source.csv +4 -0
  19. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-25373d4e-68c9-48b1-a295-2d5d418610141764451376541-2025_11_29-22.22.59.470/source.csv +0 -0
  20. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-25423ad6-b986-416f-a8e4-1361641f9a641761722232315-2025_10_29-08.17.22.663/source.csv +0 -0
  21. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-264a0e70-8280-4ed9-a47c-e76bfae594cd1754128841382-2025_08_02-12.01.32.618/source.csv +0 -0
  22. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-2670a8b6-206d-42c4-9853-62035f6f5d711759257890459-2025_09_30-20.44.56.213/source.csv +99 -0
  23. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-2a87081d-a5f9-4067-a052-9f108ae0c2231755784831268-2025_08_21-16.00.38.105/source.csv +0 -0
  24. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-2bf72b78-b5bd-4a14-b5d7-02cc594280a51763370541260-2025_11_17-10.09.08.462/source.csv +0 -0
  25. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-2cea4f45-eb3d-4d39-8263-124201da2dc81763721698838-2025_11_21-11.41.41.686/source.csv +0 -0
  26. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-32eb2334-bfbd-495b-9cfb-5985f2c45d901767713398872-2026_01_06-16.30.01.925/source.csv +3 -0
  27. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-39365de8-ec00-40b2-9194-9ae0d3b35fa01764869495182-2025_12_04-18.31.43.123/source.csv +145 -0
  28. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-3a117968-9cd5-4e01-83d9-233e653a8de81765444078704-2025_12_11-10.08.05.362/source.csv +0 -0
  29. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-3acd2db0-3113-49b5-8e71-f9e9af4b68f71755936119596-2025_08_23-10.02.09.940/source.csv +139 -0
  30. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-3d6dd2ac-00a0-4356-af22-1896e3d753c31767548094518-2026_01_04-18.35.00.916/source.csv +0 -0
  31. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-3fe74aa6-92c3-405a-9c6c-49c34aec593b1762364457821-2025_11_05-18.41.02.400/source.csv +0 -0
  32. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-4001b8e0-0e9c-4560-958e-a52f816eab081767861210539-2026_01_08-18.19.51.735/source.csv +394 -0
  33. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-46148775-4197-4774-bf77-8631ca6b73f01753557591807-2025_07_26-21.19.58.968/source.csv +0 -0
  34. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-46a00613-23fe-46e7-8ec3-6456b356c8531761050958195-2025_10_21-14.49.25.343/source.csv +0 -0
  35. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-46c4a757-02fe-4d2b-80c9-10277f3bc6421757061314730-2025_09_05-10.35.23.869/source.csv +258 -0
  36. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-48c89b00-1b87-4d4a-baa5-eeafbf11665c1755428958881-2025_08_17-13.09.25.387/source.csv +115 -0
  37. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-48dc8d22-5622-471d-af36-8bb5dbaedf1f1764861190077-2025_12_04-16.13.17.323/source.csv +741 -0
  38. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-496e7336-e907-40cd-b40d-8cabdd82c9b21758267888193-2025_09_19-09.44.55.786/source.csv +10 -0
  39. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-49d30a9b-2bd1-4042-8682-5ad6555396c71759741630177-2025_10_06-11.07.17.431/source.csv +0 -0
  40. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-4c510e1e-c7fc-4bd2-bf45-93d5487c2a0d1760868436827-2025_10_19-12.07.22.935/source.csv +16 -0
  41. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-50667a73-ae54-4bc8-b84f-f1f7ccbad60a1763324981508-2025_11_16-21.29.50.605/source.csv +0 -0
  42. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-59e067fd-ed43-41e8-b51d-604e03ee2ed51758537565603-2025_09_22-12.39.52.921/source.csv +411 -0
  43. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-5a3b8659-d0db-42f5-b7dd-d3e2e64a98251765453543132-2025_12_11-12.45.54.617/source.csv +0 -0
  44. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-6019fd0d-d2bb-47ee-aa7f-11a5c7ace2751762763426783-2025_11_10-09.30.33.347/source.csv +0 -0
  45. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-611269b4-0e84-4c9e-bf1f-977615101d0f1757099205038-2025_09_05-21.06.50.975/source.csv +0 -0
  46. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-6330439a-d206-4c7d-817f-c11b7dcf713d1765893327719-2025_12_16-14.55.41.665/source.csv +168 -0
  47. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-63ef9b25-3351-4174-890b-f49574ab1a3c1758993863516-2025_09_27-19.24.25.912/source.csv +512 -0
  48. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-67d7ccbe-baea-44be-8c55-3246f601694c1764925612614-2025_12_05-10.07.03.648/source.csv +52 -0
  49. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-6da126cd-f641-4a15-bc10-f51c6b432fda1753788630792-2025_07_29-13.30.37.18/source.csv +0 -0
  50. 1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-6eacf655-5590-4c9d-ad09-856f09c6e0121751568373129-2025_07_03-20.47.02.778/source.csv +282 -0
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-017fe428-81b7-48ec-8848-dde0366a0c2a1757261820226-2025_09_07-18.17.06.429/source.csv ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,3,"utils/nn.py",0,0,"import math\nfrom typing import Tuple, Callable, List\n\nfrom flax import nnx\nimport jax\nimport jax.numpy as jnp\nimport einops\n\n\nclass SpatioTemporalPositionalEncoding(nnx.Module):\n """"""\n Applies separate sinusoidal positional encodings to the temporal and spatial dimensions.\n """"""\n\n def __init__(self, d_model: int, max_len: int = 5000):\n self.d_model = d_model\n self.max_len = max_len\n\n pe = jnp.zeros((self.max_len, self.d_model))\n position = jnp.arange(0, self.max_len, dtype=jnp.float32)[:, None]\n div_term = jnp.exp(\n jnp.arange(0, self.d_model, 2) * (-math.log(10000.0) / self.d_model)\n )\n pe = pe.at[:, 0::2].set(jnp.sin(position * div_term))\n pe = pe.at[:, 1::2].set(jnp.cos(position * div_term))\n self.pe = nnx.Variable(pe)\n\n def __call__(self, x: jax.Array) -> jax.Array:\n """"""\n Args:\n x: The input tensor of shape (Batch, Time, Space, Dimension).\n\n Returns:\n The input tensor with positional encodings added.\n """"""\n assert x.ndim == 4, f""Input must be 4-dimensional, but got shape {x.shape}""\n\n num_timesteps = x.shape[1]\n num_spatial_patches = x.shape[2]\n\n # Temporal positional encoding: (1, T, 1, D)\n temporal_pe = self.pe.value[None, :num_timesteps, None, :]\n x = x + temporal_pe\n\n # Spatial positional encoding: (1, 1, S, D)\n spatial_pe = self.pe.value[None, None, :num_spatial_patches, :]\n x = x + spatial_pe\n\n return x\n\n\nclass STBlock(nnx.Module):\n def __init__(\n self,\n dim: int,\n ffn_dim: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n rngs: nnx.Rngs,\n sow_weights: bool,\n sow_activations: bool,\n ):\n self.dim = dim\n self.ffn_dim = ffn_dim\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.sow_weights = sow_weights\n self.sow_activations = sow_activations\n\n self.spatial_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.spatial_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.dim,\n qkv_features=self.dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=False\n ),\n rngs=rngs,\n decode=False,\n )\n\n self.temporal_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.temporal_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.dim,\n qkv_features=self.dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=False,\n )\n\n self.ffn_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.ffn_dense1 = nnx.Linear(\n in_features=self.dim,\n out_features=self.ffn_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.ffn_dense2 = nnx.Linear(\n in_features=self.ffn_dim,\n out_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n @nnx.remat\n def __call__(self, x_BTNM: jax.Array) -> jax.Array:\n # --- Spatial attention ---\n z_BTNM = self.spatial_norm(x_BTNM)\n z_BTNM = self.spatial_attention(z_BTNM, sow_weights=self.sow_weights)\n x_BTNM = x_BTNM + z_BTNM\n\n # --- Temporal attention ---\n x_BNTM = x_BTNM.swapaxes(1, 2)\n z_BNTM = self.temporal_norm(x_BNTM)\n z_BNTM = self.temporal_attention(z_BNTM, sow_weights=self.sow_weights)\n x_BNTM = x_BNTM + z_BNTM\n x_BTNM = x_BNTM.swapaxes(1, 2)\n\n # --- Feedforward ---\n z_BTNM = self.ffn_norm(x_BTNM)\n z_BTND = self.ffn_dense1(z_BTNM)\n z_BTND = jax.nn.gelu(z_BTND)\n z_BTNM = self.ffn_dense2(z_BTND)\n x_BTNM = x_BTNM + z_BTNM\n if self.sow_activations:\n self.sow(nnx.Intermediate, ""activations"", x_BTNM)\n return x_BTNM\n\n\nclass STTransformer(nnx.Module):\n """"""\n Dimension keys:\n B: batch size\n T: number of frames\n N: number of patches per frame\n I: number of input features\n M: model dimension\n D: FFN dimension\n V: vocabulary size\n """"""\n\n def __init__(\n self,\n input_dim: int,\n model_dim: int,\n ffn_dim: int,\n out_dim: int,\n num_blocks: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n rngs: nnx.Rngs,\n sow_weights: bool = False,\n sow_activations: bool = False,\n sow_logits: bool = False,\n max_len: int = 5000,\n ):\n self.input_dim = input_dim\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.out_dim = out_dim\n self.num_blocks = num_blocks\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.sow_logits = sow_logits\n self.sow_weights = sow_weights\n self.sow_activations = sow_activations\n\n self.input_norm1 = nnx.LayerNorm(\n num_features=self.input_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.input_dense = nnx.Linear(\n in_features=self.input_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.input_norm2 = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n\n self.pos_enc = SpatioTemporalPositionalEncoding(self.model_dim, max_len=max_len)\n\n self.blocks = []\n for _ in range(self.num_blocks):\n self.blocks.append(\n STBlock(\n dim=self.model_dim,\n ffn_dim=self.ffn_dim,\n num_heads=self.num_heads,\n dropout=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=rngs,\n sow_weights=self.sow_weights,\n sow_activations=self.sow_activations,\n )\n )\n\n self.output_dense = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.out_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n def __call__(self, x_BTNI: jax.Array) -> jax.Array:\n x_BTNI = self.input_norm1(x_BTNI)\n x_BTNM = self.input_dense(x_BTNI)\n x_BTNM = self.input_norm2(x_BTNM)\n x_BTNM = self.pos_enc(x_BTNM)\n for block in self.blocks:\n x_BTNM = block(x_BTNM)\n\n x_BTNV = self.output_dense(x_BTNM)\n if self.sow_logits:\n self.sow(nnx.Intermediate, ""logits"", x_BTNV)\n return x_BTNV\n\n\nclass TransformerBlock(nnx.Module):\n def __init__(\n self,\n model_dim: int,\n ffn_dim: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n decode: bool,\n rngs: nnx.Rngs,\n sow_weights: bool,\n sow_activations: bool,\n ):\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.decode = decode\n self.sow_weights = sow_weights\n self.sow_activations = sow_activations\n\n self.temporal_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.spatial_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.ffn_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.temporal_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.model_dim,\n qkv_features=self.model_dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=self.decode,\n )\n self.spatial_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.model_dim,\n qkv_features=self.model_dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=self.decode,\n )\n self.ffn_dense1 = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.ffn_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.ffn_dense2 = nnx.Linear(\n in_features=self.ffn_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n @nnx.remat\n def __call__(\n self, x_BTNM: jax.Array, pos_index: Tuple[jax.Array, jax.Array] | None = None\n ) -> jax.Array:\n # --- Spatial attention ---\n B, T, N, M = x_BTNM.shape\n z_FNM = einops.rearrange(x_BTNM, ""b t n m -> (b t) n m"")\n z_FNM = self.spatial_norm(z_FNM)\n z_FNM = self.spatial_attention(z_FNM, sow_weights=self.sow_weights)\n z_BTNM = einops.rearrange(z_FNM, ""(b t) n m -> b t n m"", t=T)\n x_BTNM = x_BTNM + z_BTNM\n # --- Temporal attention ---\n z_PTM = einops.rearrange(x_BTNM, ""b t n m -> (b n) t m"")\n z_PTM = self.temporal_norm(z_PTM)\n z_PTM = self.temporal_attention(z_PTM, sow_weights=self.sow_weights)\n z_BTNM = einops.rearrange(z_PTM, ""(b n) t m -> b t n m"", n=N)\n x_BTNM = x_BTNM + z_BTNM\n # --- Feedforward ---\n z_BTNM = self.ffn_norm(x_BTNM)\n z_BTND = self.ffn_dense1(z_BTNM)\n z_BTND = jax.nn.gelu(z_BTND)\n z_BTNM = self.ffn_dense2(z_BTND)\n x_BTNM = x_BTNM + z_BTNM\n if self.sow_activations:\n self.sow(nnx.Intermediate, ""activations"", x_BTNM)\n\n return x_BTNM\n\n\nclass Transformer(nnx.Module):\n """"""\n Dimension keys:\n B: batch size\n T: number of frames\n N: number of patches per frame\n I: number of input features\n M: model dimension\n D: FFN dimension\n V: vocabulary size\n F: number of frames in batch\n P: number of patch positions in batch\n """"""\n\n def __init__(\n self,\n input_dim: int,\n model_dim: int,\n ffn_dim: int,\n out_dim: int,\n num_blocks: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n decode: bool,\n rngs: nnx.Rngs,\n sow_logits: bool = False,\n sow_weights: bool = False,\n sow_activations: bool = False,\n max_len: int = 5000,\n ):\n self.input_dim = input_dim\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.out_dim = out_dim\n self.num_blocks = num_blocks\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.sow_logits = sow_logits\n self.sow_weights = sow_weights\n self.sow_activations = sow_activations\n\n self.input_norm1 = nnx.LayerNorm(\n num_features=self.input_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.input_dense = nnx.Linear(\n in_features=self.input_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.input_norm2 = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n\n self.pos_enc = SpatioTemporalPositionalEncoding(self.model_dim, max_len=max_len)\n\n self.blocks: List[TransformerBlock] = []\n for _ in range(self.num_blocks):\n self.blocks.append(\n TransformerBlock(\n model_dim=self.model_dim,\n ffn_dim=self.ffn_dim,\n num_heads=self.num_heads,\n dropout=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n decode=decode,\n sow_weights=self.sow_weights,\n sow_activations=self.sow_activations,\n rngs=rngs,\n )\n )\n self.output_dense = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.out_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n def __call__(\n self, x_BTNI: jax.Array, pos_index: Tuple[jax.Array, jax.Array] | None = None\n ) -> jax.Array:\n x_BTNI = self.input_norm1(x_BTNI)\n x_BTNM = self.input_dense(x_BTNI)\n x_BTNM = self.input_norm2(x_BTNM)\n x_BTNM = self.pos_enc(x_BTNM)\n for block in self.blocks:\n x_BTNM = block(x_BTNM, pos_index)\n\n x_BTNV = self.output_dense(x_BTNM)\n if self.sow_logits:\n self.sow(nnx.Intermediate, ""logits"", x_BTNV)\n return x_BTNV\n\n\ndef normalize(x: jax.Array) -> jax.Array:\n return x / (jnp.linalg.norm(x, ord=2, axis=-1, keepdims=True) + 1e-8)\n\n\nclass VectorQuantizer(nnx.Module):\n """"""\n Dimension keys:\n D: B * T * N\n K: number of latents\n L: latent dimension\n """"""\n\n def __init__(\n self,\n latent_dim: int,\n num_latents: int,\n dropout: float,\n dtype: jnp.dtype,\n rngs: nnx.Rngs,\n ):\n self.latent_dim = latent_dim\n self.num_latents = num_latents\n self.dropout = dropout\n self.dtype = dtype\n\n self.codebook = nnx.Param(\n normalize(\n nnx.initializers.lecun_uniform()(\n rngs.params(), (self.num_latents, self.latent_dim)\n )\n )\n )\n self.drop = nnx.Dropout(self.dropout, rngs=rngs)\n\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_normalized_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_normalized_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D\n\n def get_codes(self, indices_E: jax.Array) -> jax.Array:\n return self.codebook[indices_E]\n\n\ndef _create_flash_attention_fn(use_flash_attention: bool, is_causal: bool) -> Callable:\n """"""\n Create an attention function that uses flash attention if enabled.\n\n flax.nnx.MultiHeadAttention provides tensors with shape (batch..., length, num_heads, head_dim),\n but jax.nn.dot_product_attention expects (batch, length, num_heads, head_dim). We reshape to\n ensure compatibility. cuDNN's flash attention additionally requires a sequence length that\n is a multiple of 4. We pad the sequence length to the nearest multiple of 4 and mask\n accordingly. Note that cuDNN requires the mask to be broadcast before calling the attention\n function due to strict shape checking.\n """"""\n\n def attention_fn(\n query_BTHD, key_BSHD, value_BSHD, bias=None, mask_B111=None, **kwargs\n ):\n implementation = ""cudnn"" if use_flash_attention else None\n\n def _merge_batch_dims(x):\n return einops.rearrange(x, ""... l h k -> (...) l h k"")\n\n def _pad(x, pad_size):\n return jnp.pad(x, ((0, 0), (0, pad_size), (0, 0), (0, 0)))\n\n original_shape = query_BTHD.shape\n T = query_BTHD.shape[-3]\n S = key_BSHD.shape[-3]\n\n # Pad to nearest multiple of 4\n Q = ((T + 3) // 4) * 4\n pad_size_Q = Q - T\n K = ((S + 3) // 4) * 4\n pad_size_K = K - S\n\n query_BQHD = _pad(_merge_batch_dims(query_BTHD), pad_size_Q)\n key_BKHD = _pad(_merge_batch_dims(key_BSHD), pad_size_K)\n value_BKHD = _pad(_merge_batch_dims(value_BSHD), pad_size_K)\n\n attention_mask = jnp.ones((Q, K), dtype=jnp.bool_)\n attention_mask = attention_mask.at[T:, :].set(False)\n attention_mask = attention_mask.at[:, S:].set(False)\n\n mask_11TS = attention_mask[jnp.newaxis, jnp.newaxis, :, :]\n\n bias_4d = (\n jnp.pad(\n _merge_batch_dims(bias),\n ((0, 0), (0, 0), (0, pad_size_Q), (0, pad_size_K)),\n )\n if bias is not None\n else None\n )\n\n # NOTE: jax.nn.dot_product_attention does not support dropout\n output_4d = jax.nn.dot_product_attention(\n query=query_BQHD,\n key=key_BKHD,\n value=value_BKHD,\n bias=bias_4d,\n mask=mask_11TS,\n implementation=implementation,\n is_causal=is_causal,\n )\n return output_4d[..., :T, :, :].reshape(original_shape)\n\n return attention_fn\n",python,tab
3
+ 2,175,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"6:17:06 PM [info] Activating crowd-code\n6:17:06 PM [info] Recording started\n6:17:06 PM [info] Initializing git provider using file system watchers...\n",Log,tab
4
+ 3,225,"extension-output-pdoom-org.crowd-code-#1-crowd-code",150,0,"6:17:06 PM [info] Git repository found\n6:17:06 PM [info] Git provider initialized successfully\n6:17:06 PM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,1021,"TERMINAL",0,0,"",,terminal_focus
6
+ 5,2112,"utils/nn.py",0,0,"",python,tab
7
+ 6,2162,"TERMINAL",0,0,"source /home/franz.srambical/jafar/.venv/bin/activate",,terminal_command
8
+ 7,20957,"TERMINAL",0,0,"scancel 28766",,terminal_command
9
+ 8,20966,"TERMINAL",0,0,"]633;C]0;franz.srambical@hai-login2:~/jafar",,terminal_output
10
+ 9,23514,"TERMINAL",0,0,"scancel 28767",,terminal_command
11
+ 10,23521,"TERMINAL",0,0,"]633;C]0;franz.srambical@hai-login2:~/jafar",,terminal_output
12
+ 11,26525,"TERMINAL",0,0,"squeue",,terminal_command
13
+ 12,26528,"TERMINAL",0,0,"]633;C JOBID USER PARTITION NODES CPUS ST SUBMIT_TIME START_TIME TIME TIME_LIMIT NODELIST(REASON)\r\n 28763 xiao.liu interacti 1 64 R 2025-09-07T09:34:46 2025-09-07T09:34:46 8:42:46 23:59:00 hai001\r\n 28762 xiao.liu interacti 1 64 R 2025-09-07T04:17:42 2025-09-07T04:17:42 13:59:50 23:59:00 hai003\r\n 28761 xiao.liu interacti 1 64 R 2025-09-07T04:17:36 2025-09-07T04:17:36 13:59:56 23:59:00 hai002\r\n 28767 franz.sram standard 1 16 CG 2025-09-07T16:48:17 2025-09-07T16:48:17 1:29:12 1-00:00:00 hai006\r\n 28766 franz.sram standard 1 16 CG 2025-09-07T16:46:08 2025-09-07T16:46:08 1:31:19 1-00:00:00 hai005\r\n 28765 franz.sram standard 1 16 R 2025-09-07T16:19:13 2025-09-07T16:19:13 1:58:19 1-00:00:00 hai004\r\n]0;franz.srambical@hai-login2:~/jafar",,terminal_output
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-01a8ecdc-729d-4ad7-9ea8-2c12971703011753434484022-2025_07_25-11.08.10.182/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-03ba0d47-b31c-4c6c-ac79-ac489ea685411761933076688-2025_10_31-18.51.24.953/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-0634b88a-747c-4356-abf7-e80a884442f51767715067534-2026_01_06-16.57.53.582/source.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 2,402,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"4:57:53 PM [info] Activating crowd-code\n4:57:53 PM [info] Recording started\n4:57:53 PM [info] Initializing git provider using file system watchers...\n4:57:53 PM [info] Git repository found\n4:57:53 PM [info] Git provider initialized successfully\n4:57:53 PM [info] Initial git state: [object Object]\n",Log,tab
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-0a104ef7-eb3a-4bff-84cc-f1eba2333f781767712241927-2026_01_06-16.10.55.632/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-0f7f1a2c-8092-4a29-81e5-3d0f406b88711751465682686-2025_07_02-16.15.28.930/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-10359e68-1b5b-4730-84bf-01e804b840591763052516161-2025_11_13-17.48.55.56/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-1038e164-bc79-4edf-bc8b-4394e2f9188d1765559214036-2025_12_12-18.07.02.978/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-103cfa3b-0cf6-479d-9d0f-3199e66c08ab1762947750775-2025_11_12-12.42.37.529/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-1134a6dd-0fdc-4082-97df-46605fc3467b1764867592018-2025_12_04-18.00.02.650/source.csv ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,212,"Untitled-1",0,0,"",plaintext,tab
3
+ 2,377,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"6:00:02 PM [info] Activating crowd-code\n6:00:02 PM [info] Recording started\n6:00:02 PM [info] Initializing git provider using file system watchers...\n6:00:02 PM [info] No workspace folder found\n",Log,tab
4
+ 3,1271,"Untitled-1",0,0,"",plaintext,tab
5
+ 4,6879,"Untitled-1",0,0,"""",plaintext,content
6
+ 5,6881,"Untitled-1",1,0,"",plaintext,selection_keyboard
7
+ 6,7021,"Untitled-1",1,0,"""",plaintext,content
8
+ 7,7022,"Untitled-1",2,0,"",plaintext,selection_keyboard
9
+ 8,7757,"Untitled-1",1,1,"",plaintext,content
10
+ 9,7915,"Untitled-1",0,1,"",plaintext,content
11
+ 10,19437,"Untitled-1",0,0,"""",plaintext,content
12
+ 11,19439,"Untitled-1",1,0,"",plaintext,selection_keyboard
13
+ 12,19551,"Untitled-1",1,0,"""",plaintext,content
14
+ 13,19552,"Untitled-1",2,0,"",plaintext,selection_keyboard
15
+ 14,19809,"Untitled-1",2,0,"""",plaintext,content
16
+ 15,19810,"Untitled-1",3,0,"",plaintext,selection_keyboard
17
+ 16,20485,"Untitled-1",3,0,"""",plaintext,content
18
+ 17,20486,"Untitled-1",4,0,"",plaintext,selection_keyboard
19
+ 18,20636,"Untitled-1",4,0,"""",plaintext,content
20
+ 19,20638,"Untitled-1",5,0,"",plaintext,selection_keyboard
21
+ 20,20815,"Untitled-1",5,0,"""",plaintext,content
22
+ 21,20817,"Untitled-1",6,0,"",plaintext,selection_keyboard
23
+ 22,21539,"Untitled-1",5,0,"",plaintext,selection_command
24
+ 23,21626,"Untitled-1",4,0,"",plaintext,selection_command
25
+ 24,21750,"Untitled-1",3,0,"",plaintext,selection_command
26
+ 25,28916,"Untitled-1",3,0,"h",plaintext,content
27
+ 26,28918,"Untitled-1",4,0,"",plaintext,selection_keyboard
28
+ 27,28958,"Untitled-1",4,0,"e",plaintext,content
29
+ 28,28960,"Untitled-1",5,0,"",plaintext,selection_keyboard
30
+ 29,29140,"Untitled-1",5,0,"l",plaintext,content
31
+ 30,29141,"Untitled-1",6,0,"",plaintext,selection_keyboard
32
+ 31,29279,"Untitled-1",6,0,"l",plaintext,content
33
+ 32,29281,"Untitled-1",7,0,"",plaintext,selection_keyboard
34
+ 33,29415,"Untitled-1",7,0,"o",plaintext,content
35
+ 34,29418,"Untitled-1",8,0,"",plaintext,selection_keyboard
36
+ 35,29682,"Untitled-1",8,0," ",plaintext,content
37
+ 36,29684,"Untitled-1",9,0,"",plaintext,selection_keyboard
38
+ 37,29703,"Untitled-1",9,0,"w",plaintext,content
39
+ 38,29704,"Untitled-1",10,0,"",plaintext,selection_keyboard
40
+ 39,29815,"Untitled-1",10,0,"o",plaintext,content
41
+ 40,29817,"Untitled-1",11,0,"",plaintext,selection_keyboard
42
+ 41,29886,"Untitled-1",11,0,"r",plaintext,content
43
+ 42,29887,"Untitled-1",12,0,"",plaintext,selection_keyboard
44
+ 43,30123,"Untitled-1",12,0,"l",plaintext,content
45
+ 44,30125,"Untitled-1",13,0,"",plaintext,selection_keyboard
46
+ 45,30186,"Untitled-1",13,0,"d",plaintext,content
47
+ 46,30189,"Untitled-1",14,0,"",plaintext,selection_keyboard
48
+ 47,30259,"Untitled-1",14,0," ",plaintext,content
49
+ 48,30261,"Untitled-1",15,0,"",plaintext,selection_keyboard
50
+ 49,30463,"Untitled-1",15,0,"f",plaintext,content
51
+ 50,30465,"Untitled-1",16,0,"",plaintext,selection_keyboard
52
+ 51,30498,"Untitled-1",16,0,"u",plaintext,content
53
+ 52,30500,"Untitled-1",17,0,"",plaintext,selection_keyboard
54
+ 53,30833,"Untitled-1",17,0,"n",plaintext,content
55
+ 54,30834,"Untitled-1",18,0,"",plaintext,selection_keyboard
56
+ 55,30836,"Untitled-1",18,0,"c",plaintext,content
57
+ 56,30837,"Untitled-1",19,0,"",plaintext,selection_keyboard
58
+ 57,30906,"Untitled-1",19,0,"t",plaintext,content
59
+ 58,30907,"Untitled-1",20,0,"",plaintext,selection_keyboard
60
+ 59,30974,"Untitled-1",20,0,"i",plaintext,content
61
+ 60,30975,"Untitled-1",21,0,"",plaintext,selection_keyboard
62
+ 61,31018,"Untitled-1",21,0,"o",plaintext,content
63
+ 62,31019,"Untitled-1",22,0,"",plaintext,selection_keyboard
64
+ 63,31112,"Untitled-1",22,0,"n",plaintext,content
65
+ 64,31113,"Untitled-1",23,0,"",plaintext,selection_keyboard
66
+ 65,32013,"Untitled-1",22,0,"",plaintext,selection_command
67
+ 66,32358,"Untitled-1",26,0,"\n",plaintext,content
68
+ 67,34720,"Untitled-1",27,0,"d",plaintext,content
69
+ 68,34722,"Untitled-1",28,0,"",plaintext,selection_keyboard
70
+ 69,34725,"Untitled-1",28,0,"e",plaintext,content
71
+ 70,34726,"Untitled-1",29,0,"",plaintext,selection_keyboard
72
+ 71,34840,"Untitled-1",29,0,"f",plaintext,content
73
+ 72,34842,"Untitled-1",30,0,"",plaintext,selection_keyboard
74
+ 73,34873,"Untitled-1",30,0," ",plaintext,content
75
+ 74,34874,"Untitled-1",31,0,"",plaintext,selection_keyboard
76
+ 75,36457,"Untitled-1",31,0,"h",plaintext,content
77
+ 76,36459,"Untitled-1",32,0,"",plaintext,selection_keyboard
78
+ 77,36569,"Untitled-1",32,0,"e",plaintext,content
79
+ 78,36570,"Untitled-1",33,0,"",plaintext,selection_keyboard
80
+ 79,36692,"Untitled-1",33,0,"l",plaintext,content
81
+ 80,36693,"Untitled-1",34,0,"",plaintext,selection_keyboard
82
+ 81,36826,"Untitled-1",34,0,"l",plaintext,content
83
+ 82,36827,"Untitled-1",35,0,"",plaintext,selection_keyboard
84
+ 83,37198,"Untitled-1",35,0,"_",plaintext,content
85
+ 84,37200,"Untitled-1",36,0,"",plaintext,selection_keyboard
86
+ 85,37591,"Untitled-1",36,0,"w",plaintext,content
87
+ 86,37593,"Untitled-1",37,0,"",plaintext,selection_keyboard
88
+ 87,37937,"Untitled-1",36,1,"",plaintext,content
89
+ 88,38082,"Untitled-1",35,1,"",plaintext,content
90
+ 89,38179,"Untitled-1",35,0,"o",plaintext,content
91
+ 90,38181,"Untitled-1",36,0,"",plaintext,selection_keyboard
92
+ 91,38562,"Untitled-1",36,0,"_",plaintext,content
93
+ 92,38564,"Untitled-1",37,0,"",plaintext,selection_keyboard
94
+ 93,39021,"Untitled-1",37,0,"w",plaintext,content
95
+ 94,39022,"Untitled-1",38,0,"",plaintext,selection_keyboard
96
+ 95,39139,"Untitled-1",38,0,"o",plaintext,content
97
+ 96,39141,"Untitled-1",39,0,"",plaintext,selection_keyboard
98
+ 97,39198,"Untitled-1",39,0,"r",plaintext,content
99
+ 98,39199,"Untitled-1",40,0,"",plaintext,selection_keyboard
100
+ 99,39399,"Untitled-1",40,0,"l",plaintext,content
101
+ 100,39401,"Untitled-1",41,0,"",plaintext,selection_keyboard
102
+ 101,39434,"Untitled-1",41,0,"d",plaintext,content
103
+ 102,39436,"Untitled-1",42,0,"",plaintext,selection_keyboard
104
+ 103,39696,"Untitled-1",42,0,"()",plaintext,content
105
+ 104,39698,"Untitled-1",43,0,"",plaintext,selection_keyboard
106
+ 105,39792,"Untitled-1",43,1,")",plaintext,content
107
+ 106,39794,"Untitled-1",44,0,"",plaintext,selection_keyboard
108
+ 107,40420,"Untitled-1",44,0,":",plaintext,content
109
+ 108,40422,"Untitled-1",45,0,"",plaintext,selection_keyboard
110
+ 109,40664,"Untitled-1",45,0,"\n",plaintext,content
111
+ 110,54214,"TERMINAL",0,0,"cat -n Untitled-1 | sed -n '1,3p'",,terminal_command
112
+ 111,54227,"TERMINAL",0,0,"]633;Ccat: Untitled-1: No such file or directory\r\n]0;franz.srambical@hai-login1:~",,terminal_output
113
+ 112,55197,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
114
+ 113,56845,"TERMINAL",0,0,"",,terminal_focus
115
+ 114,56847,"Untitled-1",0,0,"",plaintext,tab
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-146ef5d6-6a61-4524-a0b3-945e53eb2cf21759396751223-2025_10_02-11.19.16.424/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-14c33a6c-d06d-421b-aaef-66e0673e81a31753986093740-2025_07_31-20.21.52.136/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-176105a9-1ac4-42e7-95d3-723f8a10a1311758800956713-2025_09_25-13.49.25.76/source.csv ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,3,"data/jasmine_data/atari/generate_atari_dataset.py",0,0,"# adapted from https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/rainbow_atari.py\nimport einops\nimport collections\nimport math\nimport os\nimport random\nimport time\nfrom collections import deque\nfrom dataclasses import dataclass\n\nimport gymnasium as gym\nimport ale_py\nimport numpy as np\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.optim as optim\nimport tyro\nfrom typing import Optional, Any\nfrom torch.utils.tensorboard.writer import SummaryWriter\n\nfrom jasmine_data.atari.atari_utils import (\n ClipRewardEnv,\n EpisodicLifeEnv,\n FireResetEnv,\n MaxAndSkipEnv,\n NoopResetEnv,\n)\n\nfrom jasmine_data.utils import save_chunks\nimport json\n\n\n@dataclass\nclass Args:\n exp_name: str = os.path.basename(__file__)[: -len("".py"")]\n """"""the name of this experiment""""""\n seed: int = 1\n """"""seed of the experiment""""""\n torch_deterministic: bool = True\n """"""if toggled, `torch.backends.cudnn.deterministic=False`""""""\n cuda: bool = True\n """"""if toggled, cuda will be enabled by default""""""\n track: bool = False\n """"""if toggled, this experiment will be tracked with Weights and Biases""""""\n wandb_project_name: str = ""cleanRL""\n """"""the wandb's project name""""""\n wandb_entity: Optional[str] = None\n """"""the entity (team) of wandb's project""""""\n capture_video: bool = False\n """"""whether to capture videos of the agent performances (check out `videos` folder)""""""\n save_model: bool = False\n """"""whether to save model into the `runs/{run_name}` folder""""""\n upload_model: bool = False\n """"""whether to upload the saved model to huggingface""""""\n hf_entity: str = """"\n """"""the user or org name of the model repository from the Hugging Face Hub""""""\n\n env_id: str = ""ALE/Breakout-v5""\n """"""the id of the environment""""""\n total_timesteps: int = 10000000\n """"""total timesteps of the experiments""""""\n learning_rate: float = 0.0000625\n """"""the learning rate of the optimizer""""""\n num_envs: int = 1\n """"""the number of parallel game environments""""""\n buffer_size: int = 1000000\n """"""the replay memory buffer size""""""\n gamma: float = 0.99\n """"""the discount factor gamma""""""\n tau: float = 1.0\n """"""the target network update rate""""""\n target_network_frequency: int = 8000\n """"""the timesteps it takes to update the target network""""""\n batch_size: int = 32\n """"""the batch size of sample from the reply memory""""""\n start_e: float = 1\n """"""the starting epsilon for exploration""""""\n end_e: float = 0.01\n """"""the ending epsilon for exploration""""""\n exploration_fraction: float = 0.10\n """"""the fraction of `total-timesteps` it takes from start-e to go end-e""""""\n learning_starts: int = 80000\n """"""timestep to start learning""""""\n train_frequency: int = 4\n """"""the frequency of training""""""\n n_step: int = 3\n """"""the number of steps to look ahead for n-step Q learning""""""\n prioritized_replay_alpha: float = 0.5\n """"""alpha parameter for prioritized replay buffer""""""\n prioritized_replay_beta: float = 0.4\n """"""beta parameter for prioritized replay buffer""""""\n prioritized_replay_eps: float = 1e-6\n """"""epsilon parameter for prioritized replay buffer""""""\n n_atoms: int = 51\n """"""the number of atoms""""""\n v_min: float = -10\n """"""the return lower bound""""""\n v_max: float = 10\n """"""the return upper bound""""""\n\n # Dataset capture\n capture_dataset: bool = True\n num_episodes_train: int = 10000\n num_episodes_val: int = 500\n num_episodes_test: int = 500\n output_dir: str = ""data/atari_episodes""\n min_episode_length: int = 1\n chunk_size: int = 160\n chunks_per_file: int = 100\n stop_on_complete: bool = True\n\n\ndef make_env(env_id, seed, idx, capture_video, run_name):\n def thunk():\n if capture_video and idx == 0:\n env = gym.make(env_id, render_mode=""rgb_array"")\n env = gym.wrappers.RecordVideo(env, f""videos/{run_name}"")\n else:\n env = gym.make(env_id)\n env = gym.wrappers.RecordEpisodeStatistics(env)\n\n env = NoopResetEnv(env, noop_max=30)\n env = MaxAndSkipEnv(env, skip=4)\n env = EpisodicLifeEnv(env)\n if ""FIRE"" in env.unwrapped.get_action_meanings():\n env = FireResetEnv(env)\n env = ClipRewardEnv(env)\n env = gym.wrappers.ResizeObservation(env, (84, 84))\n env = gym.wrappers.GrayScaleObservation(env)\n env = gym.wrappers.FrameStack(env, 4)\n\n env.action_space.seed(seed)\n return env\n\n return thunk\n\n\nclass NoisyLinear(nn.Module):\n def __init__(self, in_features, out_features, std_init=0.5):\n super().__init__()\n self.in_features = in_features\n self.out_features = out_features\n self.std_init = std_init\n\n self.weight_mu = nn.Parameter(torch.FloatTensor(out_features, in_features))\n self.weight_sigma = nn.Parameter(torch.FloatTensor(out_features, in_features))\n self.register_buffer(\n ""weight_epsilon"", torch.FloatTensor(out_features, in_features)\n )\n self.bias_mu = nn.Parameter(torch.FloatTensor(out_features))\n self.bias_sigma = nn.Parameter(torch.FloatTensor(out_features))\n self.register_buffer(""bias_epsilon"", torch.FloatTensor(out_features))\n # factorized gaussian noise\n self.reset_parameters()\n self.reset_noise()\n\n def reset_parameters(self):\n mu_range = 1 / math.sqrt(self.in_features)\n self.weight_mu.data.uniform_(-mu_range, mu_range)\n self.weight_sigma.data.fill_(self.std_init / math.sqrt(self.in_features))\n self.bias_mu.data.uniform_(-mu_range, mu_range)\n self.bias_sigma.data.fill_(self.std_init / math.sqrt(self.out_features))\n\n def reset_noise(self):\n self.weight_epsilon.normal_()\n self.bias_epsilon.normal_()\n\n def forward(self, input):\n if self.training:\n weight = self.weight_mu + self.weight_sigma * self.weight_epsilon\n bias = self.bias_mu + self.bias_sigma * self.bias_epsilon\n else:\n weight = self.weight_mu\n bias = self.bias_mu\n return F.linear(input, weight, bias)\n\n\n# ALGO LOGIC: initialize agent here:\nclass NoisyDuelingDistributionalNetwork(nn.Module):\n def __init__(self, env, n_atoms, v_min, v_max):\n super().__init__()\n self.n_atoms = n_atoms\n self.v_min = v_min\n self.v_max = v_max\n self.delta_z = (v_max - v_min) / (n_atoms - 1)\n self.n_actions = env.single_action_space.n\n self.register_buffer(""support"", torch.linspace(v_min, v_max, n_atoms))\n\n self.network = nn.Sequential(\n nn.Conv2d(4, 32, 8, stride=4),\n nn.ReLU(),\n nn.Conv2d(32, 64, 4, stride=2),\n nn.ReLU(),\n nn.Conv2d(64, 64, 3, stride=1),\n nn.ReLU(),\n nn.Flatten(),\n )\n conv_output_size = 3136\n\n self.value_head = nn.Sequential(\n NoisyLinear(conv_output_size, 512), nn.ReLU(), NoisyLinear(512, n_atoms)\n )\n\n self.advantage_head = nn.Sequential(\n NoisyLinear(conv_output_size, 512),\n nn.ReLU(),\n NoisyLinear(512, n_atoms * self.n_actions),\n )\n\n def forward(self, x):\n h = self.network(x / 255.0)\n value = self.value_head(h).view(-1, 1, self.n_atoms)\n advantage = self.advantage_head(h).view(-1, self.n_actions, self.n_atoms)\n q_atoms = value + advantage - advantage.mean(dim=1, keepdim=True)\n q_dist = F.softmax(q_atoms, dim=2)\n return q_dist\n\n def reset_noise(self):\n for layer in self.value_head:\n if isinstance(layer, NoisyLinear):\n layer.reset_noise()\n for layer in self.advantage_head:\n if isinstance(layer, NoisyLinear):\n layer.reset_noise()\n\n\nPrioritizedBatch = collections.namedtuple(\n ""PrioritizedBatch"",\n [\n ""observations"",\n ""actions"",\n ""rewards"",\n ""next_observations"",\n ""dones"",\n ""indices"",\n ""weights"",\n ],\n)\n\n\n# adapted from: https://github.com/openai/baselines/blob/master/baselines/common/segment_tree.py\nclass SumSegmentTree:\n def __init__(self, capacity):\n self.capacity = capacity\n self.tree_size = 2 * capacity - 1\n self.tree = np.zeros(self.tree_size, dtype=np.float32)\n\n def _propagate(self, idx):\n parent = (idx - 1) // 2\n while parent >= 0:\n self.tree[parent] = self.tree[parent * 2 + 1] + self.tree[parent * 2 + 2]\n parent = (parent - 1) // 2\n\n def update(self, idx, value):\n tree_idx = idx + self.capacity - 1\n self.tree[tree_idx] = value\n self._propagate(tree_idx)\n\n def total(self):\n return self.tree[0]\n\n def retrieve(self, value):\n idx = 0\n while idx * 2 + 1 < self.tree_size:\n left = idx * 2 + 1\n right = left + 1\n if value <= self.tree[left]:\n idx = left\n else:\n value -= self.tree[left]\n idx = right\n return idx - (self.capacity - 1)\n\n\n# adapted from: https://github.com/openai/baselines/blob/master/baselines/common/segment_tree.py\nclass MinSegmentTree:\n def __init__(self, capacity):\n self.capacity = capacity\n self.tree_size = 2 * capacity - 1\n self.tree = np.full(self.tree_size, float(""inf""), dtype=np.float32)\n\n def _propagate(self, idx):\n parent = (idx - 1) // 2\n while parent >= 0:\n self.tree[parent] = np.minimum(\n self.tree[parent * 2 + 1], self.tree[parent * 2 + 2]\n )\n parent = (parent - 1) // 2\n\n def update(self, idx, value):\n tree_idx = idx + self.capacity - 1\n self.tree[tree_idx] = value\n self._propagate(tree_idx)\n\n def min(self):\n return self.tree[0]\n\n\nclass PrioritizedReplayBuffer:\n def __init__(\n self, capacity, obs_shape, device, n_step, gamma, alpha=0.6, beta=0.4, eps=1e-6\n ):\n self.capacity = capacity\n self.device = device\n self.n_step = n_step\n self.gamma = gamma\n self.alpha = alpha\n self.beta = beta\n self.eps = eps\n\n self.buffer_obs = np.zeros((capacity,) + obs_shape, dtype=np.uint8)\n self.buffer_next_obs = np.zeros((capacity,) + obs_shape, dtype=np.uint8)\n self.buffer_actions = np.zeros(capacity, dtype=np.int64)\n self.buffer_rewards = np.zeros(capacity, dtype=np.float32)\n self.buffer_dones = np.zeros(capacity, dtype=np.bool_)\n\n self.pos = 0\n self.size = 0\n self.max_priority = 1.0\n\n self.sum_tree = SumSegmentTree(capacity)\n self.min_tree = MinSegmentTree(capacity)\n\n # For n-step returns\n self.n_step_buffer = deque(maxlen=n_step)\n\n def _get_n_step_info(self):\n reward = 0.0\n next_obs = self.n_step_buffer[-1][3]\n done = self.n_step_buffer[-1][4]\n\n for i in range(len(self.n_step_buffer)):\n reward += self.gamma**i * self.n_step_buffer[i][2]\n if self.n_step_buffer[i][4]:\n next_obs = self.n_step_buffer[i][3]\n done = True\n break\n return reward, next_obs, done\n\n def add(self, obs, action, reward, next_obs, done):\n self.n_step_buffer.append((obs, action, reward, next_obs, done))\n\n if len(self.n_step_buffer) < self.n_step:\n return\n\n reward, next_obs, done = self._get_n_step_info()\n obs = self.n_step_buffer[0][0]\n action = self.n_step_buffer[0][1]\n\n idx = self.pos\n self.buffer_obs[idx] = obs\n self.buffer_next_obs[idx] = next_obs\n self.buffer_actions[idx] = action\n self.buffer_rewards[idx] = reward\n self.buffer_dones[idx] = done\n\n priority = self.max_priority**self.alpha\n self.sum_tree.update(idx, priority)\n self.min_tree.update(idx, priority)\n\n self.pos = (self.pos + 1) % self.capacity\n self.size = min(self.size + 1, self.capacity)\n\n if done:\n self.n_step_buffer.clear()\n\n def sample(self, batch_size):\n indices = []\n p_total = self.sum_tree.total()\n segment = p_total / batch_size\n\n for i in range(batch_size):\n a = segment * i\n b = segment * (i + 1)\n upperbound = np.random.uniform(a, b)\n idx = self.sum_tree.retrieve(upperbound)\n indices.append(idx)\n\n samples = {\n ""observations"": torch.from_numpy(self.buffer_obs[indices]).to(self.device),\n ""actions"": torch.from_numpy(self.buffer_actions[indices])\n .to(self.device)\n .unsqueeze(1),\n ""rewards"": torch.from_numpy(self.buffer_rewards[indices])\n .to(self.device)\n .unsqueeze(1),\n ""next_observations"": torch.from_numpy(self.buffer_next_obs[indices]).to(\n self.device\n ),\n ""dones"": torch.from_numpy(self.buffer_dones[indices])\n .to(self.device)\n .unsqueeze(1),\n }\n\n probs = np.array(\n [self.sum_tree.tree[idx + self.capacity - 1] for idx in indices]\n )\n weights = (self.size * probs / p_total) ** -self.beta\n weights = weights / weights.max()\n samples[""weights""] = torch.from_numpy(weights).to(self.device).unsqueeze(1)\n samples[""indices""] = indices\n\n return PrioritizedBatch(**samples)\n\n def update_priorities(self, indices, priorities):\n priorities = np.abs(priorities) + self.eps\n self.max_priority = max(self.max_priority, priorities.max())\n\n for idx, priority in zip(indices, priorities):\n priority = priority**self.alpha\n self.sum_tree.update(idx, priority)\n self.min_tree.update(idx, priority)\n\n\nif __name__ == ""__main__"":\n args = tyro.cli(Args)\n assert args.num_envs == 1, ""vectorized envs are not supported at the moment""\n gym.register_envs(ale_py)\n run_name = f""{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}""\n if args.track:\n import wandb\n\n wandb.init(\n project=args.wandb_project_name,\n entity=args.wandb_entity,\n sync_tensorboard=True,\n config=vars(args),\n name=run_name,\n monitor_gym=True,\n save_code=True,\n )\n writer = SummaryWriter(f""runs/{run_name}"")\n writer.add_text(\n ""hyperparameters"",\n ""|param|value|\n|-|-|\n%s""\n % (""\n"".join([f""|{key}|{value}|"" for key, value in vars(args).items()])),\n )\n\n # TRY NOT TO MODIFY: seeding\n random.seed(args.seed)\n np.random.seed(args.seed)\n torch.manual_seed(args.seed)\n torch.backends.cudnn.deterministic = args.torch_deterministic\n\n device = torch.device(""cuda"" if torch.cuda.is_available() and args.cuda else ""cpu"")\n\n # env setup\n envs = gym.vector.SyncVectorEnv(\n [\n make_env(args.env_id, args.seed + i, i, args.capture_video, run_name)\n for i in range(args.num_envs)\n ]\n )\n assert isinstance(\n envs.single_action_space, gym.spaces.Discrete\n ), ""only discrete action space is supported""\n\n q_network = NoisyDuelingDistributionalNetwork(\n envs, args.n_atoms, args.v_min, args.v_max\n ).to(device)\n optimizer = optim.Adam(q_network.parameters(), lr=args.learning_rate, eps=1.5e-4)\n target_network = NoisyDuelingDistributionalNetwork(\n envs, args.n_atoms, args.v_min, args.v_max\n ).to(device)\n target_network.load_state_dict(q_network.state_dict())\n\n rb = PrioritizedReplayBuffer(\n args.buffer_size,\n envs.single_observation_space.shape,\n device,\n args.n_step,\n args.gamma,\n args.prioritized_replay_alpha,\n args.prioritized_replay_beta,\n args.prioritized_replay_eps,\n )\n\n # dataset capture state\n split_targets = {\n ""train"": args.num_episodes_train,\n ""val"": args.num_episodes_val,\n ""test"": args.num_episodes_test,\n }\n # Determine splits to run (order: train -> val -> test)\n splits_in_order = [s for s in [""train"", ""val"", ""test""] if split_targets[s] > 0]\n\n episodes_captured_per_split: dict[str, int] = {\n s: 0 for s in [""train"", ""val"", ""test""]\n }\n file_idx_by_split: dict[str, int] = {s: 0 for s in [""train"", ""val"", ""test""]}\n episode_metadata_by_split: dict[str, list[dict]] = {\n s: [] for s in [""train"", ""val"", ""test""]\n }\n\n obs_chunks: list[np.ndarray] = []\n act_chunks: list[np.ndarray] = []\n\n current_split_idx = 0\n current_split = splits_in_order[0]\n split_dir = os.path.join(args.output_dir, current_split)\n if args.capture_dataset:\n os.makedirs(split_dir, exist_ok=True)\n\n start_time = time.time()\n\n # TRY NOT TO MODIFY: start the game\n obs, _ = envs.reset(seed=args.seed)\n observations_seq: list[np.ndarray] = []\n actions_seq: list[np.ndarray] = []\n for global_step in range(args.total_timesteps):\n # anneal PER beta to 1\n rb.beta = min(\n 1.0,\n args.prioritized_replay_beta\n + global_step * (1.0 - args.prioritized_replay_beta) / args.total_timesteps,\n )\n\n # ALGO LOGIC: put action logic here\n with torch.no_grad():\n q_dist = q_network(torch.Tensor(obs).to(device))\n q_values = torch.sum(q_dist * q_network.support, dim=2)\n actions = torch.argmax(q_values, dim=1).cpu().numpy()\n\n # TRY NOT TO MODIFY: execute the game and log data.\n next_obs, rewards, terminations, truncations, infos = envs.step(actions)\n\n if args.capture_dataset:\n assert (\n obs.shape[0] == 1 and actions.shape[0] == 1\n ), ""Vectorized envs are currently not supported during data capture.""\n obs_to_save = obs # (1, F, H, W)\n actions_to_save = actions # (1,)\n\n # remove frame-stacking\n obs_to_save = obs_to_save[:, -1, :, :] # (1, H, W)\n\n # remove asserted singleton vectorization dimension\n obs_to_save = einops.rearrange(obs_to_save, ""1 H W -> H W"") # (H, W)\n actions_to_save = einops.rearrange(actions_to_save, ""1 ->"") # ()\n observations_seq.append(obs_to_save.astype(np.uint8))\n actions_seq.append(actions_to_save.astype(np.int8))\n\n if ""final_info"" in infos:\n for info in infos[""final_info""]:\n if info and ""episode"" in info:\n print(\n f""global_step={global_step}, episodic_return={info['episode']['r']}""\n )\n writer.add_scalar(\n ""charts/episodic_return"", info[""episode""][""r""], global_step\n )\n writer.add_scalar(\n ""charts/episodic_length"", info[""episode""][""l""], global_step\n )\n\n continue_capturing_multi = any(\n episodes_captured_per_split[s] < split_targets[s]\n for s in splits_in_order\n )\n if args.capture_dataset and continue_capturing_multi:\n current_len = len(observations_seq)\n if current_len >= args.min_episode_length:\n frames = np.stack(observations_seq, axis=0).astype(\n np.uint8\n ) # (T, H, W)\n acts = np.stack(actions_seq, axis=0).astype(np.int8)\n # Convert frames to three-channel RGB by repeating grayscale values\n frames = np.stack(\n [frames, frames, frames], axis=-1\n ) # (T, H, W, 3)\n\n episode_obs_chunks = []\n episode_act_chunks = []\n start_idx = 0\n while start_idx < current_len:\n end_idx = min(start_idx + args.chunk_size, current_len)\n if end_idx - start_idx < args.chunk_size:\n print(\n f""Warning: Inconsistent chunk_sizes. Episode has {current_len} frames, ""\n f""which is smaller than the requested chunk_size: {args.chunk_size}. ""\n ""This might lead to performance degradation during training.""\n )\n episode_obs_chunks.append(frames[start_idx:end_idx])\n episode_act_chunks.append(acts[start_idx:end_idx])\n start_idx = end_idx\n\n obs_chunks_data = [\n seq.astype(np.uint8) for seq in episode_obs_chunks\n ]\n act_chunks_data = [act for act in episode_act_chunks]\n obs_chunks.extend(obs_chunks_data)\n act_chunks.extend(act_chunks_data)\n\n # Save to the active split\n (\n ep_metadata,\n file_idx_by_split[current_split],\n obs_chunks,\n act_chunks,\n ) = save_chunks(\n file_idx_by_split[current_split],\n args.chunks_per_file,\n split_dir,\n obs_chunks,\n act_chunks,\n )\n episode_metadata_by_split[current_split].extend(ep_metadata)\n\n episodes_captured_per_split[current_split] += 1\n\n if (\n episodes_captured_per_split[current_split]\n >= split_targets[current_split]\n ):\n if len(obs_chunks) > 0:\n print(\n f""Warning: Dropping {len(obs_chunks)} chunks before switching split '"",\n {current_split},\n ""' for consistent number of chunks per file."",\n ""Consider changing the chunk_size and chunks_per_file parameters to prevent data-loss."",\n )\n obs_chunks = []\n act_chunks = []\n if current_split_idx + 1 < len(splits_in_order):\n current_split_idx += 1\n current_split = splits_in_order[current_split_idx]\n split_dir = os.path.join(\n args.output_dir, current_split\n )\n os.makedirs(split_dir, exist_ok=True)\n else:\n print(\n f""Episode too short ({current_len}), skipping capture...""\n )\n\n observations_seq = []\n actions_seq = []\n\n # TRY NOT TO MODIFY: save data to reply buffer; handle `final_observation`\n real_next_obs = next_obs.copy()\n for idx, trunc in enumerate(truncations):\n if trunc:\n real_next_obs[idx] = infos[""final_observation""][idx]\n rb.add(obs, actions, rewards, real_next_obs, terminations)\n\n # TRY NOT TO MODIFY: CRUCIAL step easy to overlook\n obs = next_obs\n\n # ALGO LOGIC: training.\n if global_step > args.learning_starts:\n if global_step % args.train_frequency == 0:\n # reset the noise for both networks\n q_network.reset_noise()\n target_network.reset_noise()\n data = rb.sample(args.batch_size)\n\n with torch.no_grad():\n next_dist = target_network(\n data.next_observations\n ) # [B, num_actions, n_atoms]\n support = target_network.support # [n_atoms]\n next_q_values = torch.sum(\n next_dist * support, dim=2\n ) # [B, num_actions]\n\n # double q-learning\n next_dist_online = q_network(\n data.next_observations\n ) # [B, num_actions, n_atoms]\n next_q_online = torch.sum(\n next_dist_online * support, dim=2\n ) # [B, num_actions]\n best_actions = torch.argmax(next_q_online, dim=1) # [B]\n next_pmfs = next_dist[\n torch.arange(args.batch_size), best_actions\n ] # [B, n_atoms]\n\n # compute the n-step Bellman update.\n gamma_n = args.gamma**args.n_step\n next_atoms = data.rewards + gamma_n * support * (\n 1 - data.dones.float()\n )\n tz = next_atoms.clamp(q_network.v_min, q_network.v_max)\n\n # projection\n delta_z = q_network.delta_z\n b = (tz - q_network.v_min) / delta_z # shape: [B, n_atoms]\n l = b.floor().clamp(0, args.n_atoms - 1)\n u = b.ceil().clamp(0, args.n_atoms - 1)\n\n # (l == u).float() handles the case where bj is exactly an integer\n # example bj = 1, then the upper ceiling should be uj= 2, and lj= 1\n d_m_l = (\n u.float() + (l == b).float() - b\n ) * next_pmfs # [B, n_atoms]\n d_m_u = (b - l) * next_pmfs # [B, n_atoms]\n\n target_pmfs = torch.zeros_like(next_pmfs)\n for i in range(target_pmfs.size(0)):\n target_pmfs[i].index_add_(0, l[i].long(), d_m_l[i])\n target_pmfs[i].index_add_(0, u[i].long(), d_m_u[i])\n\n dist = q_network(data.observations) # [B, num_actions, n_atoms]\n pred_dist = dist.gather(\n 1, data.actions.unsqueeze(-1).expand(-1, -1, args.n_atoms)\n ).squeeze(1)\n log_pred = torch.log(pred_dist.clamp(min=1e-5, max=1 - 1e-5))\n\n loss_per_sample = -(target_pmfs * log_pred).sum(dim=1)\n loss = (loss_per_sample * data.weights.squeeze()).mean()\n\n # update priorities\n new_priorities = loss_per_sample.detach().cpu().numpy()\n rb.update_priorities(data.indices, new_priorities)\n\n if global_step % 100 == 0:\n writer.add_scalar(""losses/td_loss"", loss.item(), global_step)\n q_values = (pred_dist * q_network.support).sum(dim=1) # [B]\n writer.add_scalar(\n ""losses/q_values"", q_values.mean().item(), global_step\n )\n sps = int(global_step / (time.time() - start_time))\n print(""SPS:"", sps)\n writer.add_scalar(""charts/SPS"", sps, global_step)\n writer.add_scalar(""charts/beta"", rb.beta, global_step)\n\n # optimize the model\n optimizer.zero_grad()\n loss.backward()\n optimizer.step()\n\n # update target network\n if global_step % args.target_network_frequency == 0:\n for target_param, param in zip(\n target_network.parameters(), q_network.parameters()\n ):\n target_param.data.copy_(\n args.tau * param.data + (1.0 - args.tau) * target_param.data\n )\n\n # optional early stop on dataset completion\n if args.capture_dataset and args.stop_on_complete:\n all_done = (\n all(\n episodes_captured_per_split[s] >= split_targets[s]\n for s in splits_in_order\n )\n and len(splits_in_order) > 0\n )\n if all_done:\n break\n\n envs.close()\n writer.close()\n\n # write metadata for dataset\n if args.capture_dataset:\n if len(obs_chunks) > 0:\n print(\n f""Warning: Dropping {len(obs_chunks)} chunks for consistent number of chunks per file."",\n ""Consider changing the chunk_size and chunks_per_file parameters to prevent data-loss."",\n )\n\n os.makedirs(args.output_dir, exist_ok=True)\n metadata_path = os.path.join(args.output_dir, ""metadata.json"")\n if os.path.exists(metadata_path):\n try:\n with open(metadata_path, ""r"") as f:\n metadata = json.load(f)\n except Exception:\n metadata = {}\n else:\n metadata = {}\n\n metadata.setdefault(""env"", args.env_id)\n metadata.setdefault(""num_actions"", int(envs.single_action_space.n))\n for split in [""train"", ""val"", ""test""]:\n metadata.setdefault(f""num_episodes_{split}"", 0)\n metadata.setdefault(f""avg_episode_len_{split}"", 0.0)\n metadata.setdefault(f""episode_metadata_{split}"", [])\n\n for split_key in splits_in_order:\n ep_meta_list = episode_metadata_by_split[split_key]\n if ep_meta_list:\n metadata[f""episode_metadata_{split_key}""].extend(ep_meta_list)\n metadata[f""num_episodes_{split_key}""] = len(\n metadata[f""episode_metadata_{split_key}""]\n )\n metadata[f""avg_episode_len_{split_key}""] = float(\n np.mean(\n [\n ep[""avg_seq_len""]\n for ep in metadata[f""episode_metadata_{split_key}""]\n ]\n )\n )\n\n with open(metadata_path, ""w"") as f:\n json.dump(metadata, f)\n",python,tab
3
+ 2,139,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"1:49:25 PM [info] Activating crowd-code\n1:49:25 PM [info] Recording started\n1:49:25 PM [info] Initializing git provider using file system watchers...\n",Log,tab
4
+ 3,182,"extension-output-pdoom-org.crowd-code-#1-crowd-code",150,0,"1:49:25 PM [info] Git repository found\n1:49:25 PM [info] Git provider initialized successfully\n1:49:25 PM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,3374,"TERMINAL",0,0,"",,terminal_command
6
+ 5,10396,"TERMINAL",0,0,"",,terminal_command
7
+ 6,27654,"data/jasmine_data/atari/generate_atari_dataset.py",0,0,"",python,tab
8
+ 7,118010,"TERMINAL",0,0,"",,terminal_command
9
+ 8,322395,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
10
+ 9,326546,"data/jasmine_data/atari/generate_atari_dataset.py",0,0,"",python,tab
11
+ 10,334429,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",0,0,"""""""\nGenerates a dataset of random-action CoinRun episodes.\nEpisodes are saved individually as memory-mapped files for efficient loading.\n""""""\n\nfrom dataclasses import dataclass\n\nfrom gym3 import types_np\nimport numpy as np\nfrom procgen import ProcgenGym3Env\nimport tyro\nimport json\nimport os\nfrom jasmine_data.utils import save_chunks\n\n\n@dataclass\nclass Args:\n num_episodes_train: int = 10000\n num_episodes_val: int = 500\n num_episodes_test: int = 500\n output_dir: str = ""data/coinrun_episodes""\n min_episode_length: int = 1000\n max_episode_length: int = 1000\n chunk_size: int = 160\n chunks_per_file: int = 100\n seed: int = 0\n\n\nargs = tyro.cli(Args)\nassert (\n args.max_episode_length >= args.min_episode_length\n), ""Maximum episode length must be greater than or equal to minimum episode length.""\n\nif args.min_episode_length < args.chunk_size:\n print(\n ""Warning: Minimum episode length is smaller than chunk size. Note that episodes shorter than the chunk size will be discarded.""\n )\n\n\n# --- Generate episodes ---\ndef generate_episodes(num_episodes, split):\n episode_idx = 0\n episode_metadata = []\n obs_chunks = []\n act_chunks = []\n file_idx = 0\n output_dir_split = os.path.join(args.output_dir, split)\n while episode_idx < num_episodes:\n seed = np.random.randint(0, 10000)\n env = ProcgenGym3Env(num=1, env_name=""coinrun"", start_level=seed)\n\n observations_seq = []\n actions_seq = []\n episode_obs_chunks = []\n episode_act_chunks = []\n\n # --- Run episode ---\n step_t = 0\n first_obs = True\n for step_t in range(args.max_episode_length):\n _, obs, first = env.observe()\n action = types_np.sample(env.ac_space, bshape=(env.num,))\n env.act(action)\n observations_seq.append(obs[""rgb""])\n actions_seq.append(action)\n if len(observations_seq) == args.chunk_size:\n episode_obs_chunks.append(observations_seq)\n episode_act_chunks.append(actions_seq)\n observations_seq = []\n actions_seq = []\n if first and not first_obs:\n break\n first_obs = False\n\n # --- Save episode ---\n if step_t + 1 >= args.min_episode_length:\n if observations_seq:\n if len(observations_seq) < args.chunk_size:\n print(\n f""Warning: Inconsistent chunk_sizes. Episode has {len(observations_seq)} frames, ""\n f""which is smaller than the requested chunk_size: {args.chunk_size}. ""\n ""This might lead to performance degradation during training.""\n )\n episode_obs_chunks.append(observations_seq)\n episode_act_chunks.append(actions_seq)\n\n obs_chunks_data = [\n np.concatenate(seq, axis=0).astype(np.uint8)\n for seq in episode_obs_chunks\n ]\n act_chunks_data = [\n np.concatenate(act, axis=0) for act in episode_act_chunks\n ]\n obs_chunks.extend(obs_chunks_data)\n act_chunks.extend(act_chunks_data)\n\n ep_metadata, file_idx, obs_chunks, act_chunks = save_chunks(\n file_idx, args.chunks_per_file, output_dir_split, obs_chunks, act_chunks\n )\n episode_metadata.extend(ep_metadata)\n\n print(f""Episode {episode_idx} completed, length: {step_t + 1}."")\n episode_idx += 1\n else:\n print(f""Episode too short ({step_t + 1}), resampling..."")\n\n if len(obs_chunks) > 0:\n print(\n f""Warning: Dropping {len(obs_chunks)} chunks for consistent number of chunks per file."",\n ""Consider changing the chunk_size and chunks_per_file parameters to prevent data-loss."",\n )\n\n print(f""Done generating {split} split"")\n return episode_metadata\n\n\ndef get_action_space():\n env = ProcgenGym3Env(num=1, env_name=""coinrun"", start_level=0)\n return env.ac_space.eltype.n\n\n\ndef main():\n # Set random seed and create dataset directories\n np.random.seed(args.seed)\n # --- Generate episodes ---\n train_episode_metadata = generate_episodes(args.num_episodes_train, ""train"")\n val_episode_metadata = generate_episodes(args.num_episodes_val, ""val"")\n test_episode_metadata = generate_episodes(args.num_episodes_test, ""test"")\n\n # --- Save metadata ---\n metadata = {\n ""env"": ""coinrun"",\n ""num_actions"": get_action_space(),\n ""num_episodes_train"": args.num_episodes_train,\n ""num_episodes_val"": args.num_episodes_val,\n ""num_episodes_test"": args.num_episodes_test,\n ""avg_episode_len_train"": np.mean(\n [ep[""avg_seq_len""] for ep in train_episode_metadata]\n ),\n ""avg_episode_len_val"": np.mean(\n [ep[""avg_seq_len""] for ep in val_episode_metadata]\n ),\n ""avg_episode_len_test"": np.mean(\n [ep[""avg_seq_len""] for ep in test_episode_metadata]\n ),\n ""episode_metadata_train"": train_episode_metadata,\n ""episode_metadata_val"": val_episode_metadata,\n ""episode_metadata_test"": test_episode_metadata,\n }\n with open(os.path.join(args.output_dir, ""metadata.json""), ""w"") as f:\n json.dump(metadata, f)\n\n print(f""Done generating dataset."")\n\n\nif __name__ == ""__main__"":\n main()\n",python,tab
12
+ 11,343610,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",3407,0,"",python,selection_keyboard
13
+ 12,343826,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1350,0,"",python,selection_keyboard
14
+ 13,344654,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",3407,0,"",python,selection_keyboard
15
+ 14,349008,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",5261,0,"",python,selection_keyboard
16
+ 15,360796,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",3407,0,"",python,selection_keyboard
17
+ 16,360965,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1350,0,"",python,selection_keyboard
18
+ 17,361129,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",3,0,"",python,selection_keyboard
19
+ 18,361281,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",0,0,"",python,selection_keyboard
20
+ 19,366217,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1350,0,"",python,selection_keyboard
21
+ 20,366631,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",3,0,"",python,selection_keyboard
22
+ 21,366791,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",0,0,"",python,selection_keyboard
23
+ 22,375856,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",412,0,"",python,selection_command
24
+ 23,376682,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4308,0,"",python,selection_command
25
+ 24,376814,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4327,0,"",python,selection_command
26
+ 25,377701,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",0,0,"",python,selection_command
27
+ 26,379204,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",412,0,"",python,selection_command
28
+ 27,380633,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4354,0,"",python,selection_command
29
+ 28,382224,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4353,0,"",python,selection_command
30
+ 29,382341,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4349,0,"",python,selection_command
31
+ 30,382496,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4348,0,"",python,selection_command
32
+ 31,382851,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4331,0,"",python,selection_command
33
+ 32,383204,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1058,0,"",python,selection_command
34
+ 33,385697,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1102,0,"",python,selection_command
35
+ 34,385743,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1122,0,"",python,selection_command
36
+ 35,386002,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1148,0,"",python,selection_command
37
+ 36,386043,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1168,0,"",python,selection_command
38
+ 37,386060,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1188,0,"",python,selection_command
39
+ 38,386093,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1205,0,"",python,selection_command
40
+ 39,386483,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",1265,0,"",python,selection_command
41
+ 40,389833,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4331,0,"",python,selection_command
42
+ 41,397099,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4348,0,"",python,selection_command
43
+ 42,397270,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4349,0,"",python,selection_command
44
+ 43,397432,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4353,0,"",python,selection_command
45
+ 44,397619,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",4354,0,"",python,selection_command
46
+ 45,398075,"data/jasmine_data/coinrun/generate_coinrun_dataset.py",399,0,"",python,selection_command
47
+ 46,445375,"data/jasmine_data/atari/generate_atari_dataset.py",0,0,"",python,tab
48
+ 47,450575,"data/jasmine_data/atari/visualize_array_record.py",0,0,"import os\nimport math\nimport argparse\nimport pickle\nimport grain\nfrom typing import Optional, List\n\nimport numpy as np\n\nfrom PIL import Image, ImageDraw\n\n\ndef infer_hw_from_bytes(total_elements: int, seq_len: int, channels: int) -> tuple[int, int]:\n assert seq_len > 0 and channels > 0, ""sequence_length and channels must be positive""\n base = total_elements // (seq_len * channels)\n side = int(math.isqrt(base))\n if side * side != base:\n raise ValueError(\n f""Could not infer square HxW from buffer. elements={total_elements}, seq_len={seq_len}, channels={channels}""\n )\n return side, side\n\n\ndef load_one_sequence_via_grain(\n data_dir: str,\n seq_len: int,\n image_h: int,\n image_w: int,\n image_c: int,\n seed: Optional[int] = None,\n) -> dict:\n array_record_files = [\n os.path.join(data_dir, x)\n for x in os.listdir(data_dir)\n if x.endswith("".array_record"")\n ]\n if not array_record_files:\n raise RuntimeError(f""No .array_record files found in {data_dir}"")\n\n dataloader = get_dataloader(\n array_record_files,\n seq_len,\n 1, # global batch size 1 for visualization\n image_h,\n image_w,\n image_c,\n num_workers=1,\n prefetch_buffer_size=1,\n seed=0 if seed is None else int(seed),\n )\n\n state = dataloader._create_initial_state()\n it = grain.DataLoaderIterator(dataloader, state)\n batch = next(it)\n videos = np.asarray(batch[""videos""][0]) # (T,H,W,C) uint8\n actions = None\n if ""actions"" in batch:\n actions = np.asarray(batch[""actions""][0]).reshape(-1)\n\n return {""videos"": videos, ""actions"": actions, ""sequence_length"": int(videos.shape[0])}\n\n\ndef get_action_meanings(env_id: Optional[str]) -> Optional[List[str]]:\n if env_id is None:\n return None\n try:\n import gymnasium as gym\n import ale_py # noqa: F401\n\n gym.register_envs(ale_py) # ensure Atari envs are registered\n env = gym.make(env_id)\n try:\n meanings = list(env.unwrapped.get_action_meanings()) # type: ignore[attr-defined]\n finally:\n env.close()\n return meanings\n except Exception:\n return None\n\n\ndef save_frames_with_actions(\n record: dict,\n output_dir: str,\n channels: int,\n height: Optional[int],\n width: Optional[int],\n action_meanings: Optional[List[str]],\n fps: int,\n) -> None:\n os.makedirs(output_dir, exist_ok=True)\n\n actions: Optional[np.ndarray] = record.get(""actions"")\n if actions is not None:\n actions = np.asarray(actions).reshape(-1)\n\n seq_len = int(record[""sequence_length""])\n raw_video: bytes = record[""raw_video""]\n arr = np.frombuffer(raw_video, dtype=np.uint8)\n total_elements = arr.size\n if height is not None and width is not None:\n h, w = int(height), int(width)\n expected = seq_len * h * w * channels\n assert expected == total_elements, f""Expected {expected} elements, got {total_elements}""\n else:\n h, w = infer_hw_from_bytes(total_elements, seq_len, channels)\n frames = arr.reshape(seq_len, h, w, channels)\n\n if actions is not None:\n assert actions.shape[0] == seq_len, f""Expected {seq_len} actions, got {actions.shape[0]}""\n\n # Save an actions.txt index for quick inspection\n if actions is not None:\n with open(os.path.join(output_dir, ""actions.txt""), ""w"") as f:\n for t in range(seq_len):\n a = int(actions[t])\n name = (\n action_meanings[a]\n if action_meanings is not None and 0 <= a < len(action_meanings)\n else None\n )\n f.write(f""{t}\t{a}"" + (f""\t{name}"" if name is not None else """") + ""\n"")\n\n # Build frames with overlays and save as GIF\n duration_ms = max(1, int(1000 / max(1, fps)))\n imgs: List[Image.Image] = []\n for t in range(seq_len):\n # frames is (T, H, W, C) so we can use it directly for RGB\n img_np_rgb = frames[t]\n img = Image.fromarray(img_np_rgb, mode=""RGB"")\n draw = ImageDraw.Draw(img)\n if actions is not None:\n a = int(actions[t])\n name = (\n action_meanings[a]\n if action_meanings is not None and 0 <= a < len(action_meanings)\n else None\n )\n text = f""{a}"" if name is None else f""{a} {name}""\n else:\n text = ""?""\n draw.text((2, 2), text, fill=(255, 255, 255))\n imgs.append(img)\n\n if not imgs:\n raise RuntimeError(""No frames to render."")\n\n os.makedirs(output_dir, exist_ok=True)\n gif_path = os.path.join(output_dir, ""sequence.gif"")\n\n imgs[0].save(\n gif_path,\n save_all=True,\n append_images=imgs[1:],\n duration=duration_ms,\n loop=0,\n )\n\n print(f""Saved GIF to {gif_path} with {seq_len} frames (H={h}, W={w}, C={channels}, fps={fps})."")\n\n\nclass EpisodeLengthFilter(grain.transforms.Filter):\n """"""\n A Grain Filter that keeps only episodes with sufficient length.\n """"""\n\n def __init__(self, seq_len: int, image_h: int, image_w: int, image_c: int):\n """"""Initializes the filter with sequence length requirements.""""""\n self.seq_len = seq_len\n self.image_h = image_h\n self.image_w = image_w\n self.image_c = image_c\n\n def filter(self, element: Any) -> bool:\n """"""\n Filters episodes based on length.\n\n Args:\n element: A dictionary representing one record from the DataSource.\n Expected to contain 'raw_video' (bytes) and 'sequence_length' (int)\n\n Returns:\n True if the episode has sufficient length, False otherwise.\n """"""\n assert isinstance(element, bytes)\n element = pickle.loads(element)\n\n current_episode_len = element[""sequence_length""]\n if current_episode_len < self.seq_len:\n print(\n f""Filtering out episode with length {current_episode_len}, which is ""\n f""shorter than the requested sequence length {self.seq_len}.""\n )\n return False\n\n return True\n\n\nclass ProcessEpisodeAndSlice(grain.transforms.RandomMap):\n """"""\n A Grain Transformation that combines parsing, slicing, and normalizing.\n """"""\n\n def __init__(self, seq_len: int, image_h: int, image_w: int, image_c: int):\n """"""Initializes the transformation with processing parameters.""""""\n self.seq_len = seq_len\n self.image_h = image_h\n self.image_w = image_w\n self.image_c = image_c\n\n def random_map(self, element: dict, rng: np.random.Generator) -> Any:\n """"""\n Processes a single raw episode from the data source.\n\n Args:\n element: A dictionary representing one record from the DataSource.\n Expected to contain 'raw_video' (bytes) and 'sequence_length' (int)\n rng: A per-record random number generator provided by the Grain sampler.\n\n Returns:\n A processed video sequence as a NumPy array with shape\n (seq_len, height, width, channels) and dtype float32.\n """"""\n assert isinstance(element, bytes)\n element = pickle.loads(element)\n\n video_shape = (\n element[""sequence_length""],\n self.image_h,\n self.image_w,\n self.image_c,\n )\n episode_tensor = np.frombuffer(element[""raw_video""], dtype=np.uint8)\n episode_tensor = episode_tensor.reshape(video_shape)\n\n current_episode_len = episode_tensor.shape[0]\n if current_episode_len < self.seq_len:\n raise ValueError(\n f""Episode length {current_episode_len} is shorter than ""\n f""requested sequence length {self.seq_len}. This should ""\n f""have been filtered out.""\n )\n\n max_start_idx = current_episode_len - self.seq_len\n\n start_idx = rng.integers(0, max_start_idx + 1)\n\n seq = episode_tensor[start_idx : start_idx + self.seq_len]\n\n data_dict = {""videos"": seq}\n if ""actions"" in element.keys():\n actions_tensor = np.array(element[""actions""])\n actions = actions_tensor[start_idx : start_idx + self.seq_len]\n data_dict[""actions""] = actions\n\n return data_dict\n\n\ndef get_dataloader(\n array_record_paths: list[str],\n seq_len: int,\n global_batch_size: int,\n image_h: int,\n image_w: int,\n image_c: int,\n num_workers: int = 1,\n prefetch_buffer_size: int = 1,\n seed: int = 42,\n):\n """"""\n Creates a data loading pipeline using Grain.\n """"""\n if not array_record_paths:\n raise ValueError(""array_record_paths list cannot be empty."")\n\n per_process_batch_size = global_batch_size\n\n source = grain.sources.ArrayRecordDataSource(array_record_paths)\n\n sampler = grain.samplers.IndexSampler(\n num_records=len(source),\n shard_options=grain.sharding.ShardByJaxProcess(drop_remainder=True),\n shuffle=True,\n num_epochs=None,\n seed=seed,\n )\n\n operations = [\n EpisodeLengthFilter(\n seq_len=seq_len, image_h=image_h, image_w=image_w, image_c=image_c\n ),\n ProcessEpisodeAndSlice(\n seq_len=seq_len, image_h=image_h, image_w=image_w, image_c=image_c\n ),\n grain.transforms.Batch(batch_size=per_process_batch_size, drop_remainder=True),\n ]\n\n read_options = grain.ReadOptions(\n prefetch_buffer_size=prefetch_buffer_size,\n num_threads=1,\n )\n dataloader = grain.DataLoader(\n data_source=source,\n sampler=sampler,\n operations=operations,\n worker_count=num_workers,\n worker_buffer_size=1,\n read_options=read_options,\n )\n\n return dataloader\n\n\ndef main():\n parser = argparse.ArgumentParser(\n description=""Visualize a random sequence from an ArrayRecord by saving frames with actions.""\n )\n parser.add_argument(""--data_dir"", required=True, help=""Directory containing .array_record files"")\n parser.add_argument(\n ""--output_dir"",\n required=True,\n help=""Directory to save output images and actions.txt"",\n )\n parser.add_argument(""--seq_len"", type=int, default=16, help=""Sequence length to sample with Grain"")\n parser.add_argument(""--seed"", type=int, default=0, help=""Random seed for sampling"")\n parser.add_argument(""--channels"", type=int, default=3, help=""Number of channels in frames (default 3 for RGB)"")\n parser.add_argument(""--height"", type=int, default=84, help=""Frame height (if mismatch, will be inferred)"")\n parser.add_argument(""--width"", type=int, default=84, help=""Frame width (if mismatch, will be inferred)"")\n parser.add_argument(""--env_id"", type=str, default=None, help=""Gymnasium env id to map action indices to names"")\n parser.add_argument(""--fps"", type=int, default=10, help=""GIF frames per second"")\n\n args = parser.parse_args()\n\n assert args.channels == 3, ""Only 3 channels are currently supported""\n\n record = load_one_sequence_via_grain(\n data_dir=args.data_dir,\n seq_len=int(args.seq_len),\n image_h=int(args.height),\n image_w=int(args.width),\n image_c=int(args.channels),\n seed=int(args.seed),\n )\n\n # Print quick summary\n seq_len = int(record.get(""sequence_length"", -1))\n has_actions = ""actions"" in record and record[""actions""] is not None\n print(\n f""Loaded record with sequence_length={seq_len}, actions_present={has_actions}""\n )\n\n action_meanings = get_action_meanings(args.env_id)\n\n save_frames_with_actions(\n record=record,\n output_dir=args.output_dir,\n channels=int(args.channels),\n height=int(args.height) if args.height else None,\n width=int(args.width) if args.width else None,\n action_meanings=action_meanings,\n fps=int(args.fps),\n )\n\n\nif __name__ == ""__main__"":\n main()\n\n\n",python,tab
49
+ 48,451869,"data/jasmine_data/atari/visualize_array_record.py",12006,0,"",python,selection_keyboard
50
+ 49,452324,"data/jasmine_data/atari/visualize_array_record.py",10113,0,"",python,selection_keyboard
51
+ 50,452480,"data/jasmine_data/atari/visualize_array_record.py",8619,0,"",python,selection_keyboard
52
+ 51,452658,"data/jasmine_data/atari/visualize_array_record.py",7046,0,"",python,selection_keyboard
53
+ 52,452820,"data/jasmine_data/atari/visualize_array_record.py",5262,0,"",python,selection_keyboard
54
+ 53,452985,"data/jasmine_data/atari/visualize_array_record.py",3568,0,"",python,selection_keyboard
55
+ 54,454284,"data/jasmine_data/atari/visualize_array_record.py",0,0,"",python,selection_command
56
+ 55,455236,"data/jasmine_data/atari/visualize_array_record.py",59,0,"",python,selection_command
57
+ 56,455510,"data/jasmine_data/atari/visualize_array_record.py",656,0,"",python,selection_command
58
+ 57,462661,"TERMINAL",0,0,"cd data",,terminal_command
59
+ 58,463577,"TERMINAL",0,0,"squeue",,terminal_command
60
+ 59,463585,"TERMINAL",0,0,"]633;C JOBID USER PARTITION NODES CPUS ST SUBMIT_TIME START_TIME TIME TIME_LIMIT NODELIST(REASON)\r\n 29452 nishant.ku interacti 1 16 R 2025-09-25T13:42:51 2025-09-25T13:42:51 14:17 12:00:00 hai003\r\n 29450 xiao.liu interacti 1 64 R 2025-09-25T13:32:48 2025-09-25T13:32:48 24:20 23:59:00 hai006\r\n 29400 franz.sram interacti 1 128 R 2025-09-24T19:31:29 2025-09-24T19:31:29 18:25:39 1-00:00:00 hai008\r\n 29384 xiao.liu interacti 1 64 R 2025-09-24T16:00:41 2025-09-24T16:00:41 21:56:27 23:59:00 hai005\r\n 29453 alfred.ngu standard 1 24 R 2025-09-25T13:55:53 2025-09-25T13:55:53 1:15 1-00:00:00 hai001\r\n 29449 nishant.ku standard 1 16 R 2025-09-25T12:04:59 2025-09-25T12:04:59 1:52:09 1-00:00:00 hai003\r\n 29442 alfred.ngu standard 1 16 R 2025-09-25T02:58:27 2025-09-25T02:58:27 10:58:41 1-00:00:00 hai002\r\n 29443 alfred.ngu standard 1 16 R 2025-09-25T02:58:27 2025-09-25T02:58:27 10:58:41 1-00:00:00 hai002\r\n 29444 alfred.ngu standard 1 16 R 2025-09-25T02:58:27 2025-09-25T02:58:27 10:58:41 1-00:00:00 hai002\r\n 29441 alfred.ngu standard 1 16 R 2025-09-25T02:57:34 2025-09-25T02:57:35 10:59:33 1-00:00:00 hai002\r\n 29440 alfred.ngu standard 1 16 R 2025-09-25T02:57:34 2025-09-25T02:57:34 10:59:34 1-00:00:00 hai002\r\n 29439 alfred.ngu standard 1 16 R 2025-09-25T02:52:25 2025-09-25T02:52:25 11:04:43 1-00:00:00 hai002\r\n 29436 alfred.ngu standard 1 16 R 2025-09-25T02:47:09 2025-09-25T02:47:15 11:09:53 1-00:00:00 hai002\r\n 29426 alfred.ngu standard 1 16 R 2025-09-25T02:38:21 2025-09-25T02:38:21 11:18:47 1-00:00:00 hai002\r\n 29395 alfred.ngu standard 1 16 R 2025-09-24T17:10:31 2025-09-24T17:10:31 20:46:37 1-00:00:00 hai007\r\n 29390 alfred.ngu standard 1 16 R 2025-09-24T16:16:29 2025-09-24T16:16:29 21:40:39 1-00:00:00 hai001\r\n 29372 nishant.ku standard 1 32 R 2025-09-24T14:13:59 2025-09-24T14:14:15 23:42:53 1-00:00:00 hai007\r\n 29370 nishant.ku standard 1 32 R 2025-09-24T14:09:02 2025-09-24T14:09:03 23:48:05 1-00:00:00 hai004\r\n]0;franz.srambical@hai-login1:~/jafar/data",,terminal_output
61
+ 60,466187,"TERMINAL",0,0,"ls /fast/project/HFMI_SynergyUnit/jafar_ws/data/breakout/train/",,terminal_command
62
+ 61,466200,"TERMINAL",0,0,"]633;Cdata_0000.array_record data_0010.array_record data_0020.array_record data_0030.array_record data_0040.array_record data_0050.array_record data_0060.array_record data_0070.array_record data_0080.array_record data_0090.array_record\r\ndata_0001.array_record data_0011.array_record data_0021.array_record data_0031.array_record data_0041.array_record data_0051.array_record data_0061.array_record data_0071.array_record data_0081.array_record data_0091.array_record\r\ndata_0002.array_record data_0012.array_record data_0022.array_record data_0032.array_record data_0042.array_record data_0052.array_record data_0062.array_record data_0072.array_record data_0082.array_record data_0092.array_record\r\ndata_0003.array_record data_0013.array_record data_0023.array_record data_0033.array_record data_0043.array_record data_0053.array_record data_0063.array_record data_0073.array_record data_0083.array_record data_0093.array_record\r\ndata_0004.array_record data_0014.array_record data_0024.array_record data_0034.array_record data_0044.array_record data_0054.array_record data_0064.array_record data_0074.array_record data_0084.array_record data_0094.array_record\r\ndata_0005.array_record data_0015.array_record data_0025.array_record data_0035.array_record data_0045.array_record data_0055.array_record data_0065.array_record data_0075.array_record data_0085.array_record data_0095.array_record\r\ndata_0006.array_record data_0016.array_record data_0026.array_record data_0036.array_record data_0046.array_record data_0056.array_record data_0066.array_record data_0076.array_record data_0086.array_record data_0096.array_record\r\ndata_0007.array_record data_0017.array_record data_0027.array_record data_0037.array_record data_0047.array_record data_0057.array_record data_0067.array_record data_0077.array_record data_0087.array_record data_0097.array_record\r\ndata_0008.array_record data_0018.array_record data_0028.array_record data_0038.array_record data_0048.array_record data_0058.array_record data_0068.array_record data_0078.array_record data_0088.array_record data_0098.array_record\r\ndata_0009.array_record data_0019.array_record data_0029.array_record data_0039.array_record data_0049.array_record data_0059.array_record data_0069.array_record data_0079.array_record data_0089.array_record data_0099.array_record\r\n]0;franz.srambical@hai-login1:~/jafar/data",,terminal_output
63
+ 62,479198,"TERMINAL",0,0,"salloc --gpus=1 --ntasks-per-node=1 --cpus-per-task=64 --mem=100G",,terminal_command
64
+ 63,479253,"TERMINAL",0,0,"]633;Csalloc: Granted job allocation 29454\r\n",,terminal_output
65
+ 64,479352,"TERMINAL",0,0,"salloc: Nodes hai003 are ready for job\r\n",,terminal_output
66
+ 65,479752,"TERMINAL",0,0,"Running inside SLURM, Job ID 29454.\r\n",,terminal_output
67
+ 66,479810,"TERMINAL",0,0,"]0;franz.srambical@hai-login1:~/jafar/data[?2004h[franz.srambical@hai003.haicore.berlin:~/jafar/data] $ ",,terminal_output
68
+ 67,5640564,"data/jasmine_data/atari/visualize_array_record.py",0,0,"Switched from branch 'atari-rainbow-agent-capture' to 'generate-minatar-breakout-dataset'",python,git_branch_checkout
69
+ 68,5900575,"data/jasmine_data/atari/visualize_array_record.py",0,0,"Switched from branch 'generate-minatar-breakout-dataset' to 'main'",python,git_branch_checkout
70
+ 69,5920574,"data/jasmine_data/atari/visualize_array_record.py",0,0,"Switched from branch 'main' to 'minatar-breakout-after-refactor'",python,git_branch_checkout
71
+ 70,6310626,"data/jasmine_data/atari/visualize_array_record.py",0,0,"Switched from branch 'minatar-breakout-after-refactor' to 'main'",python,git_branch_checkout
72
+ 71,6345633,"data/jasmine_data/atari/visualize_array_record.py",0,0,"Switched from branch 'main' to 'minatar-breakout-after-refactor'",python,git_branch_checkout
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-1d1c9d40-4350-4512-82d6-f9fdf36759211756538623431-2025_08_30-08.23.49.356/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-1e1272f3-7d2e-4b26-8662-ef59b0a62e821764410118523-2025_11_29-10.55.25.324/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-20e92700-59ad-46ef-a859-4a9a5ba9057e1764863456200-2025_12_04-16.51.02.701/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-210e88c5-c80c-4b42-a393-717923a05daf1751602893995-2025_07_04-06.22.30.835/source.csv ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,4,"experiments/tokenizer_cross_node_checkpointing_test.sh",0,0,"#!/usr/bin/env bash\nsource .venv/bin/activate\n\n\ndata_dir='data_tfrecords'\n\nsrun python train_tokenizer.py \\n --batch_size 48 \\n --num_steps 300000 \\n --warmup_steps 10000 \\n --seed 0 \\n --min_lr=0.0000866 \\n --max_lr=0.0000866 \\n --data_dir $data_dir",shellscript,tab
3
+ 2,1227,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"6:22:29 AM [info] Activating crowd-code\n6:22:30 AM [info] Recording started\n6:22:30 AM [info] Initializing git provider using file system watchers...\n",Log,tab
4
+ 3,1964,"extension-output-pdoom-org.crowd-code-#1-crowd-code",150,0,"6:22:31 AM [info] Git repository found\n6:22:31 AM [info] Git provider initialized successfully\n",Log,content
5
+ 4,2138,"extension-output-pdoom-org.crowd-code-#1-crowd-code",245,0,"6:22:31 AM [info] Initial git state: [object Object]\n",Log,content
6
+ 5,2160,"experiments/tokenizer_cross_node_checkpointing_test.sh",0,0,"",shellscript,tab
7
+ 6,10632,"TERMINAL",0,0,"/usr/bin/python3 /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/printEnvVariablesToFile.py /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash/envVars.txt",,terminal_command
8
+ 7,10679,"TERMINAL",0,0,"]633;E;/usr/bin/python3 /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/printEnvVariablesToFile.py /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash/envVars.txt;302e415b-028b-436f-bfd4-9e88a911b8d3]633;C",,terminal_output
9
+ 8,10769,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash]633;D;0",,terminal_output
10
+ 9,155553,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:4 -w supergpu18 --cpus-per-task=1 --ntasks-per-node=1",,terminal_command
11
+ 10,155632,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:4 -w supergpu18 --cpus-per-task=1 --ntasks-per-node=1;d83d794d-068d-45a7-86c8-da2446d84194]633;Csalloc: Granted job allocation 26666090\r\n",,terminal_output
12
+ 11,155739,"TERMINAL",0,0,"salloc: Waiting for resource configuration\r\n",,terminal_output
13
+ 12,156214,"TERMINAL",0,0,"^Csalloc: Job allocation 26666090 has been revoked.\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D;1]633;P;Cwd=/lustre/groups/haicu/workspace/franz.srambical/jafar",,terminal_output
14
+ 13,156370,"TERMINAL",0,0,"^C",,terminal_command
15
+ 14,156377,"TERMINAL",0,0,"^C[?2004l\r[?2004h[?2004l\r\r\n]633;E;;d83d794d-068d-45a7-86c8-da2446d84194]633;C]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D",,terminal_output
16
+ 15,163176,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:4 -w supergpu18,supergpu16 --cpus-per-task=1 --ntasks-per-node=1",,terminal_command
17
+ 16,163236,"TERMINAL",0,0,"\r\n[?2004l\r]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:4 -w supergpu18,supergpu16 --cpus-per-task=1 --ntasks-per-node=1;d83d794d-068d-45a7-86c8-da2446d84194]633;Csalloc: Required node not available (down, drained or reserved)\r\nsalloc: Pending job allocation 26666092\r\nsalloc: job 26666092 queued and waiting for resources\r\n",,terminal_output
18
+ 17,165340,"TERMINAL",0,0,"^Csalloc: Job allocation 26666092 has been revoked.\r\nsalloc: Job aborted due to signal\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar",,terminal_output
19
+ 18,169464,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:4 -w supergpu18,supergpu14 --cpus-per-task=1 --ntasks-per-node=1",,terminal_command
20
+ 19,169496,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:4 -w supergpu18,supergpu14 --cpus-per-task=1 --ntasks-per-node=1;d83d794d-068d-45a7-86c8-da2446d84194]633;Csalloc: error: Problem using reservation\r\nsalloc: error: Job submit/allocate failed: Requested node configuration is not available\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D;1",,terminal_output
21
+ 20,175499,"TERMINAL",0,0,"squeue -w supergpu16,supergpu18,gpusrv[69,70],supergpu14",,terminal_command
22
+ 21,175545,"TERMINAL",0,0,"[?25l\r]633;Ajafar[franz.srambical@hpc-submit01 jafar]$ ]633;Bsqueue -w supergpu16,supergpu18,gpusrv[69,70],supergpu14\r]633;Ajafar[franz.srambical@hpc-submit01 jafar]$ ]633;B\r\n\r\r\n[?2004l\r]633;E;squeue -w supergpu16,supergpu18,gpusrv[69,70],supergpu14;d83d794d-068d-45a7-86c8-da2446d84194]633;C[?25h JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)\r\n 26649778 gpu_p test_kto muhammad R 12:38:31 1 supergpu14\r\n 26644304 gpu_p old_gpt helena.f R 11:31:24 1 supergpu14\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D;0",,terminal_output
23
+ 22,263503,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:4 -w gpusrv69,gpusrv70 --cpus-per-task=1 --ntasks-per-node=1",,terminal_command
24
+ 23,263524,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:4 -w gpusrv69,gpusrv70 --cpus-per-task=1 --ntasks-per-node=1;d83d794d-068d-45a7-86c8-da2446d84194]633;C",,terminal_output
25
+ 24,269401,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 -w gpusrv69,gpusrv70 --cpus-per-task=1 --ntasks-per-node=1",,terminal_command
26
+ 25,269478,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 -w gpusrv69,gpusrv70 --cpus-per-task=1 --ntasks-per-node=1;d83d794d-068d-45a7-86c8-da2446d84194]633;Csalloc: Granted job allocation 26666098\r\n",,terminal_output
27
+ 26,269582,"TERMINAL",0,0,"salloc: Waiting for resource configuration\r\n",,terminal_output
28
+ 27,270581,"TERMINAL",0,0,"salloc: Nodes gpusrv[69-70] are ready for job\r\n",,terminal_output
29
+ 28,270984,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
30
+ 29,288612,"TERMINAL",0,0,"b",,terminal_output
31
+ 30,288792,"TERMINAL",0,0,"[?25la[?25h[?25ls[?25h",,terminal_output
32
+ 31,288862,"TERMINAL",0,0,"[?25lh[?25h",,terminal_output
33
+ 32,288981,"TERMINAL",0,0,"[?25l [?25h",,terminal_output
34
+ 33,289354,"TERMINAL",0,0,"[?25le[?25h",,terminal_output
35
+ 34,289560,"TERMINAL",0,0,"[?25lx[?25h",,terminal_output
36
+ 35,289646,"TERMINAL",0,0,"[?25lp[?25h",,terminal_output
37
+ 36,289804,"TERMINAL",0,0,"[?25le[?25h[?25lr[?25h",,terminal_output
38
+ 37,289896,"TERMINAL",0,0,"[?25li[?25h[?25lm[?25h",,terminal_output
39
+ 38,289995,"TERMINAL",0,0,"ents/",,terminal_output
40
+ 39,290169,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
41
+ 40,290243,"TERMINAL",0,0,"[?25lo[?25h[?25lk[?25h",,terminal_output
42
+ 41,290348,"TERMINAL",0,0,"enizer_",,terminal_output
43
+ 42,291855,"TERMINAL",0,0,"[?25lc[?25h",,terminal_output
44
+ 43,292026,"TERMINAL",0,0,"[?25lr[?25h",,terminal_output
45
+ 44,292103,"TERMINAL",0,0,"[?25lo[?25h",,terminal_output
46
+ 45,292214,"TERMINAL",0,0,"ss_node_checkpointing_test.sh ",,terminal_output
47
+ 46,292978,"TERMINAL",0,0,"",,terminal_output
48
+ 47,293942,"TERMINAL",0,0,"\r\n\r",,terminal_output
49
+ 48,294889,"experiments/tokenizer_cross_node_checkpointing_test.sh",128,0,"",shellscript,selection_command
50
+ 49,295198,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"",shellscript,selection_command
51
+ 50,297368,"experiments/tokenizer_cross_node_checkpointing_test.sh",114,0,"",shellscript,selection_command
52
+ 51,297688,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"",shellscript,selection_command
53
+ 52,297977,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,2,"",shellscript,content
54
+ 53,298600,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"9",shellscript,content
55
+ 54,298601,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"",shellscript,selection_keyboard
56
+ 55,298855,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"6",shellscript,content
57
+ 56,298856,"experiments/tokenizer_cross_node_checkpointing_test.sh",127,0,"",shellscript,selection_keyboard
58
+ 57,299138,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"",shellscript,selection_command
59
+ 58,301827,"TERMINAL",0,0,"\r\n[?2004l\r",,terminal_output
60
+ 59,426408,"TERMINAL",0,0,"2025-07-04 06:29:37.135127: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-04 06:29:37.134980: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n",,terminal_output
61
+ 60,427077,"TERMINAL",0,0,"WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751603377.823046 2573765 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751603377.823111 2567277 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\n",,terminal_output
62
+ 61,427582,"TERMINAL",0,0,"E0000 00:00:1751603378.332558 2573765 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nE0000 00:00:1751603378.332609 2567277 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\n",,terminal_output
63
+ 62,429545,"TERMINAL",0,0,"W0000 00:00:1751603380.294291 2567277 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603380.294340 2567277 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603380.294347 2567277 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603380.294352 2567277 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603380.294299 2573765 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603380.294368 2573765 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603380.294374 2573765 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603380.294380 2573765 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\n",,terminal_output
64
+ 63,517769,"TERMINAL",0,0,"W0000 00:00:1751603468.502047 2567277 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751603468.501985 2573765 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\n",,terminal_output
65
+ 64,599140,"TERMINAL",0,0,"2025-07-04 06:32:29.885880: W external/xla/xla/tsl/framework/bfc_allocator.cc:310] Allocator (GPU_0_bfc) ran out of memory trying to allocate 19.39GiB with freed_by_count=0. The caller indicates that this is not a failure, but this may mean that there could be performance gains if more memory were available.\r\n",,terminal_output
66
+ 65,599218,"TERMINAL",0,0,"2025-07-04 06:32:29.967424: W external/xla/xla/tsl/framework/bfc_allocator.cc:310] Allocator (GPU_0_bfc) ran out of memory trying to allocate 19.39GiB with freed_by_count=0. The caller indicates that this is not a failure, but this may mean that there could be performance gains if more memory were available.\r\n",,terminal_output
67
+ 66,599564,"TERMINAL",0,0,"Running on 2 devices.\r\nTraceback (most recent call last):\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/train_tokenizer.py"", line 159, in <module>\r\n init_params = tokenizer.init(_rng, inputs)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/models/tokenizer.py"", line 46, in __call__\r\n outputs = self.vq_encode(batch[""videos""], training)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/models/tokenizer.py"", line 57, in vq_encode\r\n x = self.encoder(x) # (B, T, N, E)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/utils/nn.py"", line 87, in __call__\r\nRunning on 2 devices.\r\nTraceback (most recent call last):\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/train_tokenizer.py"", line 159, in <module>\r\n x = STBlock(\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/utils/nn.py"", line 41, in __call__\r\n z = nn.MultiHeadAttention(\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/.venv/lib/python3.10/site-packages/flax/linen/attention.py"", line 674, in __call__\r\n init_params = tokenizer.init(_rng, inputs)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/models/tokenizer.py"", line 46, in __call__\r\n outputs = self.vq_encode(batch[""videos""], training)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/models/tokenizer.py"", line 57, in vq_encode\r\n x = self.encoder(x) # (B, T, N, E)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/utils/nn.py"", line 87, in __call__\r\n x = STBlock(\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/utils/nn.py"", line 41, in __call__\r\n z = nn.MultiHeadAttention(\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/.venv/lib/python3.10/site-packages/flax/linen/attention.py"", line 674, in __call__\r\n x = self.attention_fn(*attn_args, **attn_kwargs)\r\n x = self.attention_fn(*attn_args, **attn_kwargs)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/.venv/lib/python3.10/site-packages/flax/linen/attention.py"", line 291, in dot_product_attention\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/.venv/lib/python3.10/site-packages/flax/linen/attention.py"", line 291, in dot_product_attention\r\n return attn_weights_value_einsum(\r\n return attn_weights_value_einsum(\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/.venv/lib/python3.10/site-packages/jax/_src/numpy/einsum.py"", line 315, in einsum\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/.venv/lib/python3.10/site-packages/jax/_src/numpy/einsum.py"", line 315, in einsum\r\n return jit_einsum(operand_arrays, contractions, precision,\r\n File ""/ictstr01/home/aih/franz.srambical/.local/share/uv/python/cpython-3.10.15-linux-x86_64-gnu/lib/python3.10/contextlib.py"", line 79, in inner\r\n return jit_einsum(operand_arrays, contractions, precision,\r\n File ""/ictstr01/home/aih/franz.srambical/.local/share/uv/python/cpython-3.10.15-linux-x86_64-gnu/lib/python3.10/contextlib.py"", line 79, in inner\r\n return func(*args, **kwds)\r\njax._src.source_info_util.JaxStackTraceBeforeTransformation: jaxlib._jax.XlaRuntimeError: RESOURCE_EXHAUSTED: Out of memory while trying to allocate 20817903616 bytes.\r\n\r\nThe preceding stack trace is the source of the JAX operation that, once transformed by JAX, triggered the following exception.\r\n\r\n--------------------\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\njax.errors.SimplifiedTraceback: For simplicity, JAX has removed its internal frames from the traceback of the following exception. Set JAX_TRACEBACK_FILTERING=off to include these.\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/train_tokenizer.py"", line 159, in <module>\r\n init_params = tokenizer.init(_rng, inputs)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/models/tokenizer.py"", line 46, in __call__\r\n outputs = self.vq_encode(batch[""videos""], training)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/models/tokenizer.py"", line 57, in vq_encode\r\n x = self.encoder(x) # (B, T, N, E)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/utils/nn.py"", line 87, in __call__\r\n return func(*args, **kwds)\r\njax._src.source_info_util.JaxStackTraceBeforeTransformation: jaxlib._jax.XlaRuntimeError: RESOURCE_EXHAUSTED: Out of memory while trying to allocate 20817903616 bytes.\r\n\r\nThe preceding stack trace is the source of the JAX operation that, once transformed by JAX, triggered the following exception.\r\n\r\n--------------------\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\njax.errors.SimplifiedTraceback: For simplicity, JAX has removed its internal frames from the traceback of the following exception. Set JAX_TRACEBACK_FILTERING=off to include these.\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/train_tokenizer.py"", line 159, in <module>\r\n x = STBlock(\r\njaxlib._jax.XlaRuntimeError: RESOURCE_EXHAUSTED: Out of memory while trying to allocate 20817903616 bytes.\r\n init_params = tokenizer.init(_rng, inputs)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/models/tokenizer.py"", line 46, in __call__\r\n outputs = self.vq_encode(batch[""videos""], training)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/models/tokenizer.py"", line 57, in vq_encode\r\n x = self.encoder(x) # (B, T, N, E)\r\n File ""/ictstr01/groups/haicu/workspace/franz.srambical/jafar/utils/nn.py"", line 87, in __call__\r\n x = STBlock(\r\njaxlib._jax.XlaRuntimeError: RESOURCE_EXHAUSTED: Out of memory while trying to allocate 20817903616 bytes.\r\n",,terminal_output
68
+ 67,614836,"TERMINAL",0,0,"srun: error: gpusrv70: task 1: Exited with exit code 1\r\nsrun: error: gpusrv69: task 0: Exited with exit code 1\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
69
+ 68,619888,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"",shellscript,selection_command
70
+ 69,620029,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,2,"",shellscript,content
71
+ 70,621309,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"4",shellscript,content
72
+ 71,621310,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"",shellscript,selection_keyboard
73
+ 72,621346,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"8",shellscript,content
74
+ 73,621347,"experiments/tokenizer_cross_node_checkpointing_test.sh",127,0,"",shellscript,selection_keyboard
75
+ 74,621533,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"",shellscript,selection_command
76
+ 75,623291,"TERMINAL",0,0,"[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
77
+ 76,623355,"TERMINAL",0,0,"bash experiments/tokenizer_cross_node_checkpointing_test.sh ",,terminal_output
78
+ 77,623643,"TERMINAL",0,0,"[?25l[?2004l\r[?25h",,terminal_output
79
+ 78,626729,"TERMINAL",0,0,"2025-07-04 06:32:57.434648: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-04 06:32:57.443490: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751603577.448497 2575006 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nE0000 00:00:1751603577.453130 2575006 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751603577.457228 2568489 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nE0000 00:00:1751603577.461873 2568489 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nW0000 00:00:1751603577.465917 2575006 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603577.465930 2575006 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603577.465934 2575006 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603577.465936 2575006 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603577.474565 2568489 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603577.474580 2568489 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603577.474583 2568489 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751603577.474586 2568489 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\n",,terminal_output
80
+ 79,630023,"TERMINAL",0,0,"W0000 00:00:1751603580.771489 2575006 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751603580.772076 2568489 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\n",,terminal_output
81
+ 80,941318,"TERMINAL",0,0,"^Csrun: interrupt (one more within 1 sec to abort)\r\nsrun: StepId=26666098.1 tasks 0-1: running\r\n",,terminal_output
82
+ 81,941455,"TERMINAL",0,0,"^Csrun: sending Ctrl-C to StepId=26666098.1\r\nsrun: forcing job termination\r\nsrun: Job step aborted: Waiting up to 32 seconds for job step to finish.\r\nslurmstepd: error: *** STEP 26666098.1 ON gpusrv69 CANCELLED AT 2025-07-04T06:38:12 ***\r\n",,terminal_output
83
+ 82,942039,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
84
+ 83,942837,"TERMINAL",0,0,"e",,terminal_output
85
+ 84,943091,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
86
+ 85,943782,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
87
+ 86,943839,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
88
+ 87,944367,"TERMINAL",0,0,"[?25lx[?25h",,terminal_output
89
+ 88,944458,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
90
+ 89,944521,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
91
+ 90,944693,"TERMINAL",0,0,"[?25l[?2004l\rexit\r\n[?25h",,terminal_output
92
+ 91,945047,"TERMINAL",0,0,"srun: error: gpusrv69: task 0: Exited with exit code 137\r\nsalloc: Relinquishing job allocation 26666098\r\nsalloc: Job allocation 26666098 has been revoked.\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D;137]633;P;Cwd=/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h",,terminal_output
93
+ 92,948978,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 -w gpusrv69,gpusrv70 --cpus-per-task=1 --ntasks-per-node=2",,terminal_command
94
+ 93,949067,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 -w gpusrv69,gpusrv70 --cpus-per-task=1 --ntasks-per-node=2;d83d794d-068d-45a7-86c8-da2446d84194]633;Csalloc: Granted job allocation 26666106\r\n",,terminal_output
95
+ 94,949177,"TERMINAL",0,0,"salloc: Nodes gpusrv[69-70] are ready for job\r\n",,terminal_output
96
+ 95,949517,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
97
+ 96,952576,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
98
+ 97,952728,"TERMINAL",0,0,"[?25l[61@s': bash experiments/tokenizer_cross_node_checkpointing_test.sh[?25h",,terminal_output
99
+ 98,952807,"TERMINAL",0,0,"[?25ls\ro': /usr/bin/python3 /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/printEnvVariablesToFile.py /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash/envVars.txt[?25h",,terminal_output
100
+ 99,952860,"TERMINAL",0,0,"u': source .venv/bin/activate\r\n\r\r\n\r\r\n\r",,terminal_output
101
+ 100,953265,"TERMINAL",0,0,"[1@r': sour",,terminal_output
102
+ 101,953501,"TERMINAL",0,0,"[?25ls[1@c': sourc[?25h[?25ls[1@e': source[?25h",,terminal_output
103
+ 102,953664,"TERMINAL",0,0,"[?25l\r[6@[franz.srambical@gpusrv69 jafar]$ source\r\n[?2004l\r]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h(jafar) [franz.srambical@gpusrv69 jafar]$ [?25h",,terminal_output
104
+ 103,956058,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
105
+ 104,956795,"TERMINAL",0,0,"-': /usr/bin/python3 /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/printEnvVariablesToFile.py /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash/envVars.txt\rc': salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2 --ntasks=4\r\n\r",,terminal_output
106
+ 105,957520,"TERMINAL",0,0,"[?25l- ': srun bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'\r\n\r\r\n\r[?25h",,terminal_output
107
+ 106,958576,"TERMINAL",0,0,"\rjafar) [franz.srambical@gpusrv69 jafar]$ srun bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'\r\n\r",,terminal_output
108
+ 107,960292,"TERMINAL",0,0,"",,terminal_output
109
+ 108,960712,"TERMINAL",0,0,"",,terminal_output
110
+ 109,960948,"TERMINAL",0,0,"\r",,terminal_output
111
+ 110,961464,"TERMINAL",0,0,"\r",,terminal_output
112
+ 111,961897,"TERMINAL",0,0,"",,terminal_output
113
+ 112,962331,"TERMINAL",0,0," -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
114
+ 113,962472,"TERMINAL",0,0," -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
115
+ 114,962573,"TERMINAL",0,0," -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
116
+ 115,962699,"TERMINAL",0,0," -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
117
+ 116,963175,"TERMINAL",0,0,"p -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
118
+ 117,963238,"TERMINAL",0,0,"y -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
119
+ 118,963314,"TERMINAL",0,0,"t -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
120
+ 119,963422,"TERMINAL",0,0,"[?25lh -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
121
+ 120,963491,"TERMINAL",0,0,"[?25lo -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
122
+ 121,963576,"TERMINAL",0,0,"[?25ln -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
123
+ 122,963730,"TERMINAL",0,0,"[?25l3 -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
124
+ 123,963960,"TERMINAL",0,0,"\r\n\r",,terminal_output
125
+ 124,964474,"TERMINAL",0,0,"",,terminal_output
126
+ 125,964904,"TERMINAL",0,0,"'",,terminal_output
127
+ 126,966726,"TERMINAL",0,0,"''''''''''''''\r'\r' \r'\r\n\r'''''''''''''''''''''''''''''''",,terminal_output
128
+ 127,972932,"TERMINAL",0,0,"i'",,terminal_output
129
+ 128,973008,"TERMINAL",0,0,"[?25lm'[?25h",,terminal_output
130
+ 129,973062,"TERMINAL",0,0,"[?25lp'[?25h",,terminal_output
131
+ 130,973179,"TERMINAL",0,0,"[?25lo'[?25h",,terminal_output
132
+ 131,973253,"TERMINAL",0,0,"[?25lr'[?25h",,terminal_output
133
+ 132,973488,"TERMINAL",0,0,"[?25lt'[?25h",,terminal_output
134
+ 133,973815,"TERMINAL",0,0,"[?25l '[?25h",,terminal_output
135
+ 134,973923,"TERMINAL",0,0,"[?25lj'[?25h",,terminal_output
136
+ 135,974014,"TERMINAL",0,0,"[?25la'[?25h",,terminal_output
137
+ 136,974452,"TERMINAL",0,0,"[?25lx'[?25h",,terminal_output
138
+ 137,975223,"TERMINAL",0,0,"[?25l '[?25h",,terminal_output
139
+ 138,1035106,"TERMINAL",0,0,"[?25l '[?25h",,terminal_output
140
+ 139,1035277,"TERMINAL",0,0,"[?25l;'[?25h",,terminal_output
141
+ 140,1043348,"TERMINAL",0,0,"jax.local_devices()'",,terminal_output
142
+ 141,1043772,"TERMINAL",0,0,"jax.local_devices()'",,terminal_output
143
+ 142,1044542,"TERMINAL",0,0,"[?25l[?2004l\r[?25h",,terminal_output
144
+ 143,1053281,"TERMINAL",0,0,"^Csrun: interrupt (one more within 1 sec to abort)\r\nsrun: StepId=26666106.0 tasks 0-3: running\r\n",,terminal_output
145
+ 144,1053829,"TERMINAL",0,0,"^P",,terminal_output
146
+ 145,1054441,"TERMINAL",0,0,"^Csrun: interrupt (one more within 1 sec to abort)\r\nsrun: StepId=26666106.0 tasks 0-3: running\r\n",,terminal_output
147
+ 146,1054854,"TERMINAL",0,0,"^Csrun: sending Ctrl-C to StepId=26666106.0\r\nsrun: forcing job termination\r\nsrun: Job step aborted: Waiting up to 32 seconds for job step to finish.\r\nslurmstepd: error: *** STEP 26666106.0 ON gpusrv69 CANCELLED AT 2025-07-04T06:40:05 ***\r\n",,terminal_output
148
+ 147,1055016,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h(jafar) [franz.srambical@gpusrv69 jafar]$ ",,terminal_output
149
+ 148,1055477,"TERMINAL",0,0,"srun python3 -c 'import jax;jax.local_devices()'",,terminal_output
150
+ 149,1057811,"TERMINAL",0,0,"pjax.local_devices()'",,terminal_output
151
+ 150,1057911,"TERMINAL",0,0,"[?25lrjax.local_devices()' [?25h",,terminal_output
152
+ 151,1058002,"TERMINAL",0,0,"ijax.local_devices()'",,terminal_output
153
+ 152,1058079,"TERMINAL",0,0,"[?25lnjax.local_devices()'[?25h",,terminal_output
154
+ 153,1058138,"TERMINAL",0,0,"[?25ltjax.local_devices()'[?25h",,terminal_output
155
+ 154,1058405,"TERMINAL",0,0,"[?25l(jax.local_devices()'[?25h",,terminal_output
156
+ 155,1059075,"TERMINAL",0,0,"\r\n\r",,terminal_output
157
+ 156,1059561,"TERMINAL",0,0,"",,terminal_output
158
+ 157,1059978,"TERMINAL",0,0,")'",,terminal_output
159
+ 158,1060191,"TERMINAL",0,0,"",,terminal_output
160
+ 159,1060368,"TERMINAL",0,0,"\r\n[?2004l\r",,terminal_output
161
+ 160,1069146,"TERMINAL",0,0,"[CudaDevice(id=0), CudaDevice(id=1)]\r\n[CudaDevice(id=0), CudaDevice(id=1)]\r\n[CudaDevice(id=0), CudaDevice(id=1)]\r\n[CudaDevice(id=0), CudaDevice(id=1)]\r\n",,terminal_output
162
+ 161,1070761,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h(jafar) [franz.srambical@gpusrv69 jafar]$ ",,terminal_output
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-23fb2c21-9401-4393-bc27-ac58a13784d01764494621673-2025_11_30-10.23.55.182/source.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,59,"Untitled-1",0,0,"",plaintext,tab
3
+ 2,574,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"10:23:55 AM [info] Activating crowd-code\n10:23:55 AM [info] Recording started\n10:23:55 AM [info] Initializing git provider using file system watchers...\n10:23:55 AM [info] No workspace folder found\n",Log,tab
4
+ 3,2341,"extension-output-pdoom-org.crowd-code-#1-crowd-code",198,0,"10:23:57 AM [info] Retrying git provider initialization...\n10:23:57 AM [info] No workspace folder found\n",Log,content
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-25373d4e-68c9-48b1-a295-2d5d418610141764451376541-2025_11_29-22.22.59.470/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-25423ad6-b986-416f-a8e4-1361641f9a641761722232315-2025_10_29-08.17.22.663/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-264a0e70-8280-4ed9-a47c-e76bfae594cd1754128841382-2025_08_02-12.01.32.618/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-2670a8b6-206d-42c4-9853-62035f6f5d711759257890459-2025_09_30-20.44.56.213/source.csv ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,4,"slurm/jobs/franz/berlin/coinrun/mila_submission/coinrun_dynamics_base.sh",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=1\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:1\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=dynamics_coinrun_mila_submission\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nsource .venv/bin/activate\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""coinrun dynamics 500m_dataset mila_submission""\n\narray_records_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_500m_seed_w_increment""\ntokenizer_ckpt_dir="" /fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/tokenizer_coinrun_mila_submission_29736""\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\nenv | grep SLURM\n\n\nsrun python jasmine/train_dynamics.py \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --val_data_dir=""${array_records_dir}/val"" \\n --data_dir=""${array_records_dir}/train"" &\n\nchild_pid=$!\n\nwait $child_pid\n\n",shellscript,tab
3
+ 2,133,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"8:44:56 PM [info] Activating crowd-code\n8:44:56 PM [info] Recording started\n8:44:56 PM [info] Initializing git provider using file system watchers...\n",Log,tab
4
+ 3,181,"extension-output-pdoom-org.crowd-code-#1-crowd-code",150,0,"8:44:56 PM [info] Git repository found\n8:44:56 PM [info] Git provider initialized successfully\n8:44:56 PM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,3181,"slurm/jobs/franz/berlin/coinrun/mila_submission/coinrun_dynamics_base.sh",0,0,"",shellscript,tab
6
+ 5,5651,"TERMINAL",0,0,"",,terminal_command
7
+ 6,7674,"jasmine/train_dynamics.py",0,0,"import os\n\n\nos.environ.setdefault(""XLA_PYTHON_CLIENT_MEM_FRACTION"", ""0.98"")\n\nfrom dataclasses import dataclass, field\nimport itertools\nfrom typing import cast, Optional\n\nimport einops\nfrom jax.sharding import Mesh, PartitionSpec, NamedSharding\nfrom jax.experimental.mesh_utils import create_device_mesh\nimport optax\nimport orbax.checkpoint as ocp\nimport numpy as np\nimport dm_pix as pix\nimport jax\nimport jax.numpy as jnp\nimport tyro\nimport wandb\nimport grain\nimport flax.nnx as nnx\n\nfrom genie import Genie, restore_genie_components\nfrom utils.dataloader import get_dataloader\nfrom utils.train_utils import (\n get_lr_schedule,\n count_parameters_by_component,\n print_mem_stats,\n print_compiled_memory_stats,\n print_compiled_cost_analysis,\n)\n\n\n@dataclass\nclass Args:\n # Experiment\n num_steps: int = 200_000\n seed: int = 0\n seq_len: int = 16\n image_channels: int = 3\n image_height: int = 64\n image_width: int = 64\n data_dir: str = """"\n save_ckpt: bool = False\n restore_ckpt: bool = False\n # Optimization\n batch_size: int = 36\n init_lr: float = 0.0\n max_lr: float = 3e-5\n decay_end: float = 0.0\n wsd_decay_steps: int = (\n 20_000 # NOTE: wsd_decay_steps will only be used when using a wsd-schedule\n )\n warmup_steps: int = 5000\n lr_schedule: str = ""wsd"" # supported options: wsd, cos\n # Tokenizer\n tokenizer_dim: int = 512\n tokenizer_ffn_dim: int = 2048\n latent_patch_dim: int = 32\n num_patch_latents: int = 1024\n patch_size: int = 16\n tokenizer_num_blocks: int = 4\n tokenizer_num_heads: int = 8\n tokenizer_checkpoint: str = """"\n # LAM\n lam_dim: int = 512\n lam_ffn_dim: int = 2048\n latent_action_dim: int = 32\n num_actions: int = 6\n lam_patch_size: int = 16\n lam_num_blocks: int = 4\n lam_num_heads: int = 8\n lam_checkpoint: str = """"\n # Dynamics\n dyna_type: str = ""maskgit"" # supported options: maskgit, causal\n dyna_dim: int = 512\n dyna_ffn_dim: int = 2048\n dyna_num_blocks: int = 6\n dyna_num_heads: int = 8\n dropout: float = 0.0\n mask_limit: float = 0.5\n z_loss_weight: float = 0.0\n param_dtype = jnp.float32\n dtype = jnp.bfloat16\n use_flash_attention: bool = True\n use_gt_actions: bool = False\n # Logging\n log: bool = True\n entity: str = """"\n project: str = """"\n name: str = ""train_dynamics""\n tags: list[str] = field(default_factory=lambda: [""dynamics""])\n log_interval: int = 50\n log_image_interval: int = 1000\n ckpt_dir: str = """"\n log_checkpoint_interval: int = 5000\n log_checkpoint_keep_period: int = 20_000\n log_gradients: bool = False\n val_data_dir: str = """"\n val_interval: int = 20_000\n val_steps: int = 50\n eval_full_frame: bool = True\n val_maskgit_steps: int = 25\n val_temperature: float = 1\n val_sample_argmax: bool = False\n wandb_id: str = """"\n\n\ndef build_model(args: Args, rng: jax.Array) -> tuple[Genie, jax.Array]:\n rng, _rng = jax.random.split(rng)\n rngs = nnx.Rngs(_rng)\n genie = Genie(\n # Tokenizer\n in_dim=args.image_channels,\n tokenizer_dim=args.tokenizer_dim,\n tokenizer_ffn_dim=args.tokenizer_ffn_dim,\n latent_patch_dim=args.latent_patch_dim,\n num_patch_latents=args.num_patch_latents,\n patch_size=args.patch_size,\n tokenizer_num_blocks=args.tokenizer_num_blocks,\n tokenizer_num_heads=args.tokenizer_num_heads,\n # LAM\n lam_dim=args.lam_dim,\n lam_ffn_dim=args.lam_ffn_dim,\n latent_action_dim=args.latent_action_dim,\n num_actions=args.num_actions,\n lam_patch_size=args.lam_patch_size,\n lam_num_blocks=args.lam_num_blocks,\n lam_num_heads=args.lam_num_heads,\n lam_co_train=not args.lam_checkpoint,\n use_gt_actions=args.use_gt_actions,\n # Dynamics\n dyna_type=args.dyna_type,\n dyna_dim=args.dyna_dim,\n dyna_ffn_dim=args.dyna_ffn_dim,\n dyna_num_blocks=args.dyna_num_blocks,\n dyna_num_heads=args.dyna_num_heads,\n dropout=args.dropout,\n mask_limit=args.mask_limit,\n param_dtype=args.param_dtype,\n dtype=args.dtype,\n use_flash_attention=args.use_flash_attention,\n decode=False,\n rngs=rngs,\n )\n if args.use_gt_actions:\n assert (\n not args.lam_checkpoint\n ), ""Cannot use LAM when using ground-truth actions.""\n else:\n assert genie.lam is not None\n del genie.lam.decoder\n return genie, rng\n\n\ndef build_optimizer(genie: Genie, args: Args) -> nnx.ModelAndOptimizer:\n lr_schedule = get_lr_schedule(\n args.lr_schedule,\n args.init_lr,\n args.max_lr,\n args.decay_end,\n args.num_steps,\n args.warmup_steps,\n args.wsd_decay_steps,\n )\n tx = optax.adamw(\n learning_rate=lr_schedule,\n b1=0.9,\n b2=0.9,\n weight_decay=1e-4,\n mu_dtype=args.param_dtype, # moments in full precision\n )\n optimizer = nnx.ModelAndOptimizer(genie, tx)\n return optimizer\n\n\ndef build_mesh_and_sharding(\n num_devices: int,\n) -> tuple[Mesh, NamedSharding, NamedSharding, NamedSharding]:\n device_mesh_arr = create_device_mesh((num_devices,))\n mesh = Mesh(devices=device_mesh_arr, axis_names=(""data"",))\n replicated_sharding = NamedSharding(mesh, PartitionSpec())\n videos_sharding = NamedSharding(mesh, PartitionSpec(""data"", None, None, None, None))\n actions_sharding = NamedSharding(mesh, PartitionSpec(""data"", None))\n return mesh, replicated_sharding, videos_sharding, actions_sharding\n\n\ndef shard_optimizer_states(\n optimizer: nnx.ModelAndOptimizer, replicated_sharding: NamedSharding\n) -> None:\n model_state = nnx.state(optimizer.model)\n model_sharded_state = jax.lax.with_sharding_constraint(\n model_state, replicated_sharding\n )\n nnx.update(optimizer.model, model_sharded_state)\n optimizer_state = nnx.state(optimizer, nnx.optimizer.OptState)\n optimizer_sharded_state = jax.lax.with_sharding_constraint(\n optimizer_state, replicated_sharding\n )\n nnx.update(optimizer, optimizer_sharded_state)\n\n\ndef build_dataloader(args: Args, data_dir: str) -> grain.DataLoaderIterator:\n image_shape = (args.image_height, args.image_width, args.image_channels)\n array_record_files = [\n os.path.join(data_dir, x)\n for x in os.listdir(data_dir)\n if x.endswith("".array_record"")\n ]\n grain_dataloader = get_dataloader(\n array_record_files,\n args.seq_len,\n # NOTE: We deliberately pass the global batch size\n # The dataloader shards the dataset across all processes\n args.batch_size,\n *image_shape,\n num_workers=8,\n prefetch_buffer_size=1,\n seed=args.seed,\n )\n initial_state = grain_dataloader._create_initial_state()\n grain_iterator = grain.DataLoaderIterator(grain_dataloader, initial_state)\n return grain_iterator\n\n\ndef build_checkpoint_manager(args: Args) -> Optional[ocp.CheckpointManager]:\n if args.restore_ckpt or args.save_ckpt:\n handler_registry = ocp.handlers.DefaultCheckpointHandlerRegistry()\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeSave, ocp.handlers.PyTreeCheckpointHandler\n )\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeRestore, ocp.handlers.PyTreeCheckpointHandler\n )\n handler_registry.add(\n ""train_dataloader_state"",\n grain.checkpoint.CheckpointSave,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n handler_registry.add(\n ""train_dataloader_state"",\n grain.checkpoint.CheckpointRestore,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n if args.val_data_dir:\n handler_registry.add(\n ""val_dataloader_state"",\n grain.checkpoint.CheckpointSave,\n cast(\n ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler\n ),\n )\n handler_registry.add(\n ""val_dataloader_state"",\n grain.checkpoint.CheckpointRestore,\n cast(\n ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler\n ),\n )\n checkpoint_options = ocp.CheckpointManagerOptions(\n save_interval_steps=args.log_checkpoint_interval,\n max_to_keep=3,\n keep_period=args.log_checkpoint_keep_period,\n step_format_fixed_length=6,\n cleanup_tmp_directories=True,\n )\n checkpoint_manager = ocp.CheckpointManager(\n args.ckpt_dir,\n options=checkpoint_options,\n handler_registry=handler_registry,\n )\n return checkpoint_manager\n else:\n return None\n\n\ndef restore_or_initialize_components(\n args: Args,\n checkpoint_manager: Optional[ocp.CheckpointManager],\n optimizer: nnx.ModelAndOptimizer,\n train_iterator: grain.DataLoaderIterator,\n rng: jax.Array,\n replicated_sharding: NamedSharding,\n val_iterator: Optional[grain.DataLoaderIterator],\n restore_step: Optional[int] = None,\n) -> tuple[\n int,\n nnx.ModelAndOptimizer,\n grain.DataLoaderIterator,\n grain.DataLoaderIterator,\n jax.Array,\n]:\n step = 0\n if checkpoint_manager and restore_step is None:\n restore_step = checkpoint_manager.latest_step()\n if args.restore_ckpt:\n assert checkpoint_manager is not None\n abstract_optimizer = nnx.eval_shape(lambda: optimizer)\n abstract_optimizer_state = nnx.state(abstract_optimizer)\n if val_iterator:\n restore_args = ocp.args.Composite(\n model_state=ocp.args.PyTreeRestore(abstract_optimizer_state), # type: ignore\n train_dataloader_state=grain.checkpoint.CheckpointRestore(train_iterator), # type: ignore\n val_dataloader_state=grain.checkpoint.CheckpointRestore(val_iterator), # type: ignore\n )\n else:\n restore_args = ocp.args.Composite(\n model_state=ocp.args.PyTreeRestore(abstract_optimizer_state), # type: ignore\n train_dataloader_state=grain.checkpoint.CheckpointRestore(train_iterator), # type: ignore\n )\n restored = checkpoint_manager.restore(\n checkpoint_manager.latest_step(), args=restore_args\n )\n restored_optimizer_state = restored[""model_state""]\n nnx.update(optimizer, restored_optimizer_state)\n train_iterator = restored[""train_dataloader_state""]\n if val_iterator:\n val_iterator = restored[""val_dataloader_state""]\n step = checkpoint_manager.latest_step() or 0\n print(f""Restored dataloader and model state from step {step}"")\n else:\n # Restore from pre-trained tokenizer (and LAM)\n rng, _rng = jax.random.split(rng)\n optimizer = restore_genie_components(optimizer, replicated_sharding, _rng, args)\n return step, optimizer, train_iterator, val_iterator, rng\n\n\ndef _calculate_top_k_accuracy(\n token_logits_BTNV: jax.Array,\n video_tokens_BTN: jax.Array,\n mask_BTN: jax.Array,\n k: int,\n) -> jax.Array:\n _, topk_indices_BTNK = jax.lax.top_k(token_logits_BTNV, k)\n topk_correct = jnp.any(\n topk_indices_BTNK == video_tokens_BTN[..., jnp.newaxis], axis=-1\n )\n topk_acc = (mask_BTN * topk_correct).sum() / mask_BTN.sum()\n return topk_acc\n\n\ndef _calculate_step_metrics(\n outputs: dict[str, jax.Array],\n gt: jax.Array,\n num_actions: int,\n num_patch_latents: int,\n) -> tuple[jax.Array, dict]:\n mask_BTN = outputs[""mask""]\n outputs[""token_logits""] = outputs[""token_logits""].astype(jnp.float32)\n ce_loss = optax.softmax_cross_entropy_with_integer_labels(\n outputs[""token_logits""], outputs[""video_tokens""]\n )\n ce_loss = (mask_BTN * ce_loss).sum() / mask_BTN.sum()\n z_val = jax.nn.logsumexp(outputs[""token_logits""], axis=-1)\n z_loss_metric = (mask_BTN * (z_val**2)).sum() / mask_BTN.sum()\n\n masked_token_top_1_acc = _calculate_top_k_accuracy(\n outputs[""token_logits""], outputs[""video_tokens""], mask_BTN, 1\n )\n masked_token_top_2_acc = _calculate_top_k_accuracy(\n outputs[""token_logits""], outputs[""video_tokens""], mask_BTN, 2\n )\n masked_token_top_5_acc = _calculate_top_k_accuracy(\n outputs[""token_logits""], outputs[""video_tokens""], mask_BTN, 5\n )\n masked_token_top_16_acc = _calculate_top_k_accuracy(\n outputs[""token_logits""], outputs[""video_tokens""], mask_BTN, 16\n )\n\n select_probs = jax.nn.softmax(outputs[""token_logits""])\n gt_val = gt.clip(0, 1).reshape(-1, *gt.shape[2:])\n recon = outputs[""recon""].clip(0, 1).reshape(-1, *outputs[""recon""].shape[2:])\n psnr = jnp.asarray(pix.psnr(gt_val, recon)).mean()\n ssim = jnp.asarray(pix.ssim(gt_val, recon)).mean()\n _, index_counts_tokenizer = jnp.unique_counts(\n jnp.ravel(outputs[""video_tokens""]),\n size=num_patch_latents,\n fill_value=0,\n )\n codebook_usage_tokenizer = (index_counts_tokenizer != 0).mean()\n metrics = dict(\n cross_entropy_loss=ce_loss,\n masked_token_top1_accuracy=masked_token_top_1_acc,\n masked_token_top2_accuracy=masked_token_top_2_acc,\n masked_token_top5_accuracy=masked_token_top_5_acc,\n masked_token_top16_accuracy=masked_token_top_16_acc,\n select_logit=outputs[""token_logits""].max(-1).mean(),\n select_p=select_probs.max(-1).mean(),\n entropy=jax.scipy.special.entr(select_probs).sum(-1).mean(),\n z_loss=z_loss_metric,\n psnr=psnr,\n ssim=ssim,\n codebook_usage_tokenizer=codebook_usage_tokenizer,\n )\n if ""lam_indices"" in outputs.keys():\n _, index_counts_lam = jnp.unique_counts(\n jnp.ravel(outputs[""lam_indices""]),\n size=num_actions,\n fill_value=0,\n )\n codebook_usage_lam = (index_counts_lam != 0).mean()\n metrics[""codebook_usage_lam""] = codebook_usage_lam\n return ce_loss, metrics\n\n\ndef main(args: Args) -> None:\n jax.distributed.initialize()\n num_devices = jax.device_count()\n if num_devices == 0:\n raise ValueError(""No JAX devices found."")\n print(f""Running on {num_devices} devices."")\n\n if args.batch_size % num_devices != 0:\n raise ValueError(\n f""Global batch size {args.batch_size} must be divisible by ""\n f""number of devices {num_devices}.""\n )\n\n rng = jax.random.key(args.seed)\n\n # --- Initialize model ---\n genie, rng = build_model(args, rng)\n _, params, _ = nnx.split(genie, nnx.Param, ...)\n param_counts = count_parameters_by_component(params)\n\n if args.log and jax.process_index() == 0:\n wandb_init_kwargs = {\n ""entity"": args.entity,\n ""project"": args.project,\n ""name"": args.name,\n ""tags"": args.tags,\n ""group"": ""debug"",\n ""config"": args,\n }\n\n if args.wandb_id:\n wandb_init_kwargs.update(\n {\n ""id"": args.wandb_id,\n ""resume"": ""allow"",\n }\n )\n wandb.init(**wandb_init_kwargs)\n\n wandb.config.update({""model_param_count"": param_counts})\n\n print(""Parameter counts:"")\n print(param_counts)\n\n # --- Initialize optimizer ---\n optimizer = build_optimizer(genie, args)\n del genie\n\n # FIXME: switch to create_hybrid_device_mesh for runs spanning multiple nodes\n _, replicated_sharding, videos_sharding, actions_sharding = build_mesh_and_sharding(\n num_devices\n )\n\n shard_optimizer_states(optimizer, replicated_sharding)\n\n # --- Initialize checkpoint manager ---\n checkpoint_manager = build_checkpoint_manager(args)\n\n # --- Create DataLoaderIterator from dataloader ---\n train_iterator = build_dataloader(args, args.data_dir)\n val_iterator = None\n if args.val_data_dir:\n val_iterator = build_dataloader(args, args.val_data_dir)\n\n # --- Restore checkpoint ---\n step, optimizer, train_iterator, val_iterator, rng = (\n restore_or_initialize_components(\n args,\n checkpoint_manager,\n optimizer,\n train_iterator,\n rng,\n replicated_sharding,\n val_iterator,\n )\n )\n\n # --- Define loss and train step (close over args) ---\n def dynamics_loss_fn(\n model: Genie,\n inputs: dict,\n ) -> tuple[jax.Array, tuple[jax.Array, dict]]:\n gt = jnp.asarray(inputs[""videos""], dtype=jnp.float32) / 255.0\n inputs[""videos""] = gt.astype(args.dtype)\n outputs = model(inputs)\n ce_loss, metrics = _calculate_step_metrics(\n outputs, gt, args.num_actions, args.num_patch_latents\n )\n z_loss = metrics[""z_loss""]\n total_loss = ce_loss + args.z_loss_weight * z_loss\n metrics[""total_loss""] = total_loss\n return total_loss, (outputs[""recon""], metrics)\n\n @nnx.jit(donate_argnums=0)\n def train_step(\n optimizer: nnx.ModelAndOptimizer, inputs: dict\n ) -> tuple[jax.Array, jax.Array, dict]:\n def loss_fn(model: Genie) -> tuple[jax.Array, tuple[jax.Array, dict]]:\n model.train()\n return dynamics_loss_fn(model, inputs)\n\n (loss, (recon, metrics)), grads = nnx.value_and_grad(loss_fn, has_aux=True)(\n optimizer.model\n )\n optimizer.update(grads)\n if args.log_gradients:\n metrics[""gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""dynamics""]\n )\n return loss, recon, metrics\n\n @nnx.jit\n def val_step(genie: Genie, inputs: dict) -> dict:\n """"""Evaluate model and compute metrics""""""\n genie.eval()\n gt = jnp.asarray(inputs[""videos""], dtype=jnp.float32) / 255.0\n (loss, (recon, metrics)) = dynamics_loss_fn(genie, inputs)\n val_output = {""loss"": loss, ""recon"": recon, ""metrics"": metrics}\n\n # --- Evaluate full frame prediction (sampling) ---\n if args.eval_full_frame:\n inputs[""videos""] = gt.astype(args.dtype)\n tokenizer_outputs = genie.tokenizer.vq_encode(\n inputs[""videos""], training=False\n )\n tokens_full_frame = tokenizer_outputs[""indices""]\n lam_indices_E = None\n if not args.use_gt_actions:\n lam_indices_E = genie.vq_encode(inputs, training=False)\n inputs[""latent_actions""] = lam_indices_E\n inputs[""videos""] = inputs[""videos""][\n :, :-1\n ] # remove last frame for generation\n recon_full_frame, logits_full_frame = genie.sample(\n inputs,\n args.seq_len,\n args.val_temperature,\n args.val_sample_argmax,\n args.val_maskgit_steps,\n )\n # Calculate metrics for the last frame only\n step_outputs = {\n ""recon"": recon_full_frame[:, -1],\n ""token_logits"": logits_full_frame[:, -1],\n ""video_tokens"": tokens_full_frame[:, -1],\n ""mask"": jnp.ones_like(tokens_full_frame[:, -1]),\n }\n if lam_indices_E is not None:\n lam_indices_B = lam_indices_E.reshape((-1, args.seq_len - 1))[:, -1]\n step_outputs[""lam_indices""] = lam_indices_B\n\n loss_full_frame, metrics_full_frame = _calculate_step_metrics(\n step_outputs, gt[:, -1], args.num_actions, args.num_patch_latents\n )\n val_output.update(\n {\n ""loss_full_frame"": loss_full_frame,\n ""recon_full_frame"": recon_full_frame,\n ""metrics_full_frame"": metrics_full_frame,\n }\n )\n return val_output\n\n def calculate_validation_metrics(val_dataloader, genie, rng):\n step = 0\n loss_per_step = []\n metrics_per_step = []\n loss_full_frame_per_step = []\n metrics_full_frame_per_step = []\n batch = None\n recon = None\n recon_full_frame = None\n for batch in val_dataloader:\n rng, _rng_mask = jax.random.split(rng, 2)\n batch[""rng""] = _rng_mask\n val_outputs = val_step(genie, batch)\n loss_per_step.append(val_outputs[""loss""])\n metrics_per_step.append(val_outputs[""metrics""])\n recon = val_outputs[""recon""]\n if args.eval_full_frame:\n loss_full_frame_per_step.append(val_outputs[""loss_full_frame""])\n metrics_full_frame_per_step.append(val_outputs[""metrics_full_frame""])\n recon_full_frame = val_outputs[""recon_full_frame""]\n step += 1\n if step > args.val_steps:\n break\n\n if step < args.val_steps:\n print(\n f""Warning: Your validation dataset is too small to make val_steps many steps. Made {step} steps, expected {args.val_steps}""\n )\n\n val_metrics = {\n f""val_{key}"": np.mean([float(m[key]) for m in metrics_per_step])\n for key in metrics_per_step[0].keys()\n }\n val_metrics[""val_loss""] = np.mean(loss_per_step)\n if args.eval_full_frame:\n val_metrics_full_frame = {\n f""val_full_frame_{key}"": np.mean(\n [float(m[key]) for m in metrics_full_frame_per_step]\n )\n for key in metrics_full_frame_per_step[0].keys()\n }\n val_metrics.update(val_metrics_full_frame)\n val_metrics[""val_full_frame_loss""] = np.mean(loss_full_frame_per_step)\n return val_metrics, batch, recon, recon_full_frame\n\n # --- TRAIN LOOP ---\n dataloader_train = (\n {\n ""videos"": jax.make_array_from_process_local_data(\n videos_sharding, local_data=elem[""videos""]\n ),\n ""actions"": (\n jax.make_array_from_process_local_data(\n actions_sharding, elem[""actions""]\n )\n if args.use_gt_actions\n else None\n ),\n }\n for elem in train_iterator\n )\n dataloader_val = None\n if val_iterator:\n dataloader_val = (\n {\n ""videos"": jax.make_array_from_process_local_data(\n videos_sharding, elem[""videos""]\n ),\n ""actions"": (\n jax.make_array_from_process_local_data(\n actions_sharding, elem[""actions""]\n )\n if args.use_gt_actions\n else None\n ),\n }\n for elem in val_iterator\n )\n if jax.process_index() == 0:\n first_batch = next(dataloader_train)\n first_batch[""rng""] = rng # type: ignore\n compiled = train_step.lower(optimizer, first_batch).compile()\n print_compiled_memory_stats(compiled.memory_analysis())\n print_compiled_cost_analysis(compiled.cost_analysis())\n # Do not skip the first batch during training\n dataloader_train = itertools.chain([first_batch], dataloader_train)\n print(f""Starting training from step {step}..."")\n first_step = step\n while step < args.num_steps:\n for batch in dataloader_train:\n # --- Train step ---\n rng, _rng_mask = jax.random.split(rng, 2)\n batch[""rng""] = _rng_mask\n loss, recon, metrics = train_step(optimizer, batch)\n if step == first_step:\n print_mem_stats(""After params initialized"")\n step += 1\n\n # --- Validation loss ---\n val_results = {}\n if dataloader_val and step % args.val_interval == 0:\n rng, _rng_mask_val = jax.random.split(rng, 2)\n print(""Calculating validation metrics..."")\n val_metrics, val_gt_batch, val_recon, val_recon_full_frame = (\n calculate_validation_metrics(\n dataloader_val, optimizer.model, _rng_mask_val\n )\n )\n print(f""Step {step}, validation loss: {val_metrics['val_loss']}"")\n val_results = {\n ""metrics"": val_metrics,\n ""gt_batch"": val_gt_batch,\n ""recon"": val_recon,\n ""full_frame"": val_recon_full_frame,\n }\n\n # --- Logging ---\n if args.log:\n if step % args.log_interval == 0 and jax.process_index() == 0:\n log_dict = {""loss"": loss, ""step"": step, **metrics}\n if val_results:\n log_dict.update(val_results[""metrics""])\n wandb.log(log_dict)\n if step % args.log_image_interval == 0:\n gt_seq = batch[""videos""][0].astype(jnp.float32) / 255.0\n recon_seq = recon[0].clip(0, 1)\n comparison_seq = jnp.concatenate((gt_seq, recon_seq), axis=1)\n comparison_seq = einops.rearrange(\n comparison_seq * 255, ""t h w c -> h (t w) c""\n )\n if val_results:\n val_results[""gt_seq_val""] = (\n val_results[""gt_batch""][""videos""][0].astype(jnp.float32)\n / 255.0\n )\n val_results[""recon_seq_val""] = val_results[""recon""][0].clip(\n 0, 1\n )\n val_comparison_seq = jnp.concatenate(\n (val_results[""gt_seq_val""], val_results[""recon_seq_val""]),\n axis=1,\n )\n val_results[""val_comparison_seq""] = einops.rearrange(\n val_comparison_seq * 255, ""t h w c -> h (t w) c""\n )\n if args.eval_full_frame:\n val_results[""full_frame_seq_val""] = val_results[\n ""full_frame""\n ][0].clip(0, 1)\n val_results[""val_full_frame_comparison_seq""] = (\n jnp.concatenate(\n (\n val_results[""gt_seq_val""],\n val_results[""full_frame_seq_val""],\n ),\n axis=1,\n )\n )\n val_results[""val_full_frame_comparison_seq""] = (\n einops.rearrange(\n val_results[""val_full_frame_comparison_seq""] * 255,\n ""t h w c -> h (t w) c"",\n )\n )\n # NOTE: Process-dependent control flow deliberately happens\n # after indexing operation since it must not contain code\n # sections that lead to cross-accelerator communication.\n if jax.process_index() == 0:\n log_images = dict(\n image=wandb.Image(np.asarray(gt_seq[args.seq_len - 1])),\n recon=wandb.Image(np.asarray(recon_seq[args.seq_len - 1])),\n true_vs_recon=wandb.Image(\n np.asarray(comparison_seq.astype(np.uint8))\n ),\n )\n if val_results:\n log_images.update(\n dict(\n val_image=wandb.Image(\n np.asarray(\n val_results[""gt_seq_val""][args.seq_len - 1]\n )\n ),\n val_recon=wandb.Image(\n np.asarray(\n val_results[""recon_seq_val""][\n args.seq_len - 1\n ]\n )\n ),\n val_true_vs_recon=wandb.Image(\n np.asarray(\n val_results[""val_comparison_seq""].astype(\n np.uint8\n )\n )\n ),\n )\n )\n if args.eval_full_frame:\n log_images.update(\n dict(\n val_full_frame=wandb.Image(\n np.asarray(\n val_results[""full_frame_seq_val""][\n args.seq_len - 1\n ]\n )\n ),\n val_true_vs_full_frame=wandb.Image(\n np.asarray(\n val_results[\n ""val_full_frame_comparison_seq""\n ].astype(np.uint8)\n )\n ),\n )\n )\n wandb.log(log_images)\n # --- Checkpointing ---\n if args.save_ckpt and step % args.log_checkpoint_interval == 0:\n assert checkpoint_manager is not None\n optimizer_state = nnx.state(optimizer)\n if val_iterator:\n ckpt_manager_args = ocp.args.Composite(\n model_state=ocp.args.PyTreeSave(optimizer_state), # type: ignore\n train_dataloader_state=grain.checkpoint.CheckpointSave( # type: ignore\n train_iterator # type: ignore\n ),\n val_dataloader_state=grain.checkpoint.CheckpointSave( # type: ignore\n val_iterator # type: ignore\n ),\n )\n else:\n ckpt_manager_args = ocp.args.Composite(\n model_state=ocp.args.PyTreeSave(optimizer_state), # type: ignore\n train_dataloader_state=grain.checkpoint.CheckpointSave( # type: ignore\n train_iterator # type: ignore\n ),\n )\n checkpoint_manager.save(step, args=ckpt_manager_args)\n print(f""Saved checkpoint at step {step}"")\n if step >= args.num_steps:\n break\n\n if checkpoint_manager:\n checkpoint_manager.close()\n\n\nif __name__ == ""__main__"":\n args = tyro.cli(Args)\n main(args)\n",python,tab
8
+ 7,9153,"jasmine/train_dynamics.py",2715,0,"",python,selection_keyboard
9
+ 8,10597,"jasmine/train_dynamics.py",2684,0,"",python,selection_command
10
+ 9,10854,"jasmine/train_dynamics.py",2657,0,"",python,selection_command
11
+ 10,10874,"jasmine/train_dynamics.py",2625,0,"",python,selection_command
12
+ 11,10905,"jasmine/train_dynamics.py",2580,0,"",python,selection_command
13
+ 12,10943,"jasmine/train_dynamics.py",2540,0,"",python,selection_command
14
+ 13,10981,"jasmine/train_dynamics.py",2517,0,"",python,selection_command
15
+ 14,11010,"jasmine/train_dynamics.py",2482,0,"",python,selection_command
16
+ 15,11042,"jasmine/train_dynamics.py",2455,0,"",python,selection_command
17
+ 16,11077,"jasmine/train_dynamics.py",2389,0,"",python,selection_command
18
+ 17,11110,"jasmine/train_dynamics.py",2356,0,"",python,selection_command
19
+ 18,11143,"jasmine/train_dynamics.py",2334,0,"",python,selection_command
20
+ 19,11182,"jasmine/train_dynamics.py",2313,0,"",python,selection_command
21
+ 20,11216,"jasmine/train_dynamics.py",2292,0,"",python,selection_command
22
+ 21,11250,"jasmine/train_dynamics.py",2276,0,"",python,selection_command
23
+ 22,11283,"jasmine/train_dynamics.py",2245,0,"",python,selection_command
24
+ 23,11324,"jasmine/train_dynamics.py",2208,0,"",python,selection_command
25
+ 24,11355,"jasmine/train_dynamics.py",2183,0,"",python,selection_command
26
+ 25,11380,"jasmine/train_dynamics.py",2153,0,"",python,selection_command
27
+ 26,11416,"jasmine/train_dynamics.py",2122,0,"",python,selection_command
28
+ 27,11449,"jasmine/train_dynamics.py",2094,0,"",python,selection_command
29
+ 28,11482,"jasmine/train_dynamics.py",2069,0,"",python,selection_command
30
+ 29,11515,"jasmine/train_dynamics.py",2041,0,"",python,selection_command
31
+ 30,11548,"jasmine/train_dynamics.py",2012,0,"",python,selection_command
32
+ 31,11581,"jasmine/train_dynamics.py",1983,0,"",python,selection_command
33
+ 32,11768,"jasmine/train_dynamics.py",1959,0,"",python,selection_command
34
+ 33,12054,"jasmine/train_dynamics.py",1983,0,"",python,selection_command
35
+ 34,12391,"TERMINAL",0,0,"",,terminal_command
36
+ 35,15319,"jasmine/train_dynamics.py",2012,0,"",python,selection_command
37
+ 36,19851,"slurm/jobs/franz/berlin/coinrun/mila_submission/coinrun_dynamics_base.sh",0,0,"",shellscript,tab
38
+ 37,37071,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_ffn_dim_ablation.sh",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=1\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:1\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=dynamics_coinrun_mila_submission_ffn_dim_ablation\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nsource .venv/bin/activate\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""coinrun dynamics 500m_dataset mila_submission ffn_dim ablation""\n\narray_records_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_500m_seed_w_increment""\ntokenizer_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/tokenizer_coinrun_mila_submission_29736/""\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\nenv | grep SLURM\n\n\nsrun python jasmine/train_dynamics.py \\n --dyna_ffn_dim=512 \\n --dyna_num_blocks=12 \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --val_data_dir=""${array_records_dir}/val"" \\n --data_dir=""${array_records_dir}/train"" &\n\nchild_pid=$!\n\nwait $child_pid\n\n",shellscript,tab
39
+ 38,37071,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_ffn_dim_ablation.sh",327,0,"",shellscript,selection_command
40
+ 39,47272,"slurm/jobs/franz/berlin/coinrun/mila_submission/coinrun_dynamics_base.sh",0,0,"",shellscript,tab
41
+ 40,65119,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_gt_actions.sh",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=1\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:1\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=dynamics_coinrun_mila_submission_gt_actions\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nsource .venv/bin/activate\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""coinrun dynamics 500m_dataset mila_submission ablation gt-actions""\n\narray_records_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_500m_seed_w_increment""\ntokenizer_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/tokenizer_coinrun_mila_submission_29736/""\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\nenv | grep SLURM\n\n\nsrun python jasmine/train_dynamics.py \\n --use_gt_actions \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --val_data_dir=""${array_records_dir}/val"" \\n --data_dir=""${array_records_dir}/train"" &\n\nchild_pid=$!\n\nwait $child_pid\n\n",shellscript,tab
42
+ 41,65119,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_gt_actions.sh",327,0,"",shellscript,selection_command
43
+ 42,86599,"slurm/jobs/franz/berlin/coinrun/mila_submission/coinrun_dynamics_base.sh",0,0,"",shellscript,tab
44
+ 43,102914,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=1\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:1\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=dynamics_coinrun_mila_submission_no_cotraining\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nsource .venv/bin/activate\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""coinrun dynamics 500m_dataset mila_submission ablation no-cotraining""\n\narray_records_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_500m_seed_w_increment""\ntokenizer_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/tokenizer_coinrun_mila_submission_29736/""\nlam_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\nenv | grep SLURM\n\n\nsrun python jasmine/train_dynamics.py \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --lam_checkpoint=""${lam_ckpt_dir}"" \\n --val_data_dir=""${array_records_dir}/val"" \\n --data_dir=""${array_records_dir}/train"" &\n\nchild_pid=$!\n\nwait $child_pid\n\n",shellscript,tab
45
+ 44,102914,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",327,0,"",shellscript,selection_command
46
+ 45,120688,"TERMINAL",0,0,"",,terminal_command
47
+ 46,150133,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1589,0,"",shellscript,selection_mouse
48
+ 47,150296,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1569,52,"lam_coinrun_mila_submission_no_flash_attention_29738",shellscript,selection_mouse
49
+ 48,152996,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1592,0,"",shellscript,selection_mouse
50
+ 49,161928,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,0,"",shellscript,selection_command
51
+ 50,163313,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
52
+ 51,166199,"TERMINAL",0,0,"",,terminal_focus
53
+ 52,166200,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",0,0,"",shellscript,tab
54
+ 53,166650,"TERMINAL",0,0,"source /home/franz.srambical/jafar/data/.venv/bin/activate",,terminal_command
55
+ 54,166653,"TERMINAL",0,0,"]633;C]0;franz.srambical@hai-login2:~/jafar",,terminal_output
56
+ 55,169210,"TERMINAL",0,0,"ls git config pull.rebase false",,terminal_command
57
+ 56,169216,"TERMINAL",0,0,"]633;Cls: cannot access 'git': No such file or directory\r\nls: cannot access 'config': No such file or directory\r\nls: cannot access 'pull.rebase': No such file or directory\r\nls: cannot access 'false': No such file or directory\r\n]0;franz.srambical@hai-login2:~/jafar",,terminal_output
58
+ 57,174674,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1503,0,"",shellscript,selection_command
59
+ 58,175597,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1506,0,"",shellscript,selection_command
60
+ 59,176305,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,0,"",shellscript,selection_command
61
+ 60,176579,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,1,"/",shellscript,selection_command
62
+ 61,176653,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,5,"/fast",shellscript,selection_command
63
+ 62,176806,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,6,"/fast/",shellscript,selection_command
64
+ 63,177060,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,13,"/fast/project",shellscript,selection_command
65
+ 64,177084,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,14,"/fast/project/",shellscript,selection_command
66
+ 65,177116,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,30,"/fast/project/HFMI_SynergyUnit",shellscript,selection_command
67
+ 66,177149,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,31,"/fast/project/HFMI_SynergyUnit/",shellscript,selection_command
68
+ 67,177182,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,39,"/fast/project/HFMI_SynergyUnit/jafar_ws",shellscript,selection_command
69
+ 68,177215,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,40,"/fast/project/HFMI_SynergyUnit/jafar_ws/",shellscript,selection_command
70
+ 69,177248,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,51,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints",shellscript,selection_command
71
+ 70,177284,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,52,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/",shellscript,selection_command
72
+ 71,177317,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,59,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun",shellscript,selection_command
73
+ 72,177350,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,60,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/",shellscript,selection_command
74
+ 73,177382,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,63,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam",shellscript,selection_command
75
+ 74,177416,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,64,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/",shellscript,selection_command
76
+ 75,177450,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,116,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738",shellscript,selection_command
77
+ 76,177482,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,118,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""",shellscript,selection_command
78
+ 77,177537,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,133,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR",shellscript,selection_command
79
+ 78,177566,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,136,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/",shellscript,selection_command
80
+ 79,177584,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,140,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/fast",shellscript,selection_command
81
+ 80,177616,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,141,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/fast/",shellscript,selection_command
82
+ 81,177648,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,148,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/fast/project",shellscript,selection_command
83
+ 82,177682,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,149,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/fast/project/",shellscript,selection_command
84
+ 83,178848,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,142,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/fast/p",shellscript,selection_command
85
+ 84,179043,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,141,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/fast/",shellscript,selection_command
86
+ 85,179193,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,137,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=""/f",shellscript,selection_command
87
+ 86,179354,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,134,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nCHECKPOINT_DIR=",shellscript,selection_command
88
+ 87,179519,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,120,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/""\nC",shellscript,selection_command
89
+ 88,179741,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1505,117,"/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/",shellscript,selection_command
90
+ 89,181597,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_cotraining.sh",1621,0,"",shellscript,selection_command
91
+ 90,186247,"TERMINAL",0,0,"ls /fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/lam_coinrun_mila_submission_no_flash_attention_29738/",,terminal_command
92
+ 91,186254,"TERMINAL",0,0,"]633;C020000 040000 060000 080000 100000 120000 125000 130000\r\n]0;franz.srambical@hai-login2:~/jafar",,terminal_output
93
+ 92,215171,"slurm/jobs/franz/berlin/coinrun/mila_submission/coinrun_dynamics_base.sh",0,0,"",shellscript,tab
94
+ 93,303649,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_causal.sh",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=1\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:1\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=dynamics_coinrun_mila_submission_causal\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nsource .venv/bin/activate\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""coinrun dynamics 500m_dataset mila_submission ablation causal""\n\narray_records_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_500m_seed_w_increment""\ntokenizer_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/tokenizer_coinrun_mila_submission_29736/""\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\nenv | grep SLURM\n\n\nsrun python jasmine/train_dynamics.py \\n --dyna_type=causal \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --val_data_dir=""${array_records_dir}/val"" \\n --data_dir=""${array_records_dir}/train"" &\n\nchild_pid=$!\n\nwait $child_pid\n\n",shellscript,tab
95
+ 94,303649,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_causal.sh",327,0,"",shellscript,selection_command
96
+ 95,345729,"slurm/jobs/franz/berlin/coinrun/mila_submission/coinrun_dynamics_base.sh",0,0,"",shellscript,tab
97
+ 96,366925,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_flash_attn.sh",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=1\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:1\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=dynamics_coinrun_mila_submission_no_flash_attn\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nsource .venv/bin/activate\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""coinrun dynamics 500m_dataset mila_submission ablation no-flash-attn""\n\narray_records_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_500m_seed_w_increment""\ntokenizer_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/tokenizer_coinrun_mila_submission_29736/""\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\nenv | grep SLURM\n\n\nsrun python jasmine/train_dynamics.py \\n --no-use-flash-attention \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --val_data_dir=""${array_records_dir}/val"" \\n --data_dir=""${array_records_dir}/train"" &\n\nchild_pid=$!\n\nwait $child_pid\n\n",shellscript,tab
98
+ 97,366925,"slurm/jobs/franz/berlin/coinrun/mila_submission/ablations/coinrun_dynamics_no_flash_attn.sh",327,0,"",shellscript,selection_command
99
+ 98,380348,"slurm/jobs/franz/berlin/coinrun/mila_submission/coinrun_dynamics_base.sh",0,0,"",shellscript,tab
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-2a87081d-a5f9-4067-a052-9f108ae0c2231755784831268-2025_08_21-16.00.38.105/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-2bf72b78-b5bd-4a14-b5d7-02cc594280a51763370541260-2025_11_17-10.09.08.462/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-2cea4f45-eb3d-4d39-8263-124201da2dc81763721698838-2025_11_21-11.41.41.686/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-32eb2334-bfbd-495b-9cfb-5985f2c45d901767713398872-2026_01_06-16.30.01.925/source.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 2,167,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"4:30:01 PM [info] Activating crowd-code\n4:30:01 PM [info] Recording started\n4:30:01 PM [info] Initializing git provider using file system watchers...\n4:30:01 PM [info] No workspace folder found\n",Log,tab
3
+ 3,2090,"extension-output-pdoom-org.crowd-code-#1-crowd-code",194,0,"4:30:03 PM [info] Retrying git provider initialization...\n4:30:03 PM [info] No workspace folder found\n",Log,content
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-39365de8-ec00-40b2-9194-9ae0d3b35fa01764869495182-2025_12_04-18.31.43.123/source.csv ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,196,"Untitled-1",0,0,"",plaintext,tab
3
+ 2,387,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"6:31:43 PM [info] Activating crowd-code\n6:31:43 PM [info] Recording started\n6:31:43 PM [info] Initializing git provider using file system watchers...\n6:31:43 PM [info] No workspace folder found\n",Log,tab
4
+ 3,1946,"Untitled-1",0,0,"",plaintext,tab
5
+ 4,13682,"Untitled-1",0,0,"""",plaintext,content
6
+ 5,13685,"Untitled-1",1,0,"",plaintext,selection_keyboard
7
+ 6,13795,"Untitled-1",1,0,"""",plaintext,content
8
+ 7,13796,"Untitled-1",2,0,"",plaintext,selection_keyboard
9
+ 8,13937,"Untitled-1",2,0,"""",plaintext,content
10
+ 9,13939,"Untitled-1",3,0,"",plaintext,selection_keyboard
11
+ 10,15888,"Untitled-1",3,0,"""",plaintext,content
12
+ 11,15890,"Untitled-1",4,0,"",plaintext,selection_keyboard
13
+ 12,16189,"Untitled-1",4,0,"""",plaintext,content
14
+ 13,16191,"Untitled-1",5,0,"",plaintext,selection_keyboard
15
+ 14,16222,"Untitled-1",5,0,"""",plaintext,content
16
+ 15,16223,"Untitled-1",6,0,"",plaintext,selection_keyboard
17
+ 16,16558,"Untitled-1",5,0,"",plaintext,selection_command
18
+ 17,16664,"Untitled-1",4,0,"",plaintext,selection_command
19
+ 18,16873,"Untitled-1",3,0,"",plaintext,selection_command
20
+ 19,56341,"Untitled-1",3,0,"h",plaintext,content
21
+ 20,56343,"Untitled-1",4,0,"",plaintext,selection_keyboard
22
+ 21,56417,"Untitled-1",4,0,"e",plaintext,content
23
+ 22,56418,"Untitled-1",5,0,"",plaintext,selection_keyboard
24
+ 23,56568,"Untitled-1",5,0,"l",plaintext,content
25
+ 24,56570,"Untitled-1",6,0,"",plaintext,selection_keyboard
26
+ 25,56718,"Untitled-1",6,0,"l",plaintext,content
27
+ 26,56720,"Untitled-1",7,0,"",plaintext,selection_keyboard
28
+ 27,56807,"Untitled-1",7,0,"o",plaintext,content
29
+ 28,56808,"Untitled-1",8,0,"",plaintext,selection_keyboard
30
+ 29,56995,"Untitled-1",8,0," ",plaintext,content
31
+ 30,56997,"Untitled-1",9,0,"",plaintext,selection_keyboard
32
+ 31,56999,"Untitled-1",9,0,"w",plaintext,content
33
+ 32,57000,"Untitled-1",10,0,"",plaintext,selection_keyboard
34
+ 33,57066,"Untitled-1",10,0,"o",plaintext,content
35
+ 34,57068,"Untitled-1",11,0,"",plaintext,selection_keyboard
36
+ 35,57127,"Untitled-1",11,0,"r",plaintext,content
37
+ 36,57129,"Untitled-1",12,0,"",plaintext,selection_keyboard
38
+ 37,57355,"Untitled-1",12,0,"l",plaintext,content
39
+ 38,57356,"Untitled-1",13,0,"",plaintext,selection_keyboard
40
+ 39,57418,"Untitled-1",13,0,"d",plaintext,content
41
+ 40,57420,"Untitled-1",14,0,"",plaintext,selection_keyboard
42
+ 41,57495,"Untitled-1",14,0," ",plaintext,content
43
+ 42,57497,"Untitled-1",15,0,"",plaintext,selection_keyboard
44
+ 43,57605,"Untitled-1",15,0,"f",plaintext,content
45
+ 44,57606,"Untitled-1",16,0,"",plaintext,selection_keyboard
46
+ 45,57608,"Untitled-1",16,0,"u",plaintext,content
47
+ 46,57609,"Untitled-1",17,0,"",plaintext,selection_keyboard
48
+ 47,57673,"Untitled-1",17,0,"c",plaintext,content
49
+ 48,57674,"Untitled-1",18,0,"",plaintext,selection_keyboard
50
+ 49,57760,"Untitled-1",18,0,"n",plaintext,content
51
+ 50,57761,"Untitled-1",19,0,"",plaintext,selection_keyboard
52
+ 51,57913,"Untitled-1",19,0,"t",plaintext,content
53
+ 52,57915,"Untitled-1",20,0,"",plaintext,selection_keyboard
54
+ 53,58008,"Untitled-1",20,0,"i",plaintext,content
55
+ 54,58010,"Untitled-1",21,0,"",plaintext,selection_keyboard
56
+ 55,58049,"Untitled-1",21,0,"o",plaintext,content
57
+ 56,58051,"Untitled-1",22,0,"",plaintext,selection_keyboard
58
+ 57,58091,"Untitled-1",22,0,"n",plaintext,content
59
+ 58,58093,"Untitled-1",23,0,"",plaintext,selection_keyboard
60
+ 59,58397,"Untitled-1",22,1,"",plaintext,content
61
+ 60,58543,"Untitled-1",21,1,"",plaintext,content
62
+ 61,58678,"Untitled-1",20,1,"",plaintext,content
63
+ 62,58810,"Untitled-1",19,1,"",plaintext,content
64
+ 63,58957,"Untitled-1",18,1,"",plaintext,content
65
+ 64,59159,"Untitled-1",17,1,"",plaintext,content
66
+ 65,59272,"Untitled-1",17,0,"n",plaintext,content
67
+ 66,59273,"Untitled-1",18,0,"",plaintext,selection_keyboard
68
+ 67,59345,"Untitled-1",18,0,"c",plaintext,content
69
+ 68,59346,"Untitled-1",19,0,"",plaintext,selection_keyboard
70
+ 69,59542,"Untitled-1",19,0,"t",plaintext,content
71
+ 70,59543,"Untitled-1",20,0,"",plaintext,selection_keyboard
72
+ 71,59545,"Untitled-1",20,0,"i",plaintext,content
73
+ 72,59546,"Untitled-1",21,0,"",plaintext,selection_keyboard
74
+ 73,59590,"Untitled-1",21,0,"o",plaintext,content
75
+ 74,59591,"Untitled-1",22,0,"",plaintext,selection_keyboard
76
+ 75,59611,"Untitled-1",22,0,"n",plaintext,content
77
+ 76,59612,"Untitled-1",23,0,"",plaintext,selection_keyboard
78
+ 77,60212,"Untitled-1",23,0,"o",plaintext,content
79
+ 78,60214,"Untitled-1",24,0,"",plaintext,selection_keyboard
80
+ 79,60690,"Untitled-1",23,1,"",plaintext,content
81
+ 80,60834,"Untitled-1",22,0,"",plaintext,selection_command
82
+ 81,60897,"Untitled-1",26,0,"\n",plaintext,content
83
+ 82,64797,"Untitled-1",27,0,"d",plaintext,content
84
+ 83,64799,"Untitled-1",28,0,"",plaintext,selection_keyboard
85
+ 84,64880,"Untitled-1",28,0,"e",plaintext,content
86
+ 85,64882,"Untitled-1",29,0,"",plaintext,selection_keyboard
87
+ 86,65131,"Untitled-1",29,0,"f",plaintext,content
88
+ 87,65132,"Untitled-1",30,0,"",plaintext,selection_keyboard
89
+ 88,65162,"Untitled-1",30,0," ",plaintext,content
90
+ 89,65164,"Untitled-1",31,0,"",plaintext,selection_keyboard
91
+ 90,65237,"Untitled-1",31,0,"h",plaintext,content
92
+ 91,65239,"Untitled-1",32,0,"",plaintext,selection_keyboard
93
+ 92,65311,"Untitled-1",32,0,"e",plaintext,content
94
+ 93,65313,"Untitled-1",33,0,"",plaintext,selection_keyboard
95
+ 94,65486,"Untitled-1",33,0,"l",plaintext,content
96
+ 95,65488,"Untitled-1",34,0,"",plaintext,selection_keyboard
97
+ 96,65595,"Untitled-1",34,0,"l",plaintext,content
98
+ 97,65596,"Untitled-1",35,0,"",plaintext,selection_keyboard
99
+ 98,65687,"Untitled-1",35,0,"o",plaintext,content
100
+ 99,65688,"Untitled-1",36,0,"",plaintext,selection_keyboard
101
+ 100,65992,"Untitled-1",36,0,"_",plaintext,content
102
+ 101,65993,"Untitled-1",37,0,"",plaintext,selection_keyboard
103
+ 102,66126,"Untitled-1",37,0,"w",plaintext,content
104
+ 103,66128,"Untitled-1",38,0,"",plaintext,selection_keyboard
105
+ 104,66258,"Untitled-1",38,0,"o",plaintext,content
106
+ 105,66259,"Untitled-1",39,0,"",plaintext,selection_keyboard
107
+ 106,66341,"Untitled-1",39,0,"r",plaintext,content
108
+ 107,66342,"Untitled-1",40,0,"",plaintext,selection_keyboard
109
+ 108,66519,"Untitled-1",40,0,"l",plaintext,content
110
+ 109,66520,"Untitled-1",41,0,"",plaintext,selection_keyboard
111
+ 110,66604,"Untitled-1",41,0,"d",plaintext,content
112
+ 111,66606,"Untitled-1",42,0,"",plaintext,selection_keyboard
113
+ 112,66818,"Untitled-1",42,0,"()",plaintext,content
114
+ 113,66819,"Untitled-1",43,0,"",plaintext,selection_keyboard
115
+ 114,66919,"Untitled-1",43,1,")",plaintext,content
116
+ 115,66921,"Untitled-1",44,0,"",plaintext,selection_keyboard
117
+ 116,67293,"Untitled-1",43,0,"",plaintext,selection_command
118
+ 117,70021,"Untitled-1",44,0,"",plaintext,selection_command
119
+ 118,70372,"Untitled-1",43,0,"",plaintext,selection_command
120
+ 119,70556,"Untitled-1",42,0,"",plaintext,selection_command
121
+ 120,72258,"Untitled-1",28,0,"",plaintext,selection_command
122
+ 121,73950,"Untitled-1",43,0,"",plaintext,selection_command
123
+ 122,74250,"Untitled-1",44,0,"",plaintext,selection_command
124
+ 123,75217,"Untitled-1",44,0,":",plaintext,content
125
+ 124,75219,"Untitled-1",45,0,"",plaintext,selection_keyboard
126
+ 125,75425,"Untitled-1",45,0,"\n",plaintext,content
127
+ 126,81634,"Untitled-1",46,0," ",plaintext,content
128
+ 127,103333,"Untitled-1",46,4,"",plaintext,content
129
+ 128,103334,"Untitled-1",46,0," print(""Hello, world!"")\n",plaintext,content
130
+ 129,108419,"Untitled-1",72,1,"",plaintext,content
131
+ 130,108567,"Untitled-1",71,0,"",plaintext,selection_command
132
+ 131,108825,"Untitled-1",69,0,"",plaintext,selection_command
133
+ 132,108977,"Untitled-1",64,0,"",plaintext,selection_command
134
+ 133,109598,"Untitled-1",57,13,"",plaintext,content
135
+ 134,112004,"Untitled-1",56,0,"",plaintext,selection_command
136
+ 135,112199,"Untitled-1",55,0,"",plaintext,selection_command
137
+ 136,112501,"Untitled-1",56,0,"",plaintext,selection_command
138
+ 137,112701,"Untitled-1",57,0,"",plaintext,selection_command
139
+ 138,113772,"Untitled-1",56,0,"",plaintext,selection_command
140
+ 139,113934,"Untitled-1",55,0,"",plaintext,selection_command
141
+ 140,114255,"Untitled-1",56,0,"",plaintext,selection_command
142
+ 141,114411,"Untitled-1",57,0,"",plaintext,selection_command
143
+ 142,115622,"Untitled-1",57,0," ",plaintext,content
144
+ 143,115624,"Untitled-1",58,0,"",plaintext,selection_keyboard
145
+ 144,115725,"Untitled-1",57,1,"",plaintext,content
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-3a117968-9cd5-4e01-83d9-233e653a8de81765444078704-2025_12_11-10.08.05.362/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-3acd2db0-3113-49b5-8e71-f9e9af4b68f71755936119596-2025_08_23-10.02.09.940/source.csv ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,3,"MaxText/max_utils.py",0,0,"# Copyright 2023–2025 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the ""License"");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an ""AS IS"" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n"""""" Common Max Utils needed by multiple modules.\nAll the functions include MaxText modules, such as Pyconfig, should be moved to MaxText utils file.""""""\n\nimport functools\nimport time\nimport os\nimport socket\nimport subprocess\nimport collections\nfrom collections.abc import Sequence\nfrom typing import Any\nfrom functools import partial\n\nimport numpy as np\n\nimport jax\nimport jax.numpy as jnp\nfrom jax.experimental import mesh_utils\n\nimport flax\n\nimport psutil\n\nfrom etils import epath\n\nimport orbax.checkpoint as ocp\n\nfrom tensorboardX import writer\n\nfrom MaxText import max_logging\n\n\nHYBRID_RING_64X4 = ""hybrid_ring_64x4""\nHYBRID_RING_32X8 = ""hybrid_ring_32x8""\n\n# pylint: disable=too-many-positional-arguments\n\n\ndef with_memory_kind(t, memory_kind):\n return jax.tree_util.tree_map(lambda x: x.with_memory_kind(kind=memory_kind), t)\n\n\ndef cast_dtype_from_to(nest, src, dst):\n """"""All items in nest with dtype src are casted to dtype dst.""""""\n return jax.tree_util.tree_map(lambda t: t.astype(dst) if t.dtype == src else t, nest)\n\n\ndef find_nans_and_infs(pytree):\n def finder(x):\n return jnp.any(jnp.isinf(x) | jnp.isnan(x))\n\n bad_pytree = jax.tree_util.tree_map(finder, pytree)\n return jax.tree_util.tree_flatten(bad_pytree)\n\n\ndef l2norm_pytree(x):\n """"""L2 norm of a pytree of arrays.""""""\n return jnp.sqrt(jax.tree_util.tree_reduce(lambda x, y: x + jnp.sum(jnp.square(y)), x, initializer=0.0))\n\n\ndef calculate_num_params_from_pytree(params):\n params_sizes = jax.tree_util.tree_map(jax.numpy.size, params)\n total_parameters = jax.tree_util.tree_reduce(lambda x, y: x + y, params_sizes)\n assert total_parameters >= 0\n return total_parameters\n\n\ndef device_space():\n """"""Version guard for jax.memory.Space.Device.""""""\n # See b/436565838 for more.\n if jax.__version__ >= ""0.7.1"":\n return jax.memory.Space.Device # pytype: disable=module-attr\n else:\n # pytype: disable=module-attr\n return jax._src.sharding_impls.TransferToMemoryKind(""device"") # pylint: disable=protected-access\n\n\ndef calculate_total_params_per_chip(params):\n """"""Calculate total params per chip.""""""\n\n def calculate_leaf_params_per_chip(arr):\n shard = arr.addressable_shards[0]\n return np.prod(shard.data.shape)\n\n params_sizes_per_chip = jax.tree_util.tree_map(calculate_leaf_params_per_chip, params)\n total_parameters_per_chip = jax.tree_util.tree_reduce(lambda x, y: x + y, params_sizes_per_chip)\n return total_parameters_per_chip\n\n\ndef calculate_bytes_from_pytree(params):\n params_bytes = jax.tree_util.tree_map(lambda x: x.nbytes, params)\n total_bytes = jax.tree_util.tree_reduce(lambda x, y: x + y, params_bytes)\n return total_bytes\n\n\ndef summarize_size_from_pytree(params):\n num_params = calculate_num_params_from_pytree(params)\n num_bytes = calculate_bytes_from_pytree(params)\n return num_params, num_bytes, num_bytes / num_params\n\n\ndef initialize_summary_writer(tensorboard_dir, run_name):\n summary_writer_path = os.path.join(tensorboard_dir, run_name)\n return writer.SummaryWriter(summary_writer_path) if jax.process_index() == 0 else None\n\n\ndef close_summary_writer(summary_writer):\n if jax.process_index() == 0:\n summary_writer.close()\n\n\ndef add_text_to_summary_writer(key, value, summary_writer):\n """"""Writes given key-value pair to tensorboard as text/summary.""""""\n if jax.process_index() == 0:\n summary_writer.add_text(key, value)\n\n\ndef maybe_initialize_jax_distributed_system(raw_keys):\n """"""The best recipe to initialize the Jax Distributed System has varied over time. We keep a layer of\n indirection in MaxText to avoid breaking the call sites unnecessarily.\n\n Currently jax.distributed.initialize() fully works as expected!\n\n For CPUs, we call jax.distributed.initialize() explicitly, with the specified arguments.\n """"""\n if raw_keys[""skip_jax_distributed_system""]:\n max_logging.log(""Skipping jax distributed system due to skip_jax_distributed_system=True flag."")\n return\n if raw_keys[""enable_single_controller""]:\n max_logging.log(""Skipping jax distributed system since its not needed for single controller."")\n return\n if jax.distributed.is_initialized():\n max_logging.log(""Jax distributed system is already initialized."")\n return\n if raw_keys[""inference_benchmark_test""]:\n # Disable initialization for inference benmark test.\n return\n if raw_keys[""compile_topology""]:\n # Don't initialize jax distributed with AOT compilation\n return\n if is_gpu_backend(raw_keys):\n max_logging.log(""Attempting to initialize the jax distributed system for GPU backend..."")\n initialize_jax_for_gpu(raw_keys)\n max_logging.log(""Jax distributed system initialized on GPU!"")\n elif is_cpu_backend(raw_keys):\n max_logging.log(""Attempting to initialize the jax distributed system for CPU backend..."")\n initialize_jax_for_cpu(raw_keys)\n max_logging.log(""Jax distributed system initialized on CPUs!"")\n elif (raw_keys[""enable_checkpointing""] and raw_keys[""compile_topology_num_slices""] == -1) or raw_keys[\n ""hardware""\n ] == ""gpu_multiprocess"":\n max_logging.log(""Attempting to initialize the jax distributed system..."")\n if not raw_keys[""enable_emergency_checkpoint""]:\n jax.distributed.initialize(initialization_timeout=raw_keys[""jax_distributed_initialization_timeout""])\n else:\n if raw_keys[""hardware""] == ""gpu_multiprocess"":\n max_logging.log(""Initializing jax distribtued to support local checkpointing with GPUs..."")\n jax.distributed.initialize(initialization_timeout=raw_keys[""jax_distributed_initialization_timeout""])\n ocp.multihost.initialize_runtime_to_distributed_ids()\n ocp.multihost.initialize_distributed_to_device_ids()\n else:\n initialize_jax_for_tpu_with_emergency_checkpointing(raw_keys)\n max_logging.log(""Jax distributed system initialized!"")\n\n\ndef initialize_jax_for_gpu(raw_keys):\n """"""Jax distributed initialize for GPUs.""""""\n if os.environ.get(""JAX_COORDINATOR_IP"") is not None:\n coordinator_ip = str(os.getenv(""JAX_COORDINATOR_IP""))\n coordinator_port = str(os.getenv(""JAX_COORDINATOR_PORT""))\n jax.distributed.initialize(\n coordinator_address=f""{coordinator_ip}:{coordinator_port}"",\n num_processes=int(os.getenv(""NNODES"")),\n process_id=int(os.getenv(""NODE_RANK"")),\n initialization_timeout=raw_keys[""jax_distributed_initialization_timeout""],\n )\n max_logging.log(f""JAX global devices: {jax.devices()}"")\n\n\ndef initialize_jax_for_cpu(raw_keys):\n """"""Jax distributed initialize for CPUs. Includes retries until the coordinator is ready.""""""\n coordinator_ip_address = get_coordinator_ip_address()\n coordinator_address = coordinator_ip_address + "":1234"" # JAX coordinator port used in XPK\n # Env variables to be set in XPK or otherwise\n job_index = int(os.environ.get(""JOB_INDEX""))\n job_completion_index = int(os.environ.get(""JOB_COMPLETION_INDEX""))\n processes_in_job = int(os.environ.get(""PROCESSES_IN_JOB""))\n pid = job_index * processes_in_job + job_completion_index\n max_logging.log(f"" Jax process id is {pid} "")\n # Explicit initialize is needed only for CPUs\n jax.distributed.initialize(\n coordinator_address=coordinator_address,\n process_id=pid,\n num_processes=int(os.environ.get(""JAX_PROCESS_COUNT"")),\n initialization_timeout=raw_keys[""jax_distributed_initialization_timeout""],\n )\n\n\ndef _wait_for_file_to_disappear(f, timeout=300):\n for _ in range(timeout):\n if not f.exists():\n return True\n time.sleep(1)\n return False\n\n\ndef _extract_step(f):\n # The base file name is formatted as {job_name}-s{step}-n{node_rank}-g{gpu_rank}\n return f.rsplit(""-"", 3)[1][1:]\n\n\ndef _block_and_proces_restore_dir(directory, timeout=300):\n """"""Block until a file ending with `.restore` appears, then extract the step number and rename\n the directory using the step number.\n """"""\n WORD = "".restore""\n for _ in range(timeout):\n files = os.listdir(directory)\n for f in files:\n if f.endswith(WORD):\n step = _extract_step(f)\n if step != ""0"":\n os.rename(epath.Path(directory) / f, epath.Path(directory) / step)\n max_logging.log(f""Found a restore directory at step {step} and renamed it to {epath.Path(directory) / step}."")\n else:\n max_logging.log(""Found a restore directory at step 0, skipping renaming."")\n return\n time.sleep(1)\n max_logging.log(f""{timeout} seconds have passed but no .restore file was found."")\n\n\ndef initialize_jax_for_tpu_with_emergency_checkpointing(raw_keys):\n """"""Initialize JAX distributed runtime for TPUs when emergency checkpointing is used.\n The information required to initialize JAX distributed runtime will be written by GKE to\n the local checkpoint directory. This function retrieves that information and initializes\n JAX distributed runtime.\n """"""\n process_id, coordinator_address = _retrieve_jax_init_info(raw_keys)\n\n if process_id != """" and coordinator_address != """":\n max_logging.log(\n f""Using {process_id} as the process_id and {coordinator_address} as the""\n "" coordinator_address to initialize JAX distributed runtime...""\n )\n jax.distributed.initialize(\n coordinator_address=coordinator_address,\n process_id=int(process_id),\n initialization_timeout=raw_keys[""jax_distributed_initialization_timeout""],\n )\n\n ocp.multihost.initialize_runtime_to_distributed_ids()\n ocp.multihost.initialize_distributed_to_device_ids()\n\n if raw_keys[""use_replicator_service""]:\n REPLICATOR_FILE = ""replicator.yaml""\n TEMP_FILE = REPLICATOR_FILE + "".tmp""\n replicator_file = epath.Path(raw_keys[""local_checkpoint_directory""]) / REPLICATOR_FILE\n if not _wait_for_file_to_disappear(replicator_file):\n max_logging.log(""There is existing replicator.yaml which did not disappear in time."")\n else:\n max_logging.log(""replicator.yaml no longer exists, creating new replicator.yaml."")\n TEMP_FILE = REPLICATOR_FILE + "".tmp""\n temp_file = epath.Path(raw_keys[""local_checkpoint_directory""]) / TEMP_FILE\n num_slices = get_num_slices(raw_keys)\n num_nodes = jax.process_count()\n nodes_per_slice = num_nodes // num_slices\n max_logging.log(f""num_slices: {num_slices}, num_nodes: {num_nodes}, nodes_per_slice: {nodes_per_slice}"")\n\n node_rank = jax._src.distributed.global_state.process_id # pylint: disable=protected-access\n my_process_index = jax.process_index()\n processIndex_to_nodeRank = ocp.multihost.runtime_to_distributed_ids()\n max_logging.log(\n f""Mapping of IDs: jax-init-info.txt={process_id}, \\n NodeRank={node_rank}, ProcessIndex={my_process_index}, \\n ProcessIndex->NodeRank={processIndex_to_nodeRank}""\n )\n\n my_in_pipeline_index = my_process_index % nodes_per_slice\n peer_ranks = []\n for i in range(num_slices):\n peer_process_index = i * nodes_per_slice + my_in_pipeline_index\n if peer_process_index != my_process_index:\n peer_process_rank = processIndex_to_nodeRank[peer_process_index]\n peer_ranks.append(peer_process_rank)\n\n max_logging.log(f""Peers for NodeRank {node_rank}: {peer_ranks}"")\n\n run_name = raw_keys[""run_name""]\n if run_name == """":\n run_name = os.environ.get(""JOBSET_NAME"") # using XPK default\n\n replicator_yaml = f""""""job-name: {run_name}\n framework: orbax\n assume-data-parallelism: {num_slices}\n node-rank: {node_rank}\n nodes: {num_nodes}\n peer-ranks: {peer_ranks}\n backup-interval-minutes: {raw_keys[""replicator_backup_interval_minutes""]}""""""\n\n temp_file.write_text(""\n"".join([l.strip() for l in replicator_yaml.split(""\n"")]))\n os.rename(temp_file, replicator_file)\n if not _wait_for_file_to_disappear(replicator_file):\n max_logging.log(""The newly created replicator.yaml was not deleted in time."")\n else:\n max_logging.log(""The newly created replicator.yaml was deleted, moving forward."")\n _block_and_proces_restore_dir(raw_keys[""local_checkpoint_directory""])\n else:\n max_logging.log(\n ""Initializing JAX distributed runtime without args when emergency checkpointing is""\n "" enabled. This should not happen and your workload may have unexpected behavior.""\n )\n jax.distributed.initialize(initialization_timeout=raw_keys[""jax_distributed_initialization_timeout""])\n\n ocp.multihost.initialize_runtime_to_distributed_ids()\n ocp.multihost.initialize_distributed_to_device_ids()\n\n\ndef _retrieve_jax_init_info(raw_keys):\n """"""Retrieve JAX init info from a local file.""""""\n JAX_INIT_INFO_FILE = ""jax-init-info.txt""\n local_jax_init_info_file = epath.Path(raw_keys[""local_checkpoint_directory""]) / JAX_INIT_INFO_FILE\n # Allow time for the JAX init info file to be populated by GKE. This is needed because the file is\n # only populated when the worker with process id of 0 is determined. After a disruption, although some\n # workers might be up and running, the init info file won't be populated until the node with process id\n # of 0 is known and this could take time. Using 900 seconds for now and it needs to be increased if the\n # ""repair"" time is longer.\n for i in range(900):\n if local_jax_init_info_file.exists():\n return local_jax_init_info_file.read_text().split(""\n"")[:2]\n max_logging.log(f""Unable to locate {JAX_INIT_INFO_FILE} after {i} seconds, sleeping for 1 second before retrying..."")\n time.sleep(1)\n max_logging.log(\n f""Unable to locate {JAX_INIT_INFO_FILE} after 900 seconds,"" ""returning empty process id and coordinator address.""\n )\n return """", """"\n\n\ndef get_num_slices(raw_keys):\n """"""Calculate num_slices based on number of devices.""""""\n if raw_keys[""hardware""] == ""cpu"":\n max_logging.log("" Setting num_slices=1 for CPU hardware type"")\n return 1\n if int(raw_keys[""compile_topology_num_slices""]) > 0:\n return raw_keys[""compile_topology_num_slices""]\n else:\n devices = jax.devices()\n try:\n return 1 + max(d.slice_index for d in devices)\n except (ValueError, AttributeError):\n return 1\n\n\ndef is_cpu_backend(raw_keys):\n """"""Determine whether Maxtext is intended to run on a CPU backend.""""""\n return raw_keys[""hardware""] == ""cpu""\n\n\ndef is_gpu_backend(raw_keys):\n """"""Determine whether Maxtext is intended to run on a GPU backend.""""""\n return raw_keys[""hardware""] == ""gpu""\n\n\ndef get_coordinator_ip_address():\n """"""Get coordinator IP Address with retries""""""\n coordinator_address = """"\n coordinator_ip_address = """"\n if os.environ.get(""JAX_COORDINATOR_ADDRESS"") is not None:\n coordinator_address = os.environ.get(""JAX_COORDINATOR_ADDRESS"")\n coordinator_found = False\n lookup_attempt = 1\n max_coordinator_lookups = 50\n while not coordinator_found and lookup_attempt <= max_coordinator_lookups:\n try:\n coordinator_ip_address = socket.gethostbyname(coordinator_address)\n coordinator_found = True\n except socket.gaierror:\n max_logging.log(\n f""Failed to recognize coordinator address {coordinator_address} on attempt {lookup_attempt}, retrying...""\n )\n lookup_attempt += 1\n time.sleep(5)\n max_logging.log(f""Coordinator IP address: {coordinator_ip_address}"")\n return coordinator_ip_address\n\n\ndef fill_unspecified_mesh_axes(parallelism_vals, target_product, parallelism_type):\n """"""Evaluates unspecified DCN/ICI parallelism values""""""\n if -1 in parallelism_vals:\n assert (\n parallelism_vals.count(-1) == 1\n ), f""Found unspecified values (-1) for more than one {parallelism_type}\\n parallelism axis. At most one axis can be unspecified.""\n\n determined_val = target_product / np.prod(parallelism_vals) * -1\n\n assert (\n determined_val >= 1 and determined_val.is_integer\n ), f""Unspecified value unable to be determined with the given\\n {parallelism_type} parallelism values""\n\n parallelism_vals[parallelism_vals.index(-1)] = int(determined_val)\n\n target_type = ""slices"" if parallelism_type == ""DCN"" else ""devices per slice""\n assert np.prod(parallelism_vals) == target_product, (\n f""Number of {target_type} {target_product} does not match""\n f"" the product of the {parallelism_type} parallelism {np.prod(parallelism_vals)}""\n )\n\n return parallelism_vals\n\n\ndef reshape_mesh_to_rings(a, strategy):\n """"""Reshape device mesh to rings for 64x4 or 32x8 mesh shape""""""\n b = []\n if strategy == HYBRID_RING_64X4:\n for i in range(8):\n b.append([])\n for j in range(8):\n a_i = i * 2\n a_j = j * 2\n # forms a ring of size 4\n b[i].append([a[a_i, a_j], a[a_i, a_j + 1], a[a_i + 1, a_j + 1], a[a_i + 1, a_j]])\n b = np.array(b)\n b = np.reshape(b, (64, 4))\n elif strategy == HYBRID_RING_32X8:\n for i in range(8):\n b.append([])\n for j in range(4):\n a_i = i * 2\n a_j = j * 4\n # forms a ring of size 8\n b[i].append(\n [\n a[a_i, a_j],\n a[a_i, a_j + 1],\n a[a_i, a_j + 2],\n a[a_i, a_j + 3],\n a[a_i + 1, a_j + 3],\n a[a_i + 1, a_j + 2],\n a[a_i + 1, a_j + 1],\n a[a_i + 1, a_j],\n ]\n )\n b = np.array(b)\n b = np.reshape(b, (32, 8))\n else:\n raise ValueError(f""The strategy {strategy} to reshape the mesh is not implemented."")\n return b\n\n\ndef create_custom_device_mesh(\n mesh_shape: Sequence[int],\n dcn_mesh_shape: Sequence[int],\n devices: Sequence[Any],\n custom_strategy: str,\n process_is_granule: bool = False,\n should_sort_granules_by_key: bool = True,\n) -> np.ndarray:\n """"""Custom device mesh for 64x4 ici parallelism""""""\n assert len(devices) % 256 == 0, f""This custom mesh is not valid for {len(devices)} devices""\n attr = ""process_index"" if process_is_granule else ""slice_index""\n if not hasattr(devices[0], attr):\n raise ValueError(f""Device {devices[0]} does not have attribute {attr}. See"" "" `process_is_granule` option."")\n granule_dict = collections.defaultdict(list)\n for dev in devices:\n granule_dict[getattr(dev, attr)].append(dev)\n granules = (\n [granule_dict[key] for key in sorted(granule_dict.keys())] if should_sort_granules_by_key else granule_dict.values()\n )\n if np.prod(dcn_mesh_shape) != len(granules):\n raise ValueError(f""Number of slices {len(granules)} must equal the product of "" f""dcn_mesh_shape {dcn_mesh_shape}"")\n per_granule_meshes = [\n mesh_utils.create_device_mesh(\n [16, 16],\n granule,\n allow_split_physical_axes=False,\n )\n for granule in granules\n ]\n\n per_granule_meshes = [np.reshape(reshape_mesh_to_rings(x, custom_strategy), mesh_shape) for x in per_granule_meshes]\n # TODO(jekbradbury): handle non-uniform DCN topologies\n granule_mesh = np.arange(len(granules)).reshape(dcn_mesh_shape)\n blocks = np.vectorize(lambda i: per_granule_meshes[i], otypes=[object])(granule_mesh)\n device_mesh = np.block(blocks.tolist())\n return device_mesh\n\n\ndef is_valid_custom_mesh(ici_parallelism, strategy):\n """"""Checks if the given strategy and ICI parallelism are valid.""""""\n if not strategy:\n return False\n\n valid_strategies = {\n HYBRID_RING_64X4: [1, 4, 64],\n HYBRID_RING_32X8: [1, 8, 32],\n }\n\n if strategy in valid_strategies:\n if sorted(set(ici_parallelism)) == valid_strategies[strategy]:\n return True\n else:\n raise ValueError(f""Invalid custom_mesh:{strategy} chosen for ICI mesh shape {ici_parallelism}"")\n else:\n raise ValueError(f""The strategy {strategy} to reshape the mesh is invalid."")\n\n\ndef optimize_mesh_for_tpu_v6e(mesh, devices):\n """"""Apply transformations to the mesh to optimize for TPU v6e""""""\n if devices[0].device_kind != ""TPU v6 lite"":\n return mesh\n num_devices = len(devices)\n mesh_is_1d_ring = num_devices in mesh.shape\n if not mesh_is_1d_ring:\n return mesh\n # check that the physical topology is 2x4\n device_coords = [d.coords for d in devices]\n coord_size = len(device_coords[0])\n max_coords = tuple(max(dc[i] for dc in device_coords) for i in range(coord_size))\n min_coords = tuple(min(dc[i] for dc in device_coords) for i in range(coord_size))\n dims = tuple(h - l + 1 for (h, l) in zip(max_coords, min_coords))\n if dims != (2, 4, 1):\n return mesh\n axis_idx = mesh.shape.index(num_devices)\n new_mesh = np.moveaxis(mesh, axis_idx, 0)\n new_mesh[4:] = new_mesh[-1:3:-1]\n new_mesh = np.moveaxis(new_mesh, 0, axis_idx)\n max_logging.log(""Optimized the mesh for TPU v6e"")\n return new_mesh\n\n\ndef unbox_logicallypartioned(boxed_pytree):\n """"""Unboxes the flax.LogicallyPartitioned pieces\n\n Args:\n boxed_pytree: a pytree that includes LogicallyPartitioned\n leaves.\n Returns:\n a pytree where all all LogicallyPartitioned leaves have been unboxed.\n """"""\n return jax.tree_util.tree_map(\n lambda x: x.unbox() if isinstance(x, flax.linen.spmd.LogicallyPartitioned) else x,\n boxed_pytree,\n is_leaf=lambda k: isinstance(k, flax.linen.spmd.LogicallyPartitioned),\n )\n\n\n# Cross entropy implementation is taken from original T5X codebase:\n# https://github.com/google-research/t5x/blob/ace831eea1e2742b4299cd1a9af7e4f302038351/t5x/losses.py#L25-L101\n@jax.custom_vjp\ndef cross_entropy_with_logits(\n logits: jnp.ndarray, targets: jnp.ndarray, z_loss: float\n) -> tuple[jnp.ndarray, jnp.ndarray]:\n """"""Computes cross entropy loss with stable custom gradient.\n Computes a stabilized-gradient version of:\n -jnp.sum(targets * nn.log_softmax(logits), axis=-1)\n If z_loss > 0, then an auxiliary loss equal to z_loss*log(z)^2\n will be added to the cross entropy loss (z = softmax normalization constant).\n The two uses of z_loss are:\n 1. To keep the logits from drifting too far from zero, which can cause\n unacceptable roundoff errors in bfloat16.\n 2. To encourage the logits to be normalized log-probabilities.\n Args:\n logits: [batch, length, num_classes] float array.\n targets: categorical one-hot targets [batch, length, num_classes] float\n array.\n z_loss: coefficient for auxiliary z-loss loss term.\n Returns:\n tuple with the total loss and the z_loss, both\n float arrays with shape [batch, length].\n """"""\n logits_sum = jax.scipy.special.logsumexp(logits, axis=-1, keepdims=True)\n log_softmax = logits - logits_sum\n loss = -jnp.sum(targets * log_softmax, axis=-1)\n # Add auxiliary z-loss term.\n log_z = jnp.squeeze(logits_sum, axis=-1)\n total_z_loss = z_loss * jax.lax.square(log_z)\n loss += total_z_loss\n return loss, total_z_loss\n\n\ndef _cross_entropy_with_logits_fwd(logits: jnp.ndarray, targets: jnp.ndarray, z_loss: float = 0.0) -> tuple[\n tuple[jnp.ndarray, jnp.ndarray],\n tuple[\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n ],\n]:\n """"""Forward-mode of `cross_entropy_with_logits`.""""""\n max_logit = logits.max(axis=-1, keepdims=True)\n shifted = logits - max_logit\n exp_shifted = jnp.exp(shifted)\n sum_exp = jnp.sum(exp_shifted, axis=-1, keepdims=True)\n log_softmax = shifted - jnp.log(sum_exp)\n loss = -jnp.sum(targets * log_softmax, axis=-1)\n # Add auxiliary z-loss term.\n log_z = jnp.squeeze(jnp.log(sum_exp) + max_logit, axis=-1)\n total_z_loss = z_loss * jax.lax.square(log_z)\n loss += total_z_loss\n return (loss, total_z_loss), (\n logits,\n targets,\n z_loss,\n exp_shifted,\n sum_exp, # pytype: disable=bad-return-type #jax-ndarray\n log_softmax,\n log_z,\n )\n\n\ndef _cross_entropy_with_logits_bwd(\n res: tuple[\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n jnp.ndarray,\n ],\n g: tuple[jnp.ndarray, jnp.ndarray],\n) -> tuple[jnp.ndarray, jnp.ndarray, jnp.ndarray]:\n """"""Backward-mode of `cross_entropy_with_logits`.""""""\n g = g[0] # Ignore z_loss component as that is only used for logging.\n logits, targets, z_loss, exp_shifted, sum_exp, log_softmax, log_z = res\n # z-loss term adds the (2 * z_loss * log_z) factor.\n deriv = jnp.expand_dims(1 + 2 * z_loss * log_z, -1) * exp_shifted / sum_exp - targets\n g_logits = jnp.expand_dims(g, axis=-1) * deriv\n g_targets = -jnp.expand_dims(g, axis=-1) * log_softmax\n return (\n jnp.asarray(g_logits, logits.dtype),\n jnp.asarray(g_targets, targets.dtype),\n jnp.array(0.0),\n ) # sets z-loss coeff gradient to 0\n\n\ncross_entropy_with_logits.defvjp(_cross_entropy_with_logits_fwd, _cross_entropy_with_logits_bwd)\n\n\ndef print_pytree_shape(print_str, ptree):\n print(""\n"")\n print(print_str)\n print(jax.tree_util.tree_map(lambda x: x.shape, ptree))\n\n\ndef print_model_vars(print_str, model_vars):\n for k in model_vars:\n print(f""{print_str} key{k}:"")\n print(f""\t {model_vars[k]}"")\n\n\ndef get_project():\n """"""Get project""""""\n completed_command = subprocess.run([""gcloud"", ""config"", ""get"", ""project""], check=True, capture_output=True)\n project_outputs = completed_command.stdout.decode().strip().split(""\n"")\n if len(project_outputs) < 1 or project_outputs[-1] == """":\n max_logging.log(""You must specify config.vertex_tensorboard_project or set 'gcloud config set project <project>'"")\n return None\n return project_outputs[-1]\n\n\ndef delete_pytree(p):\n def delete_leaf(leaf):\n if isinstance(leaf, jax.Array):\n leaf.delete()\n del leaf\n\n jax.tree_util.tree_map(delete_leaf, p)\n\n\ndef summarize_pytree_data(params, name=""Params"", raw=False):\n """"""Generate basic metrics of a given Pytree.""""""\n num_params, total_param_size, avg_param_size = summarize_size_from_pytree(params)\n if not raw:\n num_params_in_billions = num_params / 1e9\n total_param_size_in_gb = total_param_size / 1e9\n print(\n f""{name} stats: \n""\n f""\tTotal number of params: {num_params_in_billions:.3f} billion \n""\n f""\tTotal memory usage: {total_param_size_in_gb:.3f} GB \n""\n f""\tAvg size: {avg_param_size:.3f} bytes\n""\n )\n else:\n print(\n f""{name} stats: \n""\n f""\tTotal number of params: {num_params:.3f} \n""\n f""\tTotal memory usage: {total_param_size:.3f} bytes \n""\n f""\tAvg size: {avg_param_size:.3f} bytes\n""\n )\n return num_params, total_param_size, avg_param_size\n\n\ndef print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():\n stats = d.memory_stats()\n used = round(stats[""bytes_in_use""] / 2**30, 2)\n limit = round(stats[""bytes_limit""] / 2**30, 2)\n max_logging.log(f""\tUsing (GB) {used} / {limit} ({used/limit:%}) on {d}"")\n except (RuntimeError, KeyError, TypeError) as ex:\n max_logging.log(f""\tMemstats unavailable, error: {ex}"")\n\n\ndef print_cpu_ram_stats(label: str):\n """"""Print stats of CPU RAM usage/availability.""""""\n max_logging.log(f""\nRAMstats: {label}:"")\n try:\n ram = psutil.virtual_memory()\n\n total = round(ram.total / 2**30, 2)\n available = round(ram.available / 2**30, 2)\n used = round(ram.used / 2**30, 2)\n\n max_logging.log(f""\tUsing (GB) {used} / {total} ({used/total:%}) --> Available:{available}"")\n except (RuntimeError, KeyError, TypeError) as ex:\n max_logging.log(f""\tRAM stats unavailable, error: {ex}"")\n\n\ndef print_compiled_memory_stats(compiled_stats):\n """"""Prints a summary of the compiled memory statistics.""""""\n if compiled_stats is None:\n return\n\n def bytes_to_gb(num_bytes):\n return num_bytes / (1024**3)\n\n output_gb = bytes_to_gb(compiled_stats.output_size_in_bytes)\n temp_gb = bytes_to_gb(compiled_stats.temp_size_in_bytes)\n argument_gb = bytes_to_gb(compiled_stats.argument_size_in_bytes)\n alias_gb = bytes_to_gb(compiled_stats.alias_size_in_bytes)\n host_temp_gb = bytes_to_gb(compiled_stats.host_temp_size_in_bytes)\n total_gb = output_gb + temp_gb + argument_gb - alias_gb\n\n max_logging.log(\n f""Total memory size: {total_gb:.1f} GB, Output size: {output_gb:.1f} GB, Temp size: {temp_gb:.1f} GB, ""\n f""Argument size: {argument_gb:.1f} GB, Host temp size: {host_temp_gb:.1f} GB.""\n )\n\n\ndef print_system_information():\n """"""Print system information of the current environment.\n Note that this will initialize the JAX backend.""""""\n max_logging.log(f""System Information: Jax Version: {jax.__version__}"")\n max_logging.log(f""System Information: Jaxlib Version: {jax.lib.__version__}"")\n max_logging.log(f""System Information: Jax Backend: {jax.extend.backend.get_backend().platform_version}"")\n\n\ndef permute_to_match_maxtext_rope(arr):\n """"""Permutes the Huggingface Rope to match the MaxText logic.""""""\n assert arr.shape[-1] % 2 == 0, ""The last dimension for rope has to be even.""\n evens, odds = np.split(arr, 2, axis=arr.ndim - 1) # pylint: disable=W0632\n x = np.empty_like(arr)\n x[..., ::2] = evens\n x[..., 1::2] = odds\n return x\n\n\ndef unpermute_from_match_maxtext_rope(arr, model_size):\n """"""\n Function to get the RoPE values in correct ordering\n """"""\n if model_size[:8] != ""llama3.1"":\n return arr\n evens = arr[..., ::2]\n odds = arr[..., 1::2]\n return jax.numpy.concatenate((evens, odds), axis=arr.ndim - 1)\n\n\n@partial(jax.jit, static_argnames=(""cp_size"", ""seq_dim"", ""to_contiguous""))\ndef reorder_sequence(tensor, cp_size: int, seq_dim: int = 1, to_contiguous: bool = False):\n """"""Reorders the sequence of the tensor. For example, with cp_size=2,\n [0, 1, 2, 3, 4, 5, 6, 7] -> [0, 1, 6, 7, 2, 3, 4, 5]\n and backward\n [0, 1, 6, 7, 2, 3, 4, 5] -> [0, 1, 2, 3, 4, 5, 6, 7]\n """"""\n\n if tensor is None:\n return tensor\n\n seq_len = tensor.shape[seq_dim]\n group_size = seq_len // (2 * cp_size)\n\n if cp_size % 2 != 0:\n raise ValueError(f""{cp_size=} must be a multiple of 2."")\n\n # Need to ensure we have 2 pairs to swap for balancing between cp ranks\n if seq_len % (cp_size * 2) != 0:\n raise ValueError(f""{tensor.shape=} is not a multiple of {cp_size*2=}"")\n\n # [B, S, H, D]: [B, 2*cp_size, S/2*cp_size, H, D] -> [B, 2, S/2*cp_size, H, D]\n # [S, B, H, D]: [2*cp_size, S/2*cp_size, B, H, D] -> [2, S/2*cp_size, B, H, D]\n ori_tensor_shape = tensor.shape\n reshaped = tensor.reshape(\n *ori_tensor_shape[:seq_dim],\n 2 * cp_size,\n group_size,\n *ori_tensor_shape[seq_dim + 1 :],\n )\n\n if not to_contiguous:\n # Create first and second halves\n first_half = jnp.arange(cp_size)\n second_half = jnp.arange(2 * cp_size - 1, cp_size - 1, -1)\n\n # Stack and reshape to interleave\n src_indices = jnp.stack([first_half, second_half], axis=1).reshape(-1)\n\n else:\n\n half = cp_size // 2\n\n # Build the 1st and 2nd groups of contiguous‑pair indices:\n first_pair = [4 * r for r in range(half)] # [0, 4, 8, …]\n second_pair = [4 * r + 2 for r in range(half)] # [2, 6, 10, …]\n third_pair = [2 * cp_size - 1 - 4 * r for r in range(half)] # [2*cp_size-1, 2*cp_size-5, …]\n fourth_pair = [i - 2 for i in third_pair] # [2*cp_size-3, 2*cp_size-7, …]\n\n # Concatenate so each rank’s two indices sit next to each other:\n # e.g. [0,2, 4,6, …, (2cp‑1),(2cp‑3), …]\n first_block = first_pair + third_pair\n second_block = second_pair + fourth_pair\n\n # Stack into shape (2*cp_size//2, 2) → then flatten → length=2*cp_size\n src_indices = jnp.stack([jnp.array(first_block), jnp.array(second_block)], axis=1).reshape(-1)\n\n # One gather and one reshape\n reordered = jnp.take(reshaped, src_indices, axis=seq_dim)\n\n # Reshape back to original dimensions\n return reordered.reshape(ori_tensor_shape)\n\n\n@partial(jax.jit, static_argnums=1)\ndef reorder_causal_load_balanced(batch, cp_size):\n """"""Reorders the example batch sequences""""""\n return {\n key: reorder_sequence(\n value, # Pass each key's value inside batch separately\n cp_size=cp_size,\n )\n if key\n in [""inputs"", ""targets"", ""inputs_position"", ""targets_position"", ""inputs_segmentation"", ""targets_segmentation""]\n else value\n for key, value in batch.items()\n }\n\n\ndef shard_reorder_causal_load_balanced(batch, cp_size):\n """"""Shard the output of the reordered sequence.""""""\n reordered = reorder_causal_load_balanced(batch, cp_size)\n for _, v in batch.items():\n if isinstance(v, jax.Array):\n reordered = jax.lax.with_sharding_constraint(reordered, v.sharding)\n break\n return reordered\n\n\ndef get_reorder_callable(cp_size):\n """"""Creates a callable that can be used with map() to reorder batches.""""""\n return functools.partial(shard_reorder_causal_load_balanced, cp_size=cp_size)\n\n\n@staticmethod\ndef reorder_mask_load_balancing(tensor, cp_size: int, seq_dim: int):\n """"""\n Reorders a tensor for load balancing the compute of causal attention.\n This function works on numpy arrays instead of jax.numpy arrays.\n This is needed because we need the mask to be statically computable.\n So, we need to redefine the same logic as reorder_causal_load_balancing.\n We are still doing [0, 1, 2, 3, 4, 5, 6, 7] -> [0, 1, 6, 7, 2, 3, 4, 5]\n\n Args:\n tensor: The tensor to reorder.\n cp_size: The size of the compute parallelism.\n seq_dim: The dimension of the sequence.\n """"""\n\n seq_len = tensor.shape[seq_dim]\n group_size = seq_len // (2 * cp_size)\n\n if cp_size % 2 != 0:\n raise ValueError(f""{cp_size=} must be a multiple of 2."")\n\n # Need to ensure we have 2 pairs to swap for balancing between cp ranks\n if seq_len % (cp_size * 2) != 0:\n raise ValueError(f""{tensor.shape=} is not a multiple of {cp_size*2=}"")\n\n # [B, S, H, D]: [B, 2*cp_size, S/2*cp_size, H, D] -> [B, 2, S/2*cp_size, H, D]\n # [S, B, H, D]: [2*cp_size, S/2*cp_size, B, H, D] -> [2, S/2*cp_size, B, H, D]\n ori_tensor_shape = tensor.shape\n reshaped = tensor.reshape(\n *ori_tensor_shape[:seq_dim],\n 2 * cp_size,\n group_size,\n *ori_tensor_shape[seq_dim + 1 :],\n )\n\n # Create first and second halves\n first_half = np.arange(cp_size)\n second_half = np.arange(2 * cp_size - 1, cp_size - 1, -1)\n\n # Stack and reshape to interleave\n src_indices = np.stack([first_half, second_half], axis=1).reshape(-1)\n\n # One gather and one reshape\n reordered = np.take(reshaped, src_indices, axis=seq_dim)\n\n # Reshape back to original dimensions\n return reordered.reshape(ori_tensor_shape)\n\n\ndef parse_custom_args(argv):\n """"""Load multiple YAML config files from command line arguments.""""""\n configs = []\n current_argv = []\n python_script = argv[0]\n for arg in argv[1:]:\n if arg.endswith(("".yaml"", "".yml"")):\n if current_argv:\n configs.append(current_argv)\n current_argv = [python_script, arg]\n else:\n current_argv.append(arg)\n if current_argv:\n configs.append(current_argv)\n return configs\n\n\ndef unscan_train_state_params(params, sharding, mesh, scan_axis, layer_groups):\n """"""\n Unrolls scanned parameter groups into per-layer entries.\n\n Args:\n train_state: training state with scanned `params`\n mesh: the mesh to use for sharding output\n scan_axis: axis along which scanning was applied (usually 0)\n layer_groups: list of tuples like:\n [(""dense_layers"", 4), (""moe_layers"", 12)]\n """"""\n decoder = params[""params""][""decoder""]\n sharding = sharding[""params""][""decoder""]\n\n for layer_name, num_layers in layer_groups:\n scanned_layers = decoder[layer_name]\n\n def strip_axis(pspec):\n return jax.sharding.PartitionSpec(*(pspec[:scan_axis] + pspec[scan_axis + 1 :]))\n\n old_spec = jax.tree_util.tree_map(lambda x: x.spec, sharding[layer_name])\n new_spec = jax.tree_util.tree_map(strip_axis, old_spec)\n new_sharding = jax.tree_util.tree_map(lambda ps: jax.sharding.NamedSharding(mesh, ps), new_spec)\n\n def slice_layer(arr, i):\n return jax.tree_util.tree_map(lambda x: jnp.take(x, i, axis=scan_axis), arr)\n\n p_slice_layer = jax.jit(slice_layer, out_shardings=new_sharding)\n\n for i in range(num_layers):\n per_layer = p_slice_layer(scanned_layers, i)\n decoder[f""{layer_name}_{i}""] = per_layer\n\n del decoder[layer_name] # Free memory\n\n\ndef rescan_train_state_params(params, source_shardings, scan_axis, layer_groups):\n """"""\n Reconstruct scanned layers from per-layer entries using minimal HBM.\n\n Args:\n train_state: training state with unrolled {layer_name}_{i} entries\n scan_axis: axis to scan over\n layer_groups: list of (layer_name, num_layers)\n mesh: jax.sharding.Mesh for out_shardings\n """"""\n decoder = params[""params""][""decoder""]\n sharding = source_shardings[""params""][""decoder""]\n\n for layer_name, num_layers in layer_groups:\n\n def stack_layers(*layers):\n return jax.tree_util.tree_map(lambda *xs: jnp.stack(xs, axis=scan_axis), *layers)\n\n # Create a wrapper that allows pjit + donation\n compiled_stack = jax.jit(\n stack_layers,\n out_shardings=sharding[layer_name],\n # donate_argnums=tuple(range(num_layers)),\n )\n\n # Collect per-layer entries for stacking\n layer_list = [decoder.pop(f""{layer_name}_{i}"") for i in range(num_layers)]\n\n # Stack them with donation\n scanned = compiled_stack(*layer_list)\n\n # Store result and clear temporary memory\n decoder[layer_name] = scanned\n",python,tab
3
+ 2,315,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"10:02:09 AM [info] Activating crowd-code\n10:02:09 AM [info] Recording started\n10:02:09 AM [info] Initializing git provider using file system watchers...\n",Log,tab
4
+ 3,460,"extension-output-pdoom-org.crowd-code-#1-crowd-code",153,0,"10:02:10 AM [info] Git repository found\n10:02:10 AM [info] Git provider initialized successfully\n10:02:10 AM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,3336,"MaxText/max_utils.py",0,0,"",python,tab
6
+ 5,4553,"MaxText/max_utils.py",26192,0,"",python,selection_command
7
+ 6,6746,"MaxText/max_utils.py",25077,0,"",python,selection_command
8
+ 7,7414,"MaxText/max_utils.py",23992,0,"",python,selection_command
9
+ 8,8913,"MaxText/max_utils.py",23002,0,"",python,selection_command
10
+ 9,9380,"MaxText/max_utils.py",21499,0,"",python,selection_command
11
+ 10,10050,"MaxText/max_utils.py",20246,0,"",python,selection_command
12
+ 11,10507,"MaxText/max_utils.py",19065,0,"",python,selection_command
13
+ 12,14252,"MaxText/max_utils.py",17710,0,"",python,selection_command
14
+ 13,15019,"MaxText/max_utils.py",16766,0,"",python,selection_command
15
+ 14,15932,"MaxText/max_utils.py",15426,0,"",python,selection_command
16
+ 15,17307,"MaxText/max_utils.py",14314,0,"",python,selection_command
17
+ 16,21136,"MaxText/max_utils.py",12578,0,"",python,selection_command
18
+ 17,22669,"MaxText/max_utils.py",11125,0,"",python,selection_command
19
+ 18,23150,"MaxText/max_utils.py",9411,0,"",python,selection_command
20
+ 19,24946,"MaxText/max_utils.py",8028,0,"",python,selection_command
21
+ 20,26065,"MaxText/max_utils.py",6660,0,"",python,selection_command
22
+ 21,29079,"MaxText/max_utils.py",6652,0,"",python,selection_command
23
+ 22,29708,"MaxText/max_utils.py",6620,0,"",python,selection_command
24
+ 23,29880,"MaxText/max_utils.py",6558,0,"",python,selection_command
25
+ 24,30236,"MaxText/max_utils.py",6500,0,"",python,selection_command
26
+ 25,30341,"MaxText/max_utils.py",6445,0,"",python,selection_command
27
+ 26,33173,"MaxText/max_utils.py",6500,0,"",python,selection_command
28
+ 27,33446,"MaxText/max_utils.py",6558,0,"",python,selection_command
29
+ 28,33785,"MaxText/max_utils.py",6620,0,"",python,selection_command
30
+ 29,34692,"MaxText/max_utils.py",6652,0,"",python,selection_command
31
+ 30,41019,"MaxText/max_utils.py",4873,0,"",python,selection_command
32
+ 31,46006,"MaxText/max_utils.py",3541,0,"",python,selection_command
33
+ 32,50111,"MaxText/max_utils.py",2302,0,"",python,selection_command
34
+ 33,52582,"MaxText/max_utils.py",1239,0,"",python,selection_command
35
+ 34,54248,"MaxText/max_utils.py",732,0,"",python,selection_command
36
+ 35,55230,"MaxText/max_utils.py",0,0,"",python,selection_command
37
+ 36,56239,"MaxText/max_utils.py",1022,0,"",python,selection_command
38
+ 37,56478,"MaxText/max_utils.py",1808,0,"",python,selection_command
39
+ 38,56715,"MaxText/max_utils.py",3004,0,"",python,selection_command
40
+ 39,56835,"MaxText/max_utils.py",4167,0,"",python,selection_command
41
+ 40,57097,"MaxText/max_utils.py",5839,0,"",python,selection_command
42
+ 41,57133,"MaxText/max_utils.py",7583,0,"",python,selection_command
43
+ 42,57153,"MaxText/max_utils.py",8640,0,"",python,selection_command
44
+ 43,57195,"MaxText/max_utils.py",10192,0,"",python,selection_command
45
+ 44,57218,"MaxText/max_utils.py",11832,0,"",python,selection_command
46
+ 45,57258,"MaxText/max_utils.py",13661,0,"",python,selection_command
47
+ 46,57285,"MaxText/max_utils.py",14830,0,"",python,selection_command
48
+ 47,57315,"MaxText/max_utils.py",16125,0,"",python,selection_command
49
+ 48,57355,"MaxText/max_utils.py",17283,0,"",python,selection_command
50
+ 49,57385,"MaxText/max_utils.py",18333,0,"",python,selection_command
51
+ 50,57418,"MaxText/max_utils.py",19712,0,"",python,selection_command
52
+ 51,57458,"MaxText/max_utils.py",21004,0,"",python,selection_command
53
+ 52,57494,"MaxText/max_utils.py",22360,0,"",python,selection_command
54
+ 53,57517,"MaxText/max_utils.py",23486,0,"",python,selection_command
55
+ 54,57553,"MaxText/max_utils.py",24547,0,"",python,selection_command
56
+ 55,57587,"MaxText/max_utils.py",25720,0,"",python,selection_command
57
+ 56,57640,"MaxText/max_utils.py",26791,0,"",python,selection_command
58
+ 57,57655,"MaxText/max_utils.py",27953,0,"",python,selection_command
59
+ 58,57685,"MaxText/max_utils.py",29359,0,"",python,selection_command
60
+ 59,57882,"MaxText/max_utils.py",30561,0,"",python,selection_command
61
+ 60,58121,"MaxText/max_utils.py",31809,0,"",python,selection_command
62
+ 61,58157,"MaxText/max_utils.py",32859,0,"",python,selection_command
63
+ 62,58184,"MaxText/max_utils.py",34127,0,"",python,selection_command
64
+ 63,58223,"MaxText/max_utils.py",35123,0,"",python,selection_command
65
+ 64,58252,"MaxText/max_utils.py",36360,0,"",python,selection_command
66
+ 65,58285,"MaxText/max_utils.py",37394,0,"",python,selection_command
67
+ 66,59916,"MaxText/train.py",0,0,"# Copyright 2023–2025 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the ""License"");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an ""AS IS"" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# pylint: disable=g-bad-todo, abstract-method, consider-using-with\n""""""Training loop and Decoding of the model.""""""\n\n# Calling jax.device_count here prevents a ""TPU platform already registered"" error.\n# See github.com/google/maxtext/issues/20 for more\n\nfrom typing import Any, Sequence\nimport datetime\nimport functools\nimport os\n\nfrom absl import app\n\nimport numpy as np\n\nimport pathwaysutils # pylint: disable=unused-import\n\nimport tensorflow as tf\n\nimport jax\nimport jax.numpy as jnp\n\nfrom flax import linen as nn\nfrom flax.linen import partitioning as nn_partitioning\n\nfrom cloud_tpu_diagnostics import diagnostic\nfrom cloud_tpu_diagnostics.configuration import debug_configuration\nfrom cloud_tpu_diagnostics.configuration import diagnostic_configuration\nfrom cloud_tpu_diagnostics.configuration import stack_trace_configuration\n\nfrom MaxText import checkpointing\nfrom MaxText import exceptions\nfrom MaxText import max_logging\nfrom MaxText import max_utils\nfrom MaxText import maxtext_utils\nfrom MaxText import train_utils\nfrom MaxText import profiler\nfrom MaxText import pyconfig\nfrom MaxText.layers.multi_token_prediction import calculate_mtp_acceptance_rate, calculate_mtp_loss\nfrom MaxText.data_loader import DataLoader\nfrom MaxText.input_pipeline.input_pipeline_interface import create_data_iterator\nfrom MaxText.globals import EPS\nfrom MaxText.metric_logger import MetricLogger\nfrom MaxText.utils import gcs_utils\nfrom MaxText.utils.goodput_utils import (\n GoodputEvent,\n create_goodput_recorder,\n maybe_monitor_goodput,\n maybe_record_goodput,\n)\nfrom MaxText.vertex_tensorboard import VertexTensorboardManager\n# Placeholder: internal\n\nimport MaxText as mt\n# pylint: disable=too-many-positional-arguments\n\n\ndef validate_train_config(config):\n """"""Validates the configuration is set correctly for 'train.py'.""""""\n\n assert config.run_name, ""Erroring out, need a real run_name""\n if config.dataset_path and not config.dataset_path.startswith(""gs://""):\n max_logging.log(""WARNING: 'dataset_path' might be pointing your local file system"")\n if not config.base_output_directory.startswith(""gs://""):\n max_logging.log(""WARNING: 'base_output_directory' might be pointing your local file system"")\n assert config.steps > 0, ""You must set steps or learning_rate_schedule_steps to a positive integer.""\n\n if config.quantization in (""fp8"", ""nanoo_fp8""):\n # pylint: disable=line-too-long\n assert config.gradient_accumulation_steps == 1, (\n ""fp8 can't be used with gradient_accumulation_steps right now. Please use other quantization or set ""\n ""gradient_accumulation_steps to 1""\n )\n\n # Check if GPU Flash Attention is being used with sequence packing\n if config.attention == ""cudnn_flash_te"" and config.packing and config.dataset_type != ""synthetic"":\n raise ValueError(\n ""cudnn_flash_te only supports BSHD format. The THD (seq packing) support is going to be available in ""\n ""Transformer Engine 2.0 release. ""\n ""Please disable sequence packing (set packing=False) or use a different attention mechanism. ""\n ""With synthetic data, the format is not important as packing is not applied.""\n )\n\n\ndef get_first_step(state):\n return int(state.step)\n\n\n# -----------------------------------------------------------------------------\n# Top-level Functions\n# -----------------------------------------------------------------------------\n\n\ndef record_activation_metrics(output_metrics, intermediate_outputs, config):\n """"""Adds the activation metrics to the metrics dict""""""\n\n if config.scan_layers:\n metrics_dict = intermediate_outputs[""intermediates""][""decoder""][""decoder""]\n\n for layer_num in range(config.num_decoder_layers):\n output_metrics[""scalar""][f""activ_fraction_zero/layer_{layer_num:03d}""] = metrics_dict[""activation_fraction_zero""][\n 0\n ][layer_num]\n output_metrics[""scalar""][f""activ_mean/layer_{layer_num:03d}""] = metrics_dict[""activation_mean""][0][layer_num]\n output_metrics[""scalar""][f""activ_stdev/layer_{layer_num:03d}""] = metrics_dict[""activation_stdev""][0][layer_num]\n else:\n for layer_num in range(config.num_decoder_layers):\n layer = intermediate_outputs[""intermediates""][""decoder""][f""layers_{layer_num}""]\n output_metrics[""scalar""][f""activ_fraction_zero/layer_{layer_num:03d}""] = layer[""activation_fraction_zero""][0]\n output_metrics[""scalar""][f""activ_mean/layer_{layer_num:03d}""] = layer[""activation_mean""][0]\n output_metrics[""scalar""][f""activ_stdev/layer_{layer_num:03d}""] = layer[""activation_stdev""][0]\n\n\ndef _split_dpo_state(state):\n reference_params = state.params[""reference_params""]\n new_state = state.replace(params={k: v for k, v in state.params.items() if k != ""reference_params""})\n return new_state, reference_params\n\n\ndef _merge_dpo_state(state, reference_params):\n return state.replace(params=dict(state.params, reference_params=reference_params))\n\n\ndef dpo_loss_fn(model, config, data, dropout_rng, params, reference_params, is_train=True):\n """"""loss_fn for both train and eval.\n\n Args:\n model: A nn.Module\n config: Config of parameters\n data: Batch of data to apply to the model\n dropout_rng: A key to use to generate rng for dropout\n params: Model params\n is_train: True for train_step and False for eval_step\n\n Returns:\n loss: average loss\n aux: a dictionary including intermediate_outputs, total_loss, and total_weights\n """"""\n # inputs, targets, segments, positions = apply_args\n rng1, aqt_rng = jax.random.split(dropout_rng)\n\n # decimate proportion of data when per_device_batch_size<1\n if is_train:\n for k, v in data.items():\n data[k] = v[: config.micro_batch_size_to_train_on, :]\n\n # for DPO we don't support packed sequence (they shouldn't be present in the first place)\n data[""chosen_segmentation""] = (data[""chosen_segmentation""] == 1).astype(jnp.int32)\n data[""rejected_segmentation""] = (data[""rejected_segmentation""] == 1).astype(jnp.int32)\n data[""chosen_position""] = data[""chosen_position""] * (data[""chosen_segmentation""] == 1)\n data[""rejected_position""] = data[""rejected_position""] * (data[""rejected_segmentation""] == 1)\n\n # concatenated model and reference model forward pass\n inputs = jnp.concatenate([data[""chosen""], data[""rejected""]], 0)\n inputs_position = jnp.concatenate([data[""chosen_position""], data[""rejected_position""]], 0)\n inputs_segmentation = jnp.concatenate([data[""chosen_segmentation""], data[""rejected_segmentation""]], 0)\n\n logits, intermediate_outputs = model.apply(\n params,\n inputs,\n inputs_position,\n decoder_segment_ids=inputs_segmentation,\n enable_dropout=config.enable_dropout if is_train else False,\n rngs={""dropout"": rng1, ""params"": aqt_rng},\n mutable=""intermediates"",\n )\n ref_logits = model.apply(\n {""params"": reference_params},\n inputs,\n inputs_position,\n decoder_segment_ids=inputs_segmentation,\n enable_dropout=False,\n rngs={""dropout"": rng1, ""params"": aqt_rng},\n )\n ref_logits = jax.lax.stop_gradient(ref_logits)\n\n # extract token ids, segmentation and logits for chosen and rejected sequences\n chosen_ids = data[""chosen""][..., 1:]\n rejected_ids = data[""rejected""][..., 1:]\n chosen_segmentation = data[""chosen_segmentation""][..., 1:]\n rejected_segmentation = data[""rejected_segmentation""][..., 1:]\n n_logits = logits.shape[-3] // 2 # [B, S, E] - [batch, sequence, embedding/vocab]\n chosen_logits, rejected_logits = logits[:n_logits, :, :], logits[n_logits:, :, :] # [B, S, E], [B, S, E]\n # ^ [B, S, E], [B, S, E]\n chosen_ref_logits, rejected_ref_logits = ref_logits[:n_logits, :, :], ref_logits[n_logits:, :, :]\n\n # common subsequence and padding mask\n common_prefix_mask = jnp.cumsum(chosen_ids != rejected_ids, axis=-1) == 0 # [B, S]\n valid_seq_mask = (chosen_segmentation != 0) & (rejected_segmentation != 0) & ~common_prefix_mask # [B, S]\n\n # compute logratios from the sequence-reduced observed token log-probability\n chosen_logps_seq = jnp.take_along_axis( # [B, S]\n jax.nn.log_softmax(chosen_logits[..., :-1, :], axis=-1), chosen_ids[..., None], axis=-1\n )[..., 0]\n chosen_logps = jnp.sum(chosen_logps_seq * valid_seq_mask, axis=-1) # [B]\n chosen_ref_logps_seq = jnp.take_along_axis( # [B, S]\n jax.nn.log_softmax(chosen_ref_logits[..., :-1, :], axis=-1), chosen_ids[..., None], axis=-1\n )[..., 0]\n chosen_ref_logps = jnp.sum(chosen_ref_logps_seq * valid_seq_mask, axis=-1) # [B]\n chosen_logratios = chosen_logps - chosen_ref_logps # [B]\n\n rejected_logps_seq = jnp.take_along_axis( # [B, S]\n jax.nn.log_softmax(rejected_logits[..., :-1, :], axis=-1), rejected_ids[..., None], axis=-1\n )[..., 0]\n rejected_logps = jnp.sum(rejected_logps_seq * valid_seq_mask, axis=-1) # [B]\n rejected_ref_logps_seq = jnp.take_along_axis( # [B, S]\n jax.nn.log_softmax(rejected_ref_logits[..., :-1, :], axis=-1), rejected_ids[..., None], axis=-1\n )[..., 0]\n rejected_ref_logps = jnp.sum(rejected_ref_logps_seq * valid_seq_mask, axis=-1) # [B]\n rejected_logratios = rejected_logps - rejected_ref_logps # [B]\n\n # DPO loss from chosen and rejected logratios\n LABEL_SMOOTHING, BETA = config.dpo_label_smoothing, config.dpo_beta\n logratios_delta = BETA * (chosen_logratios - rejected_logratios) # [B]\n losses = ( # [B]\n -jax.nn.log_sigmoid(BETA * logratios_delta) * (1 - LABEL_SMOOTHING)\n - jax.nn.log_sigmoid(-BETA * logratios_delta) * LABEL_SMOOTHING\n )\n total_loss, total_weights = jnp.mean(losses), losses.shape[0]\n loss = total_loss\n\n moe_lb_loss = 0.0\n if config.num_experts > 1:\n nested_key = (""intermediates"", ""decoder"", ""layers"", ""moe_lb_loss"")\n total_moe_lb_loss = maxtext_utils.get_nested_value(intermediate_outputs, nested_key, 0.0)\n moe_lb_loss = jnp.mean(jnp.array(total_moe_lb_loss))\n loss += moe_lb_loss\n reward_accuracy = jnp.mean(chosen_logratios > rejected_logratios)\n aux = {\n ""intermediate_outputs"": intermediate_outputs,\n ""total_loss"": total_loss,\n ""total_weights"": total_weights,\n ""moe_lb_loss"": moe_lb_loss,\n ""reward_accuracy"": reward_accuracy,\n }\n return loss, aux\n\n\ndef loss_fn(model, config, data, dropout_rng, params, is_train=True):\n """"""loss_fn for both train and eval.\n\n Args:\n model: A nn.Module\n config: Config of parameters\n data: Batch of data to apply to the model\n dropout_rng: A key to use to generate rng for dropout\n params: Model params\n is_train: True for train_step and False for eval_step\n\n Returns:\n loss: average loss\n aux: a dictionary including intermediate_outputs, total_loss, and total_weights\n """"""\n # inputs, targets, segments, positions = apply_args\n rng1, aqt_rng = jax.random.split(dropout_rng)\n\n # decimate proportion of data when per_device_batch_size<1\n if is_train:\n for k, v in data.items():\n data[k] = v[: config.micro_batch_size_to_train_on, :]\n else:\n for k, v in data.items():\n data[k] = v[: config.micro_batch_size_to_eval_on, :]\n mutable_collections = [""intermediates""]\n if config.mtp_num_layers > 0 and is_train:\n # The single model.apply call now triggers the entire chain if MTP is enabled:\n # Decoder runs -> returns hidden_state -> MTPBlock uses it -> MTPBlock sows losses -> we reap them here.\n mutable_collections.append(""mtp_losses"")\n\n # During evaluation, if the acceptance rate test is enabled, we must\n # make its specific collection mutable so the MTPBlock can sow into it.\n if config.mtp_eval_target_module > 0 and not is_train:\n mutable_collections.append(""mtp_acceptance"")\n\n logits, intermediate_outputs = model.apply(\n params,\n data[""inputs""],\n data[""inputs_position""],\n decoder_segment_ids=data[""inputs_segmentation""],\n encoder_images=data[""images""] if config.use_multimodal else None,\n enable_dropout=config.enable_dropout if is_train else False,\n rngs={""dropout"": rng1, ""params"": aqt_rng},\n mutable=mutable_collections,\n decoder_target_tokens=data[""targets""],\n decoder_target_mask=data[""targets_segmentation""],\n )\n one_hot_targets = jax.nn.one_hot(data[""targets""], config.vocab_size)\n xent, _ = max_utils.cross_entropy_with_logits(logits, one_hot_targets, 0.0)\n xent = nn.with_logical_constraint(xent, (""activation_embed_and_logits_batch"", ""activation_length""))\n # Mask out paddings at the end of each example.\n xent = xent * (data[""targets_segmentation""] != 0)\n total_loss = jnp.sum(xent)\n total_weights = jnp.sum(data[""targets_segmentation""] != 0)\n\n # If gradient accumulation is enabled, we don't need to divide total_loss\n # by total_weights and then multiply the computed gradient by total_weights,\n # since it's equivalent to computing the gradient from total_loss.\n # This simplification reduces the number of operations and makes it easier\n # for XLA to move all-reduce out of the gradient accumulation loop when use\n # Zero1+GA to reduce communication overhead.\n # EPS was used to avoid division by zero, but it's not needed when gradient\n # accumulation is enabled since there's no division.\n if config.gradient_accumulation_steps > 1:\n loss = total_loss\n else:\n loss = total_loss / (total_weights + EPS)\n\n # Calculate and Add MTP Loss\n mtp_loss = 0.0\n if config.mtp_num_layers > 0 and is_train:\n mtp_loss = calculate_mtp_loss(intermediate_outputs, config)\n loss += mtp_loss\n\n # get moe load balance loss\n moe_lb_loss = 0.0\n if config.num_experts > 1:\n nested_key = (""intermediates"", ""decoder"", ""layers"", ""moe_lb_loss"")\n total_moe_lb_loss = maxtext_utils.get_nested_value(intermediate_outputs, nested_key, 0.0)\n moe_lb_loss = jnp.mean(jnp.array(total_moe_lb_loss))\n loss += moe_lb_loss\n\n # Add the model's primary output to the intermediates dict so it can be used\n # by the acceptance rate calculation in eval_step.\n intermediate_outputs[""logits""] = logits\n\n aux = {\n ""intermediate_outputs"": intermediate_outputs,\n ""total_loss"": total_loss,\n ""total_weights"": total_weights,\n ""moe_lb_loss"": moe_lb_loss,\n ""mtp_loss"": mtp_loss,\n }\n return loss, aux\n\n\ndef train_step(model, config, state_mesh_shardings, state, data, dropout_rng):\n """"""\n\n Args:\n model: A nn.Module\n state: A pytree of the current state of the model\n data: Batch of data to apply to the model\n dropout_rng: A key to use to generate rng for dropout\n\n Returns:\n new_state: Same format as state.\n metrics: Dictionary of model metrics such as loss, training rate, etc.\n rng2: A new rng key that can be used in future calls.\n\n """"""\n reference_params, reference_params_sharding, extra_dpo_args, _loss_fn = [], [], [], loss_fn\n if config.use_dpo:\n state, reference_params = _split_dpo_state(state)\n state_mesh_shardings, reference_params_sharding = _split_dpo_state(state_mesh_shardings)\n extra_dpo_args = [reference_params]\n _loss_fn = dpo_loss_fn\n\n if config.gradient_accumulation_steps > 1:\n\n def accumulate_gradient(acc_grad_and_loss, data):\n grad_func = jax.value_and_grad(_loss_fn, argnums=4, has_aux=True)\n (_, aux), cur_batch_gradient = grad_func(\n model, config, data, dropout_rng, state.params, *extra_dpo_args, is_train=True\n )\n acc_grad_and_loss[""loss""] += aux[""total_loss""]\n acc_grad_and_loss[""moe_lb_loss""] += aux[""moe_lb_loss""]\n acc_grad_and_loss[""mtp_loss""] += aux[""mtp_loss""]\n acc_grad_and_loss[""grad""] = jax.tree_util.tree_map(\n lambda x, y: x + y, cur_batch_gradient, acc_grad_and_loss[""grad""]\n )\n acc_grad_and_loss[""total_weights""] += aux[""total_weights""]\n return acc_grad_and_loss, aux\n\n def reshape_to_microbatch_accumulations(batch_arr):\n """"""Reshape global batch to microbatches, assuming batch axis is leading.""""""\n microbatches = config.gradient_accumulation_steps\n microbatch_shape = (microbatches, batch_arr.shape[0] // microbatches) + batch_arr.shape[1:]\n return jnp.reshape(batch_arr, microbatch_shape)\n\n data = jax.tree_util.tree_map(reshape_to_microbatch_accumulations, data)\n init_grad = jax.tree_util.tree_map(jnp.zeros_like, state.params)\n init_grad_and_loss = {""loss"": 0.0, ""grad"": init_grad, ""total_weights"": 0, ""moe_lb_loss"": 0.0, ""mtp_loss"": 0.0}\n\n grad_and_loss, aux = jax.lax.scan(\n accumulate_gradient, init_grad_and_loss, data, length=config.gradient_accumulation_steps\n )\n loss = (\n grad_and_loss[""loss""] / grad_and_loss[""total_weights""]\n + grad_and_loss[""moe_lb_loss""] / config.gradient_accumulation_steps\n + grad_and_loss[""mtp_loss""] / config.gradient_accumulation_steps\n )\n raw_grads = jax.tree_util.tree_map(lambda arr: arr / grad_and_loss[""total_weights""], grad_and_loss[""grad""])\n aux = jax.tree.map(lambda x: jnp.sum(x, axis=0), aux) # pytype: disable=module-attr\n else:\n if config.optimizer_memory_host_offload:\n if config.use_dpo:\n reference_params = jax.device_put(\n reference_params, max_utils.with_memory_kind(reference_params_sharding, ""device"")\n )\n extra_dpo_args = [reference_params]\n grad_func = jax.value_and_grad(_loss_fn, argnums=4, has_aux=True)\n (loss, aux), raw_grads = grad_func(model, config, data, dropout_rng, state.params, *extra_dpo_args, is_train=True)\n intermediate_outputs = aux[""intermediate_outputs""]\n total_weights = aux[""total_weights""]\n moe_lb_loss = aux[""moe_lb_loss""]\n mtp_loss = aux[""mtp_loss""]\n\n if config.gradient_clipping_threshold > 0:\n grads = maxtext_utils.apply_gradient_clipping(raw_grads, state, config.gradient_clipping_threshold)\n else:\n grads = raw_grads\n if config.optimizer_memory_host_offload:\n state = state.replace(\n opt_state=jax.device_put(\n state.opt_state,\n jax.tree_util.tree_map(lambda x: x.with_memory_kind(kind=""device""), state_mesh_shardings.opt_state),\n )\n )\n # Move all parameters to device before optimizer update\n if config.parameter_memory_host_offload:\n max_logging.log(""\nMoving all parameters to device before optimizer update"")\n\n def move(path, value):\n max_logging.log(f""train.py: Moving f{path} to device"")\n return value.with_memory_kind(kind=""device"")\n\n state = state.replace(\n params=jax.device_put(\n state.params,\n jax.tree_util.tree_map_with_path(move, state_mesh_shardings.params),\n )\n )\n new_state = state.apply_gradients(grads=grads)\n\n scalar_metrics = {\n ""learning/loss"": loss,\n ""learning/moe_lb_loss"": moe_lb_loss,\n ""learning/mtp_loss"": mtp_loss,\n ""learning/total_weights"": total_weights,\n }\n if not config.optimizer_memory_host_offload:\n scalar_metrics[""learning/grad_norm""] = max_utils.l2norm_pytree(grads)\n scalar_metrics[""learning/raw_grad_norm""] = max_utils.l2norm_pytree(raw_grads)\n scalar_metrics[""learning/param_norm""] = max_utils.l2norm_pytree(new_state.params)\n if config.use_dpo:\n scalar_metrics[""learning/dpo_reward_accuracy""] = aux[""reward_accuracy""]\n metrics = {\n ""scalar"": scalar_metrics,\n ""scalars"": {},\n }\n\n if config.record_internal_nn_metrics:\n record_activation_metrics(metrics, intermediate_outputs, config)\n\n if config.use_dpo:\n new_state = _merge_dpo_state(new_state, reference_params)\n\n return new_state, metrics\n\n\ndef eval_step(model, config, state, data, dropout_rng):\n """"""eval_step no backprop and new state compared with train_step.""""""\n\n reference_params, extra_dpo_args, _loss_fn = [], [], loss_fn\n if config.use_dpo:\n state, reference_params = _split_dpo_state(state)\n extra_dpo_args = [reference_params]\n _loss_fn = dpo_loss_fn\n\n eval_loss_fn = functools.partial(_loss_fn, model, config, data, dropout_rng, is_train=False)\n loss, aux = eval_loss_fn(state.params, *extra_dpo_args)\n\n mtp_acceptance_rate = 0.0\n if config.mtp_eval_target_module > 0:\n mtp_acceptance_rate = calculate_mtp_acceptance_rate(aux[""intermediate_outputs""], config)\n\n total_loss = aux[""total_loss""]\n total_weights = aux[""total_weights""]\n moe_lb_loss = aux[""moe_lb_loss""]\n mtp_loss = aux[""mtp_loss""]\n metrics = {\n ""scalar"": {\n ""evaluation/loss"": loss,\n ""evaluation/total_loss"": total_loss,\n ""evaluation/total_weights"": total_weights,\n ""evaluation/moe_lb_loss"": moe_lb_loss,\n ""evaluation/mtp_loss"": mtp_loss,\n ""evaluation/mtp_acceptance_rate_percent"": mtp_acceptance_rate,\n },\n }\n if config.use_dpo:\n metrics[""scalar""][""evaluation/dpo_reward_accuracy""] = aux[""reward_accuracy""]\n\n return metrics\n\n\ndef setup_train_loop(config, recorder, devices=None):\n """"""Set up prerequisites for the training loop -\n checkpoint_manager, PRNG keys, Mesh, Model and optimizer.\n Set up data iterator and tokenizer, initialize the model.\n\n Args:\n config\n recorder\n\n Returns:\n init_rng:\n checkpoint_manager: Orbax checkpointer\n state_mesh_annotations: the mesh annotations for the train state\n model:\n mesh:\n learning_rate_schedule:\n data_iterator:\n state: the initialized train state\n """"""\n\n with maybe_record_goodput(recorder, GoodputEvent.TPU_INIT):\n model = mt.from_pretrained(config, devices)\n mesh = model.mesh\n init_rng, checkpoint_manager, learning_rate_schedule, tx = train_utils.create_training_tools(config, model, mesh)\n\n with maybe_record_goodput(recorder, GoodputEvent.TRAINING_PREPARATION):\n data_iterator, eval_data_iterator = create_data_iterator(config, mesh)\n context_parallel_size = config.context_parallel_size\n # Check if context parallelism is being used with sequence packing\n if context_parallel_size > 1 and config.packing and config.dataset_type != ""synthetic"":\n raise ValueError(\n ""Context parallelism cannot be used with sequence packing except for synthetic data where packing is not applied. ""\n ""Either disable sequence packing (set packing=False) or disable context parallelism. ""\n ""Context parallelism with packing support will be added soon.""\n )\n\n # Apply reordering wrapper to data iterators if context parallelism is enabled\n with mesh:\n if context_parallel_size > 1 and config.context_parallel_load_balance:\n data_iterator = map(max_utils.get_reorder_callable(context_parallel_size), data_iterator)\n if eval_data_iterator:\n eval_data_iterator = map(max_utils.get_reorder_callable(context_parallel_size), eval_data_iterator)\n\n state, _, state_mesh_shardings, data_iterator = maxtext_utils.setup_training_state(\n model, data_iterator, tx, config, init_rng, mesh, checkpoint_manager\n )\n\n # TODO(aireenmei, hengtaoguo): support sharding in vit for multimodal\n if not config.using_pipeline_parallelism and not config.use_multimodal:\n # The vocab tensor(s) of shape [vocab, embed] (and transpose) are not sharded by stage\n maxtext_utils.assert_params_sufficiently_sharded(state.params, mesh, config.sharding_tolerance)\n\n if config.use_dpo:\n abstract_state, _, _ = maxtext_utils.get_abstract_state(model, tx, config, init_rng, mesh, is_training=True)\n max_logging.log(f""Restoring reference parameters for DPO from '{os.path.join(str(config.checkpoint_dir), str(0))}'"")\n try:\n step0_restored, _ = checkpointing.load_state_if_possible(\n checkpoint_manager,\n data_iterator,\n load_parameters_from_path="""",\n load_full_state_from_path="""",\n checkpoint_storage_concurrent_gb=config.checkpoint_storage_concurrent_gb,\n abstract_unboxed_pre_state=abstract_state,\n enable_single_replica_ckpt_restoring=False,\n dataset_type=config.dataset_type,\n step=0,\n use_ocdbt=config.checkpoint_storage_use_ocdbt,\n use_zarr3=config.checkpoint_storage_use_zarr3,\n enable_orbax_v1=config.enable_orbax_v1,\n checkpoint_conversion_fn=config.checkpoint_conversion_fn,\n source_checkpoint_layout=config.source_checkpoint_layout,\n )\n except FileNotFoundError:\n step0_restored = None\n if step0_restored is not None:\n reference_params = step0_restored[""items""].params[""params""]\n state = _merge_dpo_state(state, reference_params)\n else:\n max_logging.log(\n f""Could not restore reference parameters for DPO from '{os.path.join(str(config.checkpoint_dir), str(0))}'""\n )\n\n return (\n init_rng,\n checkpoint_manager,\n state_mesh_shardings,\n model,\n mesh,\n learning_rate_schedule,\n data_iterator,\n eval_data_iterator,\n state,\n )\n\n\ndef train_loop(config, recorder, state=None):\n """"""Main Training loop.""""""\n (\n init_rng,\n checkpoint_manager,\n state_mesh_shardings,\n model,\n mesh,\n learning_rate_schedule,\n data_iterator,\n eval_data_iterator,\n state,\n ) = setup_train_loop(config, recorder)\n\n if config.use_dpo:\n if ""reference_params"" not in state.params:\n reference_params = jax.tree.map(jnp.copy, state.params[""params""])\n state = _merge_dpo_state(state, reference_params)\n state_mesh_shardings = _merge_dpo_state(state_mesh_shardings, state_mesh_shardings.params[""params""])\n\n p_train_step, p_eval_step = train_utils.jit_train_and_eval_step(\n config, model, mesh, state, state_mesh_shardings, train_step, eval_step, eval_data_iterator\n )\n\n with mesh, nn_partitioning.axis_rules(config.logical_axis_rules):\n shaped_batch = maxtext_utils.get_shaped_batch(config)\n compiled = p_train_step.lower(state, shaped_batch, init_rng).compile()\n compiled_stats = compiled.memory_analysis()\n max_utils.print_compiled_memory_stats(compiled_stats)\n\n start_step = get_first_step(state) # this is the start_step for training\n prof = profiler.Profiler(config, offset_step=start_step)\n data_loader = DataLoader(config, mesh, data_iterator, recorder)\n metric_logger = MetricLogger(config=config, learning_rate_schedule=learning_rate_schedule)\n\n # Write train config params, num model params, and XLA flags to tensorboard\n metric_logger.write_setup_info_to_tensorboard(state.params)\n\n try:\n last_step_completion = datetime.datetime.now()\n for step in np.arange(start_step, config.steps):\n prof.maybe_activate_profiler(step, state)\n\n with jax.profiler.StepTraceAnnotation(""train"", step_num=step):\n example_batch = data_loader.load_next_batch()\n # pylint: disable=not-callable\n nextrng = jax.jit(jax.random.fold_in)(init_rng, step)\n with maybe_record_goodput(recorder, GoodputEvent.STEP, step):\n with mesh, nn_partitioning.axis_rules(config.logical_axis_rules):\n state, metrics = p_train_step(state, example_batch, nextrng)\n\n step_time_delta = datetime.datetime.now() - last_step_completion\n last_step_completion = datetime.datetime.now()\n\n state_to_save = state if not config.use_dpo else _split_dpo_state(state)[0]\n checkpointing.maybe_save_checkpoint(checkpoint_manager, state_to_save, config, data_iterator, step)\n\n if config.dump_hlo and step == (config.dump_step if config.dump_step >= 0 else start_step):\n jax.block_until_ready(state) # Ensure compilation has finished.\n gcs_utils.upload_dump(\n config.dump_hlo_local_dir,\n config.dump_hlo_gcs_dir,\n module_name=config.dump_hlo_module_name,\n delete_local_after=config.dump_hlo_delete_local_after,\n all_host_upload=config.dump_hlo_upload_all,\n )\n\n if config.eval_interval > 0 and step > start_step and (step + 1) % config.eval_interval == 0:\n assert eval_data_iterator\n\n # Explicitly reset the eval counters before starting the eval loop\n metric_logger.reset_eval_metrics()\n\n eval_step_count = 0\n # pylint: disable=not-callable\n for eval_batch in eval_data_iterator:\n if config.eval_steps > 0 and eval_step_count >= config.eval_steps:\n break\n with mesh, nn_partitioning.axis_rules(config.logical_axis_rules):\n eval_metrics = p_eval_step(state, eval_batch, nextrng)\n metric_logger.record_eval_metrics(step, metrics=eval_metrics)\n max_logging.log(f""Completed eval step {eval_step_count}"")\n eval_step_count += 1\n metric_logger.record_eval_metrics(step, eval_step_count=eval_step_count)\n if metric_logger.cumulative_eval_metrics[""scalar""][""eval/avg_loss""] <= config.target_eval_loss:\n prof.deactivate()\n raise exceptions.StopTraining(f""Target loss {config.target_eval_loss=} is achieved."")\n\n prof.maybe_deactivate_profiler(step, state)\n\n if step == start_step:\n max_utils.print_mem_stats(""After params initialized"")\n\n metric_logger.buffer_and_write_train_metrics(metrics, step, step_time_delta)\n\n state_to_save = state if not config.use_dpo else _split_dpo_state(state)[0]\n checkpointing.maybe_save_checkpoint(checkpoint_manager, state_to_save, config, data_iterator)\n except exceptions.StopTraining as e:\n max_logging.log(f""Training stopped: {str(e)}"")\n finally:\n metric_logger.flush_metrics_and_cleanup()\n\n return state\n\n\ndef initialize(argv: Sequence[str]) -> tuple[pyconfig.HyperParameters, Any, Any]:\n """"""Initialization of hyperparameters and utilities""""""\n pathwaysutils.initialize()\n jax.config.update(""jax_default_prng_impl"", ""unsafe_rbg"")\n # TF allocates extraneous GPU memory when using TFDS data\n # this leads to CUDA OOMs. WAR for now is to hide GPUs from TF\n tf.config.set_visible_devices([], ""GPU"")\n os.environ[""TF_CPP_MIN_LOG_LEVEL""] = ""0""\n if ""xla_tpu_spmd_rng_bit_generator_unsafe"" not in os.environ.get(""LIBTPU_INIT_ARGS"", """"):\n os.environ[""LIBTPU_INIT_ARGS""] = (\n os.environ.get(""LIBTPU_INIT_ARGS"", """") + "" --xla_tpu_spmd_rng_bit_generator_unsafe=true""\n )\n # TODO: mazumdera@ : ensure missing mandatory fields in base.yml are filled in in argv,\n # or fill in here\n config = pyconfig.initialize(argv)\n jax.config.update(""jax_use_shardy_partitioner"", config.shardy)\n max_utils.print_system_information()\n validate_train_config(config)\n os.environ[""TFDS_DATA_DIR""] = config.dataset_path or """"\n vertex_tensorboard_manager = VertexTensorboardManager()\n if config.use_vertex_tensorboard or os.environ.get(""UPLOAD_DATA_TO_TENSORBOARD""):\n vertex_tensorboard_manager.configure_vertex_tensorboard(config)\n\n # Goodput configurations\n maybe_monitor_goodput(config)\n recorder = create_goodput_recorder(config)\n\n # Stack traces configurations\n debug_config = debug_configuration.DebugConfig(\n stack_trace_config=stack_trace_configuration.StackTraceConfig(\n collect_stack_trace=config.collect_stack_trace,\n stack_trace_to_cloud=config.stack_trace_to_cloud,\n stack_trace_interval_seconds=config.stack_trace_interval_seconds,\n )\n )\n diagnostic_config = diagnostic_configuration.DiagnosticConfig(debug_config)\n return config, recorder, diagnostic_config\n\n\ndef run(config, recorder, diagnostic_config):\n """"""Run the job given hyperparameters and utilities""""""\n with diagnostic.diagnose(diagnostic_config):\n with maybe_record_goodput(recorder, GoodputEvent.JOB):\n train_loop(config, recorder)\n\n\ndef main(argv: Sequence[str]) -> None:\n config, recorder, diagnostic_config = initialize(argv)\n run(config, recorder, diagnostic_config)\n\n\nif __name__ == ""__main__"":\n app.run(main)\n",python,tab
68
+ 67,64336,"MaxText/max_utils.py",0,0,"",python,tab
69
+ 68,64337,"MaxText/max_utils.py",26717,0,"",python,selection_command
70
+ 69,82019,"MaxText/train.py",0,0,"",python,tab
71
+ 70,82019,"MaxText/train.py",29212,0,"",python,selection_command
72
+ 71,92406,"MaxText/train.py",29255,0,"\n if step == start_step:",python,content
73
+ 72,92406,"MaxText/train.py",29165,29,"",python,content
74
+ 73,93854,"MaxText/train.py",29226,29,"",python,content
75
+ 74,93865,"MaxText/train.py",29171,0,"if step == start_step:\n ",python,content
76
+ 75,93868,"MaxText/train.py",29183,0,"",python,selection_command
77
+ 76,128198,"MaxText/train.py",29212,0,"",python,selection_command
78
+ 77,128710,"MaxText/max_utils.py",0,0,"",python,tab
79
+ 78,128710,"MaxText/max_utils.py",26717,0,"",python,selection_command
80
+ 79,129386,"MaxText/max_utils.py",26713,32,"def print_mem_stats(label: str):",python,selection_command
81
+ 80,129587,"MaxText/max_utils.py",26713,75,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")",python,selection_command
82
+ 81,129797,"MaxText/max_utils.py",26713,82,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:",python,selection_command
83
+ 82,129827,"MaxText/max_utils.py",26713,116,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():",python,selection_command
84
+ 83,129872,"MaxText/max_utils.py",26713,147,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():\n stats = d.memory_stats()",python,selection_command
85
+ 84,129931,"MaxText/max_utils.py",26713,200,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():\n stats = d.memory_stats()\n used = round(stats[""bytes_in_use""] / 2**30, 2)",python,selection_command
86
+ 85,129934,"MaxText/max_utils.py",26713,253,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():\n stats = d.memory_stats()\n used = round(stats[""bytes_in_use""] / 2**30, 2)\n limit = round(stats[""bytes_limit""] / 2**30, 2)",python,selection_command
87
+ 86,129947,"MaxText/max_utils.py",26713,333,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():\n stats = d.memory_stats()\n used = round(stats[""bytes_in_use""] / 2**30, 2)\n limit = round(stats[""bytes_limit""] / 2**30, 2)\n max_logging.log(f""\tUsing (GB) {used} / {limit} ({used/limit:%}) on {d}"")",python,selection_command
88
+ 87,130115,"MaxText/max_utils.py",26713,385,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():\n stats = d.memory_stats()\n used = round(stats[""bytes_in_use""] / 2**30, 2)\n limit = round(stats[""bytes_limit""] / 2**30, 2)\n max_logging.log(f""\tUsing (GB) {used} / {limit} ({used/limit:%}) on {d}"")\n except (RuntimeError, KeyError, TypeError) as ex:",python,selection_command
89
+ 88,130447,"MaxText/max_utils.py",26713,445,"def print_mem_stats(label: str):\n max_logging.log(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():\n stats = d.memory_stats()\n used = round(stats[""bytes_in_use""] / 2**30, 2)\n limit = round(stats[""bytes_limit""] / 2**30, 2)\n max_logging.log(f""\tUsing (GB) {used} / {limit} ({used/limit:%}) on {d}"")\n except (RuntimeError, KeyError, TypeError) as ex:\n max_logging.log(f""\tMemstats unavailable, error: {ex}"")",python,selection_command
90
+ 89,132495,"MaxText/max_utils.py",27103,0,"",python,selection_command
91
+ 90,240641,"MaxText/max_utils.py",27051,0,"",python,selection_command
92
+ 91,240886,"MaxText/max_utils.py",26971,0,"",python,selection_command
93
+ 92,240909,"MaxText/max_utils.py",26918,0,"",python,selection_command
94
+ 93,240950,"MaxText/max_utils.py",26865,0,"",python,selection_command
95
+ 94,240975,"MaxText/max_utils.py",26834,0,"",python,selection_command
96
+ 95,241006,"MaxText/max_utils.py",26800,0,"",python,selection_command
97
+ 96,241042,"MaxText/max_utils.py",26793,0,"",python,selection_command
98
+ 97,241287,"MaxText/max_utils.py",26750,0,"",python,selection_command
99
+ 98,241461,"MaxText/max_utils.py",26717,0,"",python,selection_command
100
+ 99,244044,"MaxText/train.py",0,0,"",python,tab
101
+ 100,246341,"MaxText/max_utils.py",0,0,"",python,tab
102
+ 101,384791,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
103
+ 102,385131,"MaxText/max_utils.py",0,0,"",python,tab
104
+ 103,386390,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
105
+ 104,390751,"MaxText/max_utils.py",0,0,"",python,tab
106
+ 105,414462,"MaxText/metric_logger.py",0,0,"# Copyright 2023–2025 Google LLC\n#\n# Licensed under the Apache License, Version 2.0 (the ""License"");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an ""AS IS"" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# pylint: disable=bare-except, consider-using-generator\n# pytype: disable=attribute-error\n""""""Logger that saves metrics to a local file, GCS and TensorBoard.""""""\n\nimport json\nimport os\nimport queue\n\nimport numpy as np\n\nimport jax\n\nfrom MaxText import max_logging\nfrom MaxText import max_utils\nfrom MaxText import maxtext_utils\nfrom MaxText.utils import gcs_utils\nfrom MaxText.gcp_workload_monitor import GCPWorkloadMonitor\nfrom MaxText.globals import EPS\n\nfrom collections import defaultdict\n\n\ndef _prepare_metrics_for_json(metrics, step, run_name):\n """"""Converts metric dictionary into json supported types (e.g. float)""""""\n metrics_dict = {val: float(metrics[""scalar""][val]) for val in metrics[""scalar""]}\n metrics_dict[""step""] = float(step)\n metrics_dict[""run_name""] = run_name\n return metrics_dict\n\n\nclass MetricLogger:\n """"""\n Logger for saving metrics to a local file, GCS and TensorBoard.\n """"""\n\n def __init__(self, config, learning_rate_schedule):\n self.writer = max_utils.initialize_summary_writer(config.tensorboard_dir, config.run_name)\n self.config = config\n self.metadata = {}\n self.running_gcs_metrics = [] if config.gcs_metrics else None\n self.performance_metric_queue = self.get_performance_metric_queue(config)\n self.learning_rate_schedule = learning_rate_schedule\n self.cumulative_eval_metrics = {""scalar"": defaultdict(float)}\n self.buffered_train_metrics = None\n\n def reset_eval_metrics(self):\n """"""Resets the cumulative metrics dictionary for a new evaluation run.""""""\n self.cumulative_eval_metrics = {""scalar"": defaultdict(float)}\n\n def write_metrics(self, metrics, step, is_training=True):\n """"""Entry point for all metrics writing in Train's Main.""""""\n if metrics:\n self.log_metrics(metrics, step, is_training)\n\n if self.config.enable_tensorboard:\n self.write_metrics_to_tensorboard(metrics, step, is_training)\n\n if self.config.metrics_file:\n self.write_metrics_locally(metrics, step)\n\n if self.config.gcs_metrics and jax.process_index() == 0:\n self.write_metrics_for_gcs(metrics, step, is_training)\n\n def log_metrics(self, metrics, step, is_training):\n """"""Logs metrics via max_logging.""""""\n if is_training:\n loss = metrics[""scalar""][""learning/loss""]\n log_message = (\n f""completed step: {step}, seconds: {metrics['scalar']['perf/step_time_seconds']:.3f}, ""\n f""TFLOP/s/device: {metrics['scalar']['perf/per_device_tflops_per_sec']:.3f}, ""\n f""Tokens/s/device: {metrics['scalar']['perf/per_device_tokens_per_sec']:.3f}, ""\n f""total_weights: {metrics['scalar']['learning/total_weights']}, ""\n f""loss: {loss:.3f}""\n )\n\n if self.config.mtp_num_layers > 0:\n mtp_loss = metrics[""scalar""].get(""learning/mtp_loss"", 0.0)\n main_model_loss = loss - mtp_loss\n log_message += f"", main_model_loss: {main_model_loss:.3f}, mtp_loss: {mtp_loss:.3f}""\n\n else:\n log_message = (\n f""eval metrics after step: {step},""\n f"" loss={metrics['scalar']['eval/avg_loss']:.3f},""\n f"" total_weights={metrics['scalar']['eval/total_weights']}""\n )\n\n if self.config.mtp_num_layers > 0:\n log_message += (\n f"", avg_mtp_loss={metrics['scalar']['eval/avg_mtp_loss']:.3f},""\n f"" avg_mtp_acceptance_rate={metrics['scalar']['eval/avg_mtp_acceptance_rate_percent']:.2f}%""\n )\n\n max_logging.log(log_message)\n\n def write_metrics_locally(self, metrics, step):\n """"""Writes metrics locally for testing.""""""\n with open(self.config.metrics_file, ""a"", encoding=""utf8"") as local_metrics_file:\n if step == 0:\n local_metrics_file.truncate(0)\n\n metrics_dict = _prepare_metrics_for_json(metrics, step, self.config.run_name)\n local_metrics_file.write(str(json.dumps(metrics_dict)) + ""\n"")\n\n def write_metrics_for_gcs(self, metrics, step, is_training):\n """"""Writes metrics to GCS.""""""\n metrics_dict_step = _prepare_metrics_for_json(metrics, step, self.config.run_name)\n self.running_gcs_metrics.append(metrics_dict_step)\n if is_training and (step + 1) % self.config.log_period == 0 or step == self.config.steps - 1:\n start_step = (step // self.config.log_period) * self.config.log_period\n metrics_filename = f""metrics_step_{start_step:06}_to_step_{step:06}.txt""\n with open(metrics_filename, ""wt"", encoding=""utf8"") as metrics_for_gcs:\n for metrics_step in self.running_gcs_metrics:\n metrics_for_gcs.write(str(json.dumps(metrics_step)) + ""\n"")\n\n gcs_filename = os.path.join(self.config.metrics_dir, metrics_filename)\n max_logging.log(f""Moving file {metrics_filename} to GCS..."")\n gcs_utils.upload_blob(gcs_filename, metrics_filename)\n max_logging.log(f""File {metrics_filename} moved successfully!"")\n self.running_gcs_metrics = [] # reset running_metrics to empty list\n\n def write_metrics_to_tensorboard(self, metrics, step, is_training):\n """"""Writes metrics to TensorBoard.""""""\n if jax.process_index() == 0:\n for metric_name in metrics.get(""scalar"", []):\n self.writer.add_scalar(metric_name, np.array(metrics[""scalar""][metric_name]), step)\n for metric_name in metrics.get(""scalars"", []):\n self.writer.add_scalars(metric_name, metrics[""scalars""][metric_name], step)\n\n if is_training:\n full_log = step % self.config.log_period == 0\n\n if full_log and jax.process_index() == 0:\n max_logging.log(f""To see full metrics 'tensorboard --logdir={self.config.tensorboard_dir}'"")\n self.writer.flush()\n\n def write_setup_info_to_tensorboard(self, params):\n """"""Writes setup information like train config params, num model params, and XLA flags to TensorBoard.""""""\n num_model_parameters = max_utils.calculate_num_params_from_pytree(params)\n self.metadata[""per_device_tflops""], _, _ = maxtext_utils.calculate_tflops_training_per_device(self.config)\n self.metadata[""per_device_tokens""] = maxtext_utils.calculate_tokens_training_per_device(self.config)\n max_logging.log(f""number parameters: {num_model_parameters/1e9:.3f} billion"")\n max_utils.add_text_to_summary_writer(""num_model_parameters"", str(num_model_parameters), self.writer)\n max_utils.add_text_to_summary_writer(""libtpu_init_args"", os.environ[""LIBTPU_INIT_ARGS""], self.writer)\n maxtext_utils.add_config_to_summary_writer(self.config, self.writer)\n\n def get_performance_metric_queue(self, config):\n """"""Records heartbeat metrics and performance metrics to GCP.""""""\n performance_metric_queue = None\n if config.report_heartbeat_metric_for_gcp_monitoring or config.report_performance_metric_for_gcp_monitoring:\n gcp_workload_monitor = GCPWorkloadMonitor(config.run_name)\n if config.report_heartbeat_metric_for_gcp_monitoring:\n gcp_workload_monitor.start_heartbeat_reporting_thread(config.heartbeat_reporting_interval_in_seconds)\n if config.report_performance_metric_for_gcp_monitoring:\n performance_metric_queue = queue.Queue()\n gcp_workload_monitor.start_performance_reporting_thread(performance_metric_queue)\n return performance_metric_queue\n\n def buffer_and_write_train_metrics(self, metrics, step, step_time_delta):\n """"""\n Buffers metrics for the current training step and simultaneously writes the training metrics\n for the previous step to GCS and/or TensorBoard. This buffering strategy allows for back-to-back\n execution of training steps, by overlapping data loading for step n with the execution of step n−1.\n This significantly boosts training efficiency.\n """"""\n if self.buffered_train_metrics is not None:\n (step_to_write, metrics_to_write) = self.buffered_train_metrics\n self.write_metrics(metrics_to_write, step_to_write)\n\n self.record_train_metrics(metrics, step, step_time_delta)\n self.buffered_train_metrics = (step, metrics)\n\n def record_train_metrics(self, metrics, step, step_time_delta):\n """"""Records training metrics for the current step.""""""\n metrics[""scalar""].update({""perf/step_time_seconds"": step_time_delta.total_seconds()})\n metrics[""scalar""].update({""perf/per_device_tflops"": self.metadata[""per_device_tflops""]})\n metrics[""scalar""].update(\n {""perf/per_device_tflops_per_sec"": self.metadata[""per_device_tflops""] / step_time_delta.total_seconds()}\n )\n metrics[""scalar""].update({""perf/per_device_tokens"": self.metadata[""per_device_tokens""]})\n metrics[""scalar""].update(\n {""perf/per_device_tokens_per_sec"": self.metadata[""per_device_tokens""] / step_time_delta.total_seconds()}\n )\n metrics[""scalar""].update({""learning/current_learning_rate"": self.learning_rate_schedule(step)})\n if self.performance_metric_queue:\n self.performance_metric_queue.put(step_time_delta.total_seconds())\n\n def record_eval_metrics(self, step, metrics=None, eval_step_count=None):\n """"""Records eval metrics and writes the metrics to GCS and/or to TensorBoard.""""""\n if metrics:\n self.cumulative_eval_metrics[""scalar""][""eval/total_loss""] += float(\n metrics[""scalar""].get(""evaluation/total_loss"", 0.0)\n )\n self.cumulative_eval_metrics[""scalar""][""eval/total_weights""] += float(\n metrics[""scalar""].get(""evaluation/total_weights"", 0.0)\n )\n self.cumulative_eval_metrics[""scalar""][""eval/moe_lb_loss""] += float(\n metrics[""scalar""].get(""evaluation/moe_lb_loss"", 0.0)\n )\n self.cumulative_eval_metrics[""scalar""][""eval/mtp_loss""] += float(metrics[""scalar""].get(""evaluation/mtp_loss"", 0.0))\n self.cumulative_eval_metrics[""scalar""][""eval/mtp_acceptance_rate_percent""] += float(\n metrics[""scalar""].get(""evaluation/mtp_acceptance_rate_percent"", 0.0)\n )\n if self.config.use_dpo:\n self.cumulative_eval_metrics[""scalar""][""eval/dpo_reward_accuracy""] += float(\n metrics[""scalar""].get(""evaluation/dpo_reward_accuracy"", 0.0)\n )\n\n if eval_step_count:\n eval_loss = self.cumulative_eval_metrics[""scalar""][""eval/total_loss""] / (\n self.cumulative_eval_metrics[""scalar""][""eval/total_weights""] + EPS\n )\n self.cumulative_eval_metrics[""scalar""][""eval/avg_loss""] = eval_loss\n self.cumulative_eval_metrics[""scalar""][""eval/avg_moe_lb_loss""] = (\n self.cumulative_eval_metrics[""scalar""][""eval/moe_lb_loss""] / eval_step_count\n )\n self.cumulative_eval_metrics[""scalar""][""eval/avg_mtp_loss""] = (\n self.cumulative_eval_metrics[""scalar""][""eval/mtp_loss""] / eval_step_count\n )\n self.cumulative_eval_metrics[""scalar""][""eval/avg_mtp_acceptance_rate_percent""] = (\n self.cumulative_eval_metrics[""scalar""][""eval/mtp_acceptance_rate_percent""] / eval_step_count\n )\n if self.config.use_dpo:\n self.cumulative_eval_metrics[""scalar""][""eval/dpo_reward_accuracy""] = (\n self.cumulative_eval_metrics[""scalar""][""eval/dpo_reward_accuracy""] / eval_step_count\n )\n\n self.write_metrics(self.cumulative_eval_metrics, step, is_training=False)\n\n def flush_metrics_and_cleanup(self):\n """"""\n This is a terminal operation that uploads any buffered metrics to GCS\n and/or TensorBoard before closing the writer objects. Once called, the\n logger instance should not be used to add or write more metrics as the\n underlying writer objects (e.g., TensorBoard SummaryWriter) will be closed.\n """"""\n if self.buffered_train_metrics is not None:\n (step_to_write, metrics_to_write) = self.buffered_train_metrics\n self.write_metrics(metrics_to_write, step_to_write)\n\n max_utils.close_summary_writer(self.writer)\n",python,tab
107
+ 106,416242,"MaxText/max_utils.py",0,0,"",python,tab
108
+ 107,417146,"MaxText/train.py",0,0,"",python,tab
109
+ 108,503685,"MaxText/train.py",29194,61," max_utils.print_mem_stats(""After params initialized"")",python,selection_command
110
+ 109,503931,"MaxText/train.py",29165,90," if step == start_step:\n max_utils.print_mem_stats(""After params initialized"")",python,selection_command
111
+ 110,636691,"MaxText/train.py",29183,0,"",python,selection_command
112
+ 111,637002,"MaxText/train.py",29212,0,"",python,selection_command
113
+ 112,637139,"MaxText/train.py",29227,0,"",python,selection_command
114
+ 113,637290,"MaxText/train.py",29229,0,"",python,selection_command
115
+ 114,637403,"MaxText/train.py",29235,0,"",python,selection_command
116
+ 115,637522,"MaxText/train.py",29242,0,"",python,selection_command
117
+ 116,637762,"MaxText/train.py",29235,0,"",python,selection_command
118
+ 117,637939,"MaxText/train.py",29229,0,"",python,selection_command
119
+ 118,639370,"MaxText/train.py",29229,1,"A",python,selection_command
120
+ 119,639370,"MaxText/train.py",29229,5,"After",python,selection_command
121
+ 120,639802,"MaxText/train.py",29233,0,"",python,selection_command
122
+ 121,640291,"MaxText/train.py",29233,1,"r",python,selection_command
123
+ 122,640601,"MaxText/train.py",29229,24,"After params initialized",python,selection_command
124
+ 123,641642,"MaxText/train.py",29252,0,"",python,selection_command
125
+ 124,808882,"MaxText/train.py",29242,0,"",python,selection_command
126
+ 125,809122,"MaxText/train.py",29235,0,"",python,selection_command
127
+ 126,809154,"MaxText/train.py",29229,0,"",python,selection_command
128
+ 127,809183,"MaxText/train.py",29227,0,"",python,selection_command
129
+ 128,809343,"MaxText/train.py",29212,0,"",python,selection_command
130
+ 129,809843,"MaxText/train.py",29227,0,"",python,selection_command
131
+ 130,811271,"MaxText/train.py",29212,0,"",python,selection_command
132
+ 131,811572,"MaxText/max_utils.py",0,0,"",python,tab
133
+ 132,811573,"MaxText/max_utils.py",26717,0,"",python,selection_command
134
+ 133,814323,"MaxText/train.py",0,0,"",python,tab
135
+ 134,814323,"MaxText/train.py",29212,0,"",python,selection_command
136
+ 135,815355,"MaxText/max_utils.py",0,0,"",python,tab
137
+ 136,815355,"MaxText/max_utils.py",26717,0,"",python,selection_command
138
+ 137,816643,"MaxText/train.py",0,0,"",python,tab
139
+ 138,816643,"MaxText/train.py",29212,0,"",python,selection_command
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-3d6dd2ac-00a0-4356-af22-1896e3d753c31767548094518-2026_01_04-18.35.00.916/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-3fe74aa6-92c3-405a-9c6c-49c34aec593b1762364457821-2025_11_05-18.41.02.400/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-4001b8e0-0e9c-4560-958e-a52f816eab081767861210539-2026_01_08-18.19.51.735/source.csv ADDED
@@ -0,0 +1,394 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,2,"src/types.ts",0,0,"/**\r\n * crowd-code 2.0 Type Definitions\r\n * Observation-Action schema for state-based capture\r\n */\r\n\r\n\r\nexport type ConsentStatus = 'pending' | 'accepted' | 'declined'\r\n\r\nexport type ActionSource = 'user' | 'agent' | 'git' | 'git_checkout'\r\n\r\nexport interface CursorPosition {\r\n\tline: number\r\n\tcharacter: number\r\n}\r\n\r\nexport interface ViewportState {\r\n\tfile: string\r\n\tstartLine: number\r\n\tendLine: number\r\n\tcontent: string\r\n\tcursorPosition: CursorPosition | null\r\n}\r\n\r\nexport interface TerminalViewport {\r\n\tid: string\r\n\tname: string\r\n\tviewport: string[]\r\n}\r\n\r\nexport interface Observation {\r\n\tviewport: ViewportState | null\r\n\tactiveTerminal: TerminalViewport | null\r\n}\r\n\r\nexport interface EditDiff {\r\n\trangeOffset: number\r\n\trangeLength: number\r\n\ttext: string\r\n}\r\n\r\nexport interface EditAction {\r\n\tkind: 'edit'\r\n\tsource: ActionSource\r\n\tfile: string\r\n\tdiff: EditDiff\r\n}\r\n\r\nexport interface SelectionAction {\r\n\tkind: 'selection'\r\n\tsource: ActionSource\r\n\tfile: string\r\n\tselectionStart: CursorPosition\r\n\tselectionEnd: CursorPosition\r\n\tselectedText: string\r\n}\r\n\r\nexport interface TabSwitchAction {\r\n\tkind: 'tab_switch'\r\n\tsource: ActionSource\r\n\tfile: string\r\n\tpreviousFile: string | null\r\n}\r\n\r\nexport interface TerminalFocusAction {\r\n\tkind: 'terminal_focus'\r\n\tsource: ActionSource\r\n\tterminalId: string\r\n\tterminalName: string\r\n}\r\n\r\nexport interface TerminalCommandAction {\r\n\tkind: 'terminal_command'\r\n\tsource: ActionSource\r\n\tterminalId: string\r\n\tterminalName: string\r\n\tcommand: string\r\n}\r\n\r\nexport interface TerminalOutputAction {\r\n\tkind: 'terminal_output'\r\n\tsource: ActionSource\r\n\tterminalId: string\r\n\tterminalName: string\r\n\toutput: string\r\n}\r\n\r\nexport interface FileChangeAction {\r\n\tkind: 'file_change'\r\n\tsource: ActionSource\r\n\tfile: string\r\n\tchangeType: 'create' | 'change' | 'delete'\r\n\tdiff: string | null\r\n}\r\n\r\nexport interface ScrollAction {\r\n\tkind: 'scroll'\r\n\tsource: ActionSource\r\n\tfile: string\r\n}\r\n\r\nexport type Action =\r\n\t| EditAction\r\n\t| SelectionAction\r\n\t| TabSwitchAction\r\n\t| TerminalFocusAction\r\n\t| TerminalCommandAction\r\n\t| TerminalOutputAction\r\n\t| FileChangeAction\r\n\t| ScrollAction\r\n\r\nexport interface ObservationEvent {\r\n\tsequence: number\r\n\ttimestamp: number\r\n\ttype: 'observation'\r\n\tobservation: Observation\r\n}\r\n\r\nexport interface ActionEvent {\r\n\tsequence: number\r\n\ttimestamp: number\r\n\ttype: 'action'\r\n\taction: Action\r\n}\r\n\r\nexport type RecordingEvent = ObservationEvent | ActionEvent\r\n\r\nexport interface RecordingSession {\r\n\tversion: '2.0'\r\n\tsessionId: string\r\n\tstartTime: number\r\n\tevents: RecordingEvent[]\r\n}\r\n\r\nexport interface RecordingState {\r\n\tisRecording: boolean\r\n\tstartDateTime: Date | null\r\n\tendDateTime: Date | null\r\n\tsequence: number\r\n\tsessionId: string\r\n\tevents: RecordingEvent[]\r\n}\r\n\r\ntest",typescript,tab
3
+ 2,181,"extension-output-pdoom-org.crowd-code-#2-crowd-code",0,0,"6:19:51 PM [info] Activating crowd-code\n6:19:51 PM [info] Recording started\n6:19:51 PM [info] Initializing git provider using file system watchers...\n",Log,tab
4
+ 3,286,"extension-output-pdoom-org.crowd-code-#2-crowd-code",150,0,"6:19:51 PM [info] Git repository found\n6:19:51 PM [info] Git provider initialized successfully\n6:19:51 PM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,2836,"src/types.ts",0,0,"",typescript,tab
6
+ 5,11490,"extension-output-pdoom-org.crowd-code-#2-crowd-code",0,0,"",Log,tab
7
+ 6,12780,"src/types.ts",0,0,"",typescript,tab
8
+ 7,20908,"src/types.ts",2704,6,"",typescript,content
9
+ 8,22567,"extension-output-undefined_publisher.test-#2-Edit Trace Probe",0,0,"--- TRACE STOPPED ---\n",Log,tab
10
+ 9,23042,"src/types.ts",0,0,"",typescript,tab
11
+ 10,27601,"src/types.ts",2704,0,"\r\n",typescript,content
12
+ 11,28363,"src/types.ts",2706,0,"t",typescript,content
13
+ 12,28363,"src/types.ts",2707,0,"",typescript,selection_keyboard
14
+ 13,28577,"src/types.ts",2707,0,"e",typescript,content
15
+ 14,28577,"src/types.ts",2708,0,"",typescript,selection_keyboard
16
+ 15,28810,"src/types.ts",2708,0,"s",typescript,content
17
+ 16,28811,"src/types.ts",2709,0,"",typescript,selection_keyboard
18
+ 17,28826,"src/types.ts",2709,0,"t",typescript,content
19
+ 18,28826,"src/types.ts",2710,0,"",typescript,selection_keyboard
20
+ 19,29413,"src/types.ts",2709,0,"",typescript,selection_command
21
+ 20,64957,"src/types.ts",2704,6,"",typescript,content
22
+ 21,112645,"src/types.ts",0,0,"",typescript,selection_command
23
+ 22,114411,"src/types.ts",5,0,"",typescript,selection_command
24
+ 23,120345,"src/types.ts",5,34," * crowd-code 2.0 Type Definitions",typescript,selection_command
25
+ 24,132899,"src/types.ts",5,0,"",typescript,selection_command
26
+ 25,145428,"src/types.ts",5,34," * crowd-code 1.0 Type Definitions",typescript,content
27
+ 26,153458,"extension-output-undefined_publisher.test-#2-Edit Trace Probe",0,0,"",Log,tab
28
+ 27,196317,"src/types.ts",0,0,"",typescript,tab
29
+ 28,196453,"src/types.ts",5,34," * crowd-code 2.0 Type Definitions",typescript,content
30
+ 29,197318,"src/types.ts",38,0,"",typescript,selection_command
31
+ 30,744587,"src/types.ts",0,0,"",typescript,tab
32
+ 31,1519218,"src/types.ts",0,0,"",typescript,tab
33
+ 32,1520601,"src/recording.ts",0,0,"/**\n * Recording Orchestrator for crowd-code 2.0\n * Integrates viewport, terminal, filesystem, and deduplication modules\n * Implements the observation-action paradigm\n */\n\nimport * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport * as vscode from 'vscode'\nimport axios from 'axios'\nimport { parsePatch, formatPatch } from 'diff'\nimport { hasConsent } from './consent'\nimport {\n notificationWithProgress,\n generateBaseFilePath,\n formatDisplayTime,\n getExportPath,\n logToOutput,\n getConfig,\n addToGitignore,\n} from './utilities'\nimport type {\n\tRecordingState,\n\tRecordingEvent,\n\tRecordingSession,\n\tObservation,\n\tAction,\n\tEditAction,\n\tSelectionAction,\n\tTabSwitchAction,\n\tTerminalFocusAction,\n\tTerminalCommandAction,\n\tTerminalOutputAction,\n\tFileChangeAction,\n\tScrollAction,\n} from './types'\nimport { extContext, statusBarItem, actionsProvider } from './extension'\nimport {\n\tcaptureObservation,\n\tresetObservationState,\n\tresetTerminalState,\n\tinitializeViewportCapture,\n\tinitializeTerminalCapture,\n\tinitializeFilesystemWatcher,\n\tresetFilesystemState,\n} from './capture'\nimport { getRecentGitOperation } from './gitProvider'\n\nexport const recording: RecordingState = {\n\tisRecording: false,\n\tstartDateTime: null,\n\tendDateTime: null,\n\tsequence: 0,\n\tsessionId: vscode.env.sessionId,\n\tevents: [],\n}\n\n\nexport const commands = {\n openSettings: 'crowd-code.openSettings',\n startRecording: 'crowd-code.startRecording',\n stopRecording: 'crowd-code.stopRecording',\n panicButton: 'crowd-code.panicButton',\n}\n\n\nlet intervalId: NodeJS.Timeout | null = null\nlet uploadIntervalId: NodeJS.Timeout | null = null\nlet timer = 0\nlet previousFile: string | null = null\nlet panicStatusBarItem: vscode.StatusBarItem | undefined\nlet panicButtonPressCount = 0\nlet panicButtonTimeoutId: NodeJS.Timeout | undefined\n\nconst CROWD_CODE_API_GATEWAY_URL = process.env.CROWD_CODE_API_GATEWAY_URL\nconst PANIC_BUTTON_TIMEOUT = 3000\nconst MAX_BUFFER_SIZE_PER_FILE = 1000 // Prevent unbounded growth\n\n// Buffer of user edits per file, awaiting correlation with FS_CHANGE\ninterface PendingEdit {\n\tstartLine: number\n\tendLine: number\n\ttext: string\n}\nconst pendingUserEdits = new Map<string, PendingEdit[]>()\n\n// Disposables for event subscriptions\nconst subscriptions: vscode.Disposable[] = []\n\n\nfunction logObservation(observation: Observation): void {\n\tif (!recording.isRecording) {return}\n\n\trecording.sequence++\n\tconst event: RecordingEvent = {\n\t\tsequence: recording.sequence,\n\t\ttimestamp: Date.now(),\n\t\ttype: 'observation',\n\t\tobservation,\n\t}\n\trecording.events.push(event)\n}\n\nfunction logAction(action: Action): void {\n\tif (!recording.isRecording) {return}\n\n\trecording.sequence++\n\tconst event: RecordingEvent = {\n\t\tsequence: recording.sequence,\n\t\ttimestamp: Date.now(),\n\t\ttype: 'action',\n\t\taction,\n\t}\n\trecording.events.push(event)\n}\n\n/**\n * Log an observation followed by an action (the standard pattern for user actions)\n */\nfunction logObservationAndAction(action: Action): void {\n\tlogObservation(captureObservation())\n\tlogAction(action)\n}\n\nexport function isCurrentFileExported(): boolean {\n const editor = vscode.window.activeTextEditor\n const filename = editor?.document.fileName.replaceAll('\\', '/')\n const exportPath = getExportPath()\n if (!editor || !filename || !exportPath) {\n return false\n }\n return filename.startsWith(exportPath)\n}\n\n/**\n * Check if a change range is within the visible viewport\n * User edits must be within viewport; edits outside are from agents\n */\nfunction isChangeWithinViewport(\n\tchangeRange: vscode.Range,\n\tvisibleRanges: readonly vscode.Range[]\n): boolean {\n\treturn visibleRanges.some(visible =>\n\t\tvisible.contains(changeRange.start) || visible.contains(changeRange.end)\n\t)\n}\n\n/**\n * Check if a diff hunk overlaps with any pending user edit\n */\nfunction isHunkMatchedByUserEdit(\n\thunkStartLine: number,\n\thunkEndLine: number,\n\tpendingEdits: PendingEdit[]\n): boolean {\n\treturn pendingEdits.some(edit =>\n\t\tedit.startLine <= hunkEndLine && edit.endLine >= hunkStartLine\n\t)\n}\n\n/**\n * Filter user-matched hunks from a unified diff, returning only agent changes\n */\nfunction filterUserEditsFromDiff(diff: string, pendingEdits: PendingEdit[]): string | null {\n\tconst patches = parsePatch(diff)\n\tif (patches.length === 0) {return null}\n\n\tconst patch = patches[0]\n\tconst filteredHunks = patch.hunks.filter(hunk => {\n\t\tconst hunkStartLine = hunk.oldStart\n\t\tconst hunkEndLine = hunk.oldStart + hunk.oldLines - 1\n\t\treturn !isHunkMatchedByUserEdit(hunkStartLine, hunkEndLine, pendingEdits)\n\t})\n\n\tif (filteredHunks.length === 0) {return null}\n\n\t// Reconstruct diff with only unmatched hunks\n\tpatch.hunks = filteredHunks\n\treturn formatPatch(patch)\n}\n\nfunction handleTextDocumentChange(event: vscode.TextDocumentChangeEvent): void {\n\tif (!recording.isRecording) {return}\n\tif (isCurrentFileExported()) {return}\n\tif (event.document.uri.scheme !== 'file') {return}\n\n\tconst editor = vscode.window.activeTextEditor\n\n\t// Must be active document to be a user edit\n\tif (!editor || event.document !== editor.document) {return}\n\n\tconst visibleRanges = editor.visibleRanges\n\tconst file = vscode.workspace.asRelativePath(event.document.fileName)\n\n\tfor (const change of event.contentChanges) {\n\t\t// Drop changes outside viewport, these will be captured by filesystem watcher\n\t\tif (!isChangeWithinViewport(change.range, visibleRanges)) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// This is a user edit, record it\n\t\tconst action: EditAction = {\n\t\t\tkind: 'edit',\n\t\t\tsource: 'user',\n\t\t\tfile,\n\t\t\tdiff: {\n\t\t\t\trangeOffset: change.rangeOffset,\n\t\t\t\trangeLength: change.rangeLength,\n\t\t\t\ttext: change.text,\n\t\t\t},\n\t\t}\n\n\t\tlogObservationAndAction(action)\n\n\t\t// Add to pending edits buffer for correlation with FS_CHANGE\n\t\tconst pendingEdit: PendingEdit = {\n\t\t\tstartLine: change.range.start.line,\n\t\t\tendLine: change.range.end.line,\n\t\t\ttext: change.text,\n\t\t}\n\t\tconst edits = pendingUserEdits.get(file) ?? []\n\t\tif (edits.length < MAX_BUFFER_SIZE_PER_FILE) {\n\t\t\tedits.push(pendingEdit)\n\t\t\tpendingUserEdits.set(file, edits)\n\t\t}\n\t}\n\n\tactionsProvider.setCurrentFile(event.document.fileName)\n}\n\nfunction handleSelectionChange(event: vscode.TextEditorSelectionChangeEvent): void {\n\tif (!recording.isRecording) {return}\n\tif (event.textEditor !== vscode.window.activeTextEditor) {return}\n\tif (isCurrentFileExported()) {return}\n\n\tconst editor = event.textEditor\n\tconst selection = event.selections[0]\n\tif (!selection) {return}\n\n\tconst file = vscode.workspace.asRelativePath(editor.document.fileName)\n\tconst selectedText = editor.document.getText(selection)\n\n\tconst action: SelectionAction = {\n\t\tkind: 'selection',\n\t\tsource: 'user',\n\t\tfile,\n\t\tselectionStart: {\n\t\t\tline: selection.start.line,\n\t\t\tcharacter: selection.start.character,\n\t\t},\n\t\tselectionEnd: {\n\t\t\tline: selection.end.line,\n\t\t\tcharacter: selection.end.character,\n\t\t},\n\t\tselectedText,\n\t}\n\n\tlogObservationAndAction(action)\n\tactionsProvider.setCurrentFile(editor.document.fileName)\n}\n\nfunction handleActiveEditorChange(editor: vscode.TextEditor | undefined): void {\n\tupdateStatusBarItem()\n\t\n\tif (!recording.isRecording) {return}\n\tif (!editor) {return}\n\tif (isCurrentFileExported()) {return}\n\n\tconst file = vscode.workspace.asRelativePath(editor.document.fileName)\n\n\tconst action: TabSwitchAction = {\n\t\tkind: 'tab_switch',\n\t\tsource: 'user',\n\t\tfile,\n\t\tpreviousFile,\n\t}\n\n\tlogObservationAndAction(action)\n\t\n\tpreviousFile = file\n\tactionsProvider.setCurrentFile(editor.document.fileName)\n}\n\nfunction handleTerminalFocus(terminalId: string, terminalName: string): void {\n\tif (!recording.isRecording) {return}\n\tif (isCurrentFileExported()) {return}\n\n\tconst action: TerminalFocusAction = {\n\t\tkind: 'terminal_focus',\n\t\tsource: 'user',\n\t\tterminalId,\n\t\tterminalName,\n\t}\n\n\tlogObservationAndAction(action)\n\tactionsProvider.setCurrentFile(`Terminal: ${terminalName}`)\n}\n\nfunction handleTerminalCommand(terminalId: string, terminalName: string, command: string): void {\n\tif (!recording.isRecording) {return}\n\tif (isCurrentFileExported()) {return}\n\n\tconst action: TerminalCommandAction = {\n\t\tkind: 'terminal_command',\n\t\tsource: 'user',\n\t\tterminalId,\n\t\tterminalName,\n\t\tcommand,\n\t}\n\n\tlogObservationAndAction(action)\n}\n\nfunction handleTerminalOutput(terminalId: string, terminalName: string, output: string): void {\n\tif (!recording.isRecording) {return}\n\tif (isCurrentFileExported()) {return}\n\n\tconst action: TerminalOutputAction = {\n\t\tkind: 'terminal_output',\n\t\tsource: 'user',\n\t\tterminalId,\n\t\tterminalName,\n\t\toutput,\n\t}\n\n\t// Don't capture observation for every output chunk - just log the action\n\tlogAction(action)\n}\n\nexport function handleFileChange(file: string, changeType: 'create' | 'change' | 'delete', diff: string | null): void {\n\tif (!recording.isRecording) {return}\n\n\tconst relativePath = vscode.workspace.asRelativePath(file)\n\n\t// Check for git operation first\n\tconst gitOperation = getRecentGitOperation()\n\tif (gitOperation) {\n\t\tpendingUserEdits.clear() // Flush entire buffer, git can affect many files\n\t\tconst action: FileChangeAction = {\n\t\t\tkind: 'file_change',\n\t\t\tsource: gitOperation,\n\t\t\tfile: relativePath,\n\t\t\tchangeType,\n\t\t\tdiff,\n\t\t}\n\t\tlogObservationAndAction(action)\n\t\treturn\n\t}\n\n\t// Get pending user edits for this file\n\tconst pending = pendingUserEdits.get(relativePath)\n\tpendingUserEdits.delete(relativePath) // Clear regardless\n\n\t// If no pending edits, entire diff is agent\n\tif (!pending || pending.length === 0) {\n\t\tconst action: FileChangeAction = {\n\t\t\tkind: 'file_change',\n\t\t\tsource: 'agent',\n\t\t\tfile: relativePath,\n\t\t\tchangeType,\n\t\t\tdiff,\n\t\t}\n\t\tlogObservationAndAction(action)\n\t\treturn\n\t}\n\n\t// If no diff (delete) or create, record as agent\n\tif (!diff || changeType === 'delete' || changeType === 'create') {\n\t\tconst action: FileChangeAction = {\n\t\t\tkind: 'file_change',\n\t\t\tsource: 'agent',\n\t\t\tfile: relativePath,\n\t\t\tchangeType,\n\t\t\tdiff,\n\t\t}\n\t\tlogObservationAndAction(action)\n\t\treturn\n\t}\n\n\t// Parse diff and filter out user-matched hunks\n\tconst agentDiff = filterUserEditsFromDiff(diff, pending)\n\n\t// Only record if there's remaining agent diff\n\tif (agentDiff) {\n\t\tconst action: FileChangeAction = {\n\t\t\tkind: 'file_change',\n\t\t\tsource: 'agent',\n\t\t\tfile: relativePath,\n\t\t\tchangeType,\n\t\t\tdiff: agentDiff,\n\t\t}\n\t\tlogObservationAndAction(action)\n\t}\n}\n\nfunction handleScrollObservation(observation: Observation): void {\n\tif (!recording.isRecording) {return}\n\t\n\tconst editor = vscode.window.activeTextEditor\n\tif (!editor) {return}\n\n\tconst file = vscode.workspace.asRelativePath(editor.document.fileName)\n\n\tlogObservation(observation)\n\n\tconst action: ScrollAction = {\n\t\tkind: 'scroll',\n\t\tsource: 'user',\n\t\tfile,\n\t}\n\tlogAction(action)\n}\n\nfunction createRecordingFolder(folderPath: string): void {\n if (!fs.existsSync(folderPath)) {\n fs.mkdirSync(folderPath, { recursive: true })\n }\n}\n\nexport async function startRecording(): Promise<void> {\n if (recording.isRecording) {\n notificationWithProgress('Already recording')\n logToOutput('Already recording', 'info')\n return\n }\n\n const exportPath = getExportPath()\n if (!exportPath) {\n return\n }\n\n\t// Add to gitignore if configured\n if (\n getConfig().get<boolean>('export.addToGitignore') &&\n getConfig().get<string>('export.exportPath')?.startsWith('${workspaceFolder}')\n ) {\n await addToGitignore()\n }\n\n\t// Initialize recording state\n recording.startDateTime = new Date()\n\trecording.endDateTime = null\n\trecording.sequence = 0\n\trecording.events = []\n\trecording.sessionId = vscode.env.sessionId\n\tpreviousFile = null\n\tpanicButtonPressCount = 0\n\ttimer = 0\n\n\t// Reset capture module states\n\tresetObservationState()\n\tresetTerminalState()\n\tresetFilesystemState()\n\tpendingUserEdits.clear()\n\n\t// Create recording folder\n\tconst baseFilePath = generateBaseFilePath(recording.startDateTime, false, undefined, recording.sessionId)\n if (!baseFilePath) {\n return\n }\n const folderPath = path.dirname(path.join(exportPath, baseFilePath))\n createRecordingFolder(folderPath)\n\n\t// Initialize capture modules with callbacks\n\tinitializeViewportCapture(extContext, handleScrollObservation)\n\tinitializeTerminalCapture(extContext, {\n\t\tonFocus: handleTerminalFocus,\n\t\tonCommand: handleTerminalCommand,\n\t\tonOutput: handleTerminalOutput,\n\t})\n\tawait initializeFilesystemWatcher(extContext, handleFileChange)\n\n\t// Subscribe to VS Code events\n\tsubscriptions.push(\n\t\tvscode.workspace.onDidChangeTextDocument(handleTextDocumentChange)\n\t)\n\tsubscriptions.push(\n\t\tvscode.window.onDidChangeTextEditorSelection(handleSelectionChange)\n\t)\n\tsubscriptions.push(\n\t\tvscode.window.onDidChangeActiveTextEditor(handleActiveEditorChange)\n\t)\n\n recording.isRecording = true\n\n\t// Start timer\n intervalId = setInterval(() => {\n\t\ttimer++\n updateStatusBarItem()\n }, 1000)\n\n\t// Capture initial observation\n\tconst initialObservation = captureObservation()\n\tlogObservation(initialObservation)\n\n\t// Set up upload interval\n\tuploadIntervalId = setInterval(async () => {\n\t\tawait uploadRecording()\n\t}, 5 * 60 * 1000) // 5 minutes\n\n notificationWithProgress('Recording started')\n\tlogToOutput('Recording started (v2.0)', 'info')\n\n updateStatusBarItem()\n updatePanicButton()\n actionsProvider.setRecordingState(true)\n\n\t// Set current file\n\tconst editor = vscode.window.activeTextEditor\n\tif (editor) {\n\t\tpreviousFile = vscode.workspace.asRelativePath(editor.document.fileName)\n\t\tactionsProvider.setCurrentFile(editor.document.fileName)\n }\n }\n\nexport async function stopRecording(force = false): Promise<void> {\n if (!recording.isRecording) {\n notificationWithProgress('Not recording')\n return\n }\n\n recording.isRecording = false\n\trecording.endDateTime = new Date()\n\n\t// Clear intervals\n\tif (intervalId) {\n clearInterval(intervalId)\n\t\tintervalId = null\n\t}\n\tif (uploadIntervalId) {\n\t\tclearInterval(uploadIntervalId)\n\t\tuploadIntervalId = null\n\t}\n if (panicButtonTimeoutId) {\n clearTimeout(panicButtonTimeoutId)\n panicButtonTimeoutId = undefined\n }\n\n\t// Dispose subscriptions\n\tfor (const subscription of subscriptions) {\n\t\tsubscription.dispose()\n\t}\n\tsubscriptions.length = 0\n\n\ttimer = 0\n\tpanicButtonPressCount = 0\n\n updateStatusBarItem()\n updatePanicButton()\n actionsProvider.setRecordingState(false)\n\n if (force) {\n notificationWithProgress('Recording cancelled')\n logToOutput('Recording cancelled', 'info')\n\t\trecording.events = []\n return\n }\n\n\t// Save recording\n\tawait saveRecording()\n\n notificationWithProgress('Recording finished')\n\tlogToOutput('Recording finished (v2.0)', 'info')\n}\n\n\nasync function saveRecording(): Promise<void> {\n\tconst exportPath = getExportPath()\n\tif (!exportPath || !recording.startDateTime) {\n return\n }\n\n\tconst baseFilePath = generateBaseFilePath(recording.startDateTime, false, undefined, recording.sessionId)\n\tif (!baseFilePath) {\n return\n }\n\n\tconst session: RecordingSession = {\n\t\tversion: '2.0',\n\t\tsessionId: recording.sessionId,\n\t\tstartTime: recording.startDateTime.getTime(),\n\t\tevents: recording.events,\n\t}\n\n\tconst jsonContent = JSON.stringify(session, null, 2)\n\tconst filePath = path.join(exportPath, `${baseFilePath}.json`)\n\n try {\n const directory = path.dirname(filePath)\n if (!fs.existsSync(directory)) {\n fs.mkdirSync(directory, { recursive: true })\n }\n\t\tawait fs.promises.writeFile(filePath, jsonContent)\n\t\tlogToOutput(`Recording saved to ${filePath}`, 'info')\n } catch (err) {\n\t\tlogToOutput(`Failed to save recording: ${err}`, 'error')\n}\n\n\t// Refresh the recordFiles view\n\tvscode.commands.executeCommand('crowd-code.refreshRecordFiles')\n}\n\nasync function uploadRecording(): Promise<void> {\n\tif (!recording.isRecording) {return}\n\tif (!hasConsent()) {return}\n\tif (typeof CROWD_CODE_API_GATEWAY_URL !== 'string' || !CROWD_CODE_API_GATEWAY_URL.trim()) {\n return\n }\n\n const exportPath = getExportPath()\n\tif (!exportPath || !recording.startDateTime) {\n return\n }\n\n\tconst baseFilePath = generateBaseFilePath(recording.startDateTime, false, undefined, recording.sessionId)\n\tif (!baseFilePath) {\n return\n }\n\n\tconst session: RecordingSession = {\n\t\tversion: '2.0',\n\t\tsessionId: recording.sessionId,\n\t\tstartTime: recording.startDateTime.getTime(),\n\t\tevents: recording.events,\n\t}\n\n\tconst jsonContent = JSON.stringify(session)\n\tconst extensionVersion = extContext.extension.packageJSON.version as string\n\tconst userId = extContext.globalState.get<string>('userId')\n\n\ttry {\n\t\tconst payload = {\n\t\t\tfileName: `${baseFilePath}.json`,\n\t\t\tcontent: jsonContent,\n\t\t\tversion: extensionVersion,\n\t\t\tuserId,\n\t\t}\n\t\tawait axios.post(CROWD_CODE_API_GATEWAY_URL, payload)\n\t\tlogToOutput(`Successfully uploaded recording`, 'info')\n\t} catch (error: unknown) {\n\t\tif (axios.isAxiosError(error)) {\n\t\t\tlogToOutput(`Error uploading recording: ${error.message}`, 'error')\n\t\t}\n\t}\n}\n\n\nexport function updateStatusBarItem(): void {\n if (recording.isRecording) {\n if (getConfig().get('appearance.showTimer') === false) {\n statusBarItem.text = '$(debug-stop)'\n\t\t\tstatusBarItem.tooltip = 'Current time: ' + formatDisplayTime(timer)\n\t\t} else {\n\t\t\tstatusBarItem.text = '$(debug-stop) ' + formatDisplayTime(timer)\n statusBarItem.tooltip = 'Stop Recording'\n }\n statusBarItem.command = commands.stopRecording\n statusBarItem.show()\n } else {\n const editor = vscode.window.activeTextEditor\n if (!editor) {\n statusBarItem.hide()\n return\n }\n if (getConfig().get('appearance.minimalMode') === true) {\n statusBarItem.text = '$(circle-large-filled)'\n } else {\n statusBarItem.text = '$(circle-large-filled) Start Recording'\n }\n statusBarItem.tooltip = 'Start Recording'\n statusBarItem.command = commands.startRecording\n statusBarItem.show()\n }\n}\n\n\nexport function updatePanicButton(): void {\n if (!recording.isRecording) {\n if (panicStatusBarItem) {\n panicStatusBarItem.hide()\n }\n return\n }\n\n if (!panicStatusBarItem) {\n\t\tpanicStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 8999)\n extContext.subscriptions.push(panicStatusBarItem)\n }\n\n\tconst secondsToRemove = (panicButtonPressCount + 1) * 10\n panicStatusBarItem.text = '$(refresh)'\n\tpanicStatusBarItem.tooltip = `Remove last ${secondsToRemove} seconds of recording`\n panicStatusBarItem.command = commands.panicButton\n panicStatusBarItem.show()\n}\n\nexport async function panicButton(): Promise<void> {\n if (!recording.isRecording) {\n vscode.window.showWarningMessage('No active recording to remove data from')\n return\n }\n\n if (!recording.startDateTime) {\n vscode.window.showErrorMessage('Recording start time not available')\n return\n }\n\n\tconst secondsToRemove = (panicButtonPressCount + 1) * 10\n\tconst cutoffTime = Date.now() - (secondsToRemove * 1000)\n\n\t// Remove events after cutoff time\n\tconst originalCount = recording.events.length\n\trecording.events = recording.events.filter(event => event.timestamp < cutoffTime)\n\tconst removedCount = originalCount - recording.events.length\n\n\t// Update sequence to match\n\tif (recording.events.length > 0) {\n\t\trecording.sequence = recording.events[recording.events.length - 1].sequence\n\t} else {\n\t\trecording.sequence = 0\n\t}\n\n panicButtonPressCount++\n \n\t// Reset timeout\n if (panicButtonTimeoutId) {\n clearTimeout(panicButtonTimeoutId)\n }\n panicButtonTimeoutId = setTimeout(() => {\n panicButtonPressCount = 0\n updatePanicButton()\n }, PANIC_BUTTON_TIMEOUT)\n \n updatePanicButton()\n \n vscode.window.showInformationMessage(\n\t\t`Removed ${removedCount} events (last ${secondsToRemove} seconds)`,\n 'Dismiss'\n )\n }\n",typescript,tab
34
+ 33,1520604,"src/recording.ts",295,0,"",typescript,selection_command
35
+ 34,1524349,"src/recording.ts",302,0,"",typescript,selection_command
36
+ 35,1524451,"src/recording.ts",304,0,"",typescript,selection_command
37
+ 36,1525207,"src/recording.ts",314,0,"",typescript,selection_command
38
+ 37,1525381,"src/recording.ts",316,0,"",typescript,selection_command
39
+ 38,1526245,"src/recording.ts",1934,0,"",typescript,selection_command
40
+ 39,1532678,"src/recording.ts",1940,0,"",typescript,selection_command
41
+ 40,1536737,"src/recording.ts",5924,0,"",typescript,selection_command
42
+ 41,1550603,"src/recording.ts",5922,0,"",typescript,selection_command
43
+ 42,1550727,"src/recording.ts",5915,0,"",typescript,selection_command
44
+ 43,1550875,"src/recording.ts",5914,0,"",typescript,selection_command
45
+ 44,1551201,"src/recording.ts",5909,0,"",typescript,selection_command
46
+ 45,1551913,"src/recording.ts",5862,0,"",typescript,selection_command
47
+ 46,1552337,"src/recording.ts",5673,0,"",typescript,selection_command
48
+ 47,1553084,"src/recording.ts",5862,0,"",typescript,selection_command
49
+ 48,1566724,"src/recording.ts",0,0,"",typescript,selection_command
50
+ 49,1567660,"src/recording.ts",1194,0,"",typescript,selection_keyboard
51
+ 50,1567758,"src/recording.ts",2525,0,"",typescript,selection_keyboard
52
+ 51,1567839,"src/recording.ts",3740,0,"",typescript,selection_keyboard
53
+ 52,1568337,"src/recording.ts",2525,0,"",typescript,selection_keyboard
54
+ 53,1568488,"src/recording.ts",1194,0,"",typescript,selection_keyboard
55
+ 54,1569336,"src/recording.ts",1581,0,"",typescript,selection_keyboard
56
+ 55,1571528,"src/recording.ts",1632,0,"",typescript,selection_command
57
+ 56,1571777,"src/recording.ts",1646,0,"",typescript,selection_command
58
+ 57,1571817,"src/recording.ts",1685,0,"",typescript,selection_command
59
+ 58,1571844,"src/recording.ts",1742,0,"",typescript,selection_command
60
+ 59,1571875,"src/recording.ts",1772,0,"",typescript,selection_command
61
+ 60,1572437,"src/recording.ts",2001,0,"",typescript,selection_command
62
+ 61,1573980,"src/recording.ts",2000,0,"",typescript,selection_command
63
+ 62,1574123,"src/recording.ts",1934,0,"",typescript,selection_command
64
+ 63,1574274,"src/recording.ts",1900,0,"",typescript,selection_command
65
+ 64,1574543,"src/recording.ts",1934,0,"",typescript,selection_command
66
+ 65,1575158,"src/recording.ts",1940,0,"",typescript,selection_command
67
+ 66,1575411,"src/recording.ts",1965,0,"",typescript,selection_command
68
+ 67,1575435,"src/recording.ts",1967,0,"",typescript,selection_command
69
+ 68,1575471,"src/recording.ts",1972,0,"",typescript,selection_command
70
+ 69,1577164,"src/recording.ts",2000,0,"",typescript,selection_command
71
+ 70,1577276,"src/recording.ts",2039,0,"",typescript,selection_command
72
+ 71,1577498,"src/recording.ts",2093,0,"",typescript,selection_command
73
+ 72,1577834,"src/recording.ts",2039,0,"",typescript,selection_command
74
+ 73,1578305,"src/recording.ts",2001,0,"",typescript,selection_command
75
+ 74,1581865,"src/recording.ts",2001,70,"",typescript,content
76
+ 75,1582167,"src/recording.ts",3670,0,"",typescript,selection_command
77
+ 76,2305795,"src/recording.ts",0,0,"",typescript,tab
78
+ 77,2305795,"src/recording.ts",295,0,"",typescript,selection_command
79
+ 78,2380863,"src/capture/filesystemWatcher.ts",0,0,"/**\n * Filesystem Watcher Module\n * Watches for file changes from external sources (agents, git operations)\n */\n\nimport * as vscode from 'vscode'\nimport * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport { createTwoFilesPatch } from 'diff'\nimport ignore, { type Ignore } from 'ignore'\nimport { LRUCache } from 'lru-cache'\n\n// Configuration\nconst DEBOUNCE_WINDOW_MS = 500\nconst MAX_CACHE_SIZE = 5000\n\nexport type FileChangeCallback = (\n\tfile: string,\n\tchangeType: 'create' | 'change' | 'delete',\n\toldContent: string | null,\n\tnewContent: string | null\n) => void\n\nlet fileChangeCallback!: FileChangeCallback\n\nlet gitignoreMatcher: Ignore | null = null\nlet workspaceRoot: string | null = null\nlet workspaceFolder: vscode.WorkspaceFolder | null = null\n\n// File content cache for diff computation (using lru-cache)\nconst fileCache = new LRUCache<string, string>({ max: MAX_CACHE_SIZE })\n\n// Debounce tracking\nconst pendingChanges = new Map<string, {\n\ttype: 'create' | 'change' | 'delete'\n\ttimeout: NodeJS.Timeout\n}>()\n\n// Filesystem watcher\nlet fileWatcher: vscode.FileSystemWatcher | null = null\n\n/**\n * Check if a file path should be excluded from watching\n */\nfunction isExcluded(filePath: string): boolean {\n\tif (!workspaceRoot || !gitignoreMatcher) {\n\t\treturn false\n\t}\n\n\tconst relativePath = path.relative(workspaceRoot, filePath).replace(/\\/g, '/')\n\treturn gitignoreMatcher.ignores(relativePath)\n}\n\n/**\n * Load gitignore patterns from workspace\n */\nfunction loadGitignore(): void {\n\tconst folder = vscode.workspace.workspaceFolders?.[0]\n\tif (!folder) {\n\t\treturn\n\t}\n\n\tworkspaceFolder = folder\n\tworkspaceRoot = folder.uri.fsPath\n\t\n\tconst ig = ignore()\n\tig.add('.git')\n\t\n\ttry {\n\t\tconst gitignorePath = path.join(workspaceRoot, '.gitignore')\n\t\tconst content = fs.readFileSync(gitignorePath, 'utf-8')\n\t\tig.add(content)\n\t} catch {\n\t\t// .gitignore doesn't exist or can't be read\n\t}\n\t\n\tgitignoreMatcher = ig\n}\n\n/**\n * Check if a file should be tracked (respects VS Code's files.exclude)\n */\nasync function shouldTrackFile(filePath: string): Promise<boolean> {\n\tif (fileCache.has(filePath)) return true\n\tif (isExcluded(filePath)) return false\n\tif (!workspaceRoot || !workspaceFolder) return false\n\t\n\tconst relativePath = path.relative(workspaceRoot, filePath).replace(/\\/g, '/')\n\tconst matches = await vscode.workspace.findFiles(\n\t\tnew vscode.RelativePattern(workspaceFolder, relativePath)\n\t)\n\treturn matches.length > 0\n}\n\n/**\n * Compute a unified diff between old and new content\n * Returns a string representation of the changes in unified diff format\n */\nfunction computeDiff(oldContent: string | null, newContent: string | null, filePath?: string): string | null {\n\tif (oldContent === null && newContent === null) {\n\t\treturn null\n\t}\n\n\tif (oldContent === newContent) {\n\t\treturn null\n\t}\n\n\tconst fileName = filePath ? path.basename(filePath) : 'file'\n\tconst oldStr = oldContent ?? ''\n\tconst newStr = newContent ?? ''\n\n\t// createTwoFilesPatch produces a standard unified diff\n\tconst patch = createTwoFilesPatch(\n\t\t`a/${fileName}`,\n\t\t`b/${fileName}`,\n\t\toldStr,\n\t\tnewStr,\n\t\t'',\n\t\t'',\n\t\t{ context: 3 }\n\t)\n\n\treturn patch\n}\n\n\n\n/**\n * Read file content safely\n */\nasync function readFileContent(filePath: string): Promise<string | null> {\n\ttry {\n\t\tconst content = await fs.promises.readFile(filePath, 'utf-8')\n\t\treturn content\n\t} catch {\n\t\treturn null\n\t}\n}\n\n\n/**\n * Process a file change event (after debounce)\n */\nasync function processFileChange(\n\tfilePath: string,\n\tchangeType: 'create' | 'change' | 'delete'\n): Promise<void> {\n\t// For new files not in cache, check if we should track them\n\tif (!fileCache.has(filePath) && changeType !== 'delete') {\n\t\tconst shouldTrack = await shouldTrackFile(filePath)\n\t\tif (!shouldTrack) {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif (changeType === 'delete') {\n\t\tconst oldContent = fileCache.get(filePath) ?? null\n\t\tfileCache.delete(filePath)\n\t\tfileChangeCallback(filePath, changeType, oldContent, null)\n\t\treturn\n\t}\n\n\tconst oldContent = fileCache.get(filePath) ?? null\n\tconst newContent = await readFileContent(filePath)\n\tif (newContent === null) {\n\t\treturn\n\t}\n\n\t// Check if content actually changed\n\tif (oldContent === newContent && changeType !== 'create') {\n\t\treturn\n\t}\n\n\tfileCache.set(filePath, newContent)\n\tfileChangeCallback(filePath, changeType, oldContent, newContent)\n}\n\n/**\n * Handle a file system event with debouncing\n */\nfunction handleFileEvent(uri: vscode.Uri, eventType: 'create' | 'change' | 'delete'): void {\n\tconst filePath = uri.fsPath\n\n\tif (isExcluded(filePath)) {\n\t\treturn\n\t}\n\n\tconst pending = pendingChanges.get(filePath)\n\tif (pending) {\n\t\tclearTimeout(pending.timeout)\n\t}\n\n\tconst timeout = setTimeout(() => {\n\t\tpendingChanges.delete(filePath)\n\t\tprocessFileChange(filePath, eventType)\n\t}, DEBOUNCE_WINDOW_MS)\n\n\tpendingChanges.set(filePath, {\n\t\ttype: eventType,\n\t\ttimeout\n\t})\n}\n\n/**\n * Background initialization: cache all workspace files\n */\nasync function initializeCacheBackground(): Promise<void> {\n\tconst files = await vscode.workspace.findFiles('**/*')\n\t\n\tfor (const file of files) {\n\t\tif (isExcluded(file.fsPath)) continue\n\t\t\n\t\t// Yield to event loop between files to avoid blocking\n\t\tawait new Promise(resolve => setImmediate(resolve))\n\t\t\n\t\ttry {\n\t\t\tconst content = await vscode.workspace.fs.readFile(file)\n\t\t\tfileCache.set(file.fsPath, content.toString())\n\t\t} catch {\n\t\t\t// File might have been deleted or is unreadable, ignore\n\t\t}\n\t}\n}\n\n\n/**\n * Initialize the filesystem watcher\n */\nexport async function initializeFilesystemWatcher(\n\tcontext: vscode.ExtensionContext,\n\tonFileChange: FileChangeCallback\n): Promise<void> {\n\tfileChangeCallback = onFileChange\n\n\tif (fileWatcher) {\n\t\treturn\n\t}\n\n\tconst folder = vscode.workspace.workspaceFolders?.[0]\n\tif (!folder) {\n\t\treturn\n\t}\n\n\tloadGitignore()\n\n\tinitializeCacheBackground()\n\n\tfileWatcher = vscode.workspace.createFileSystemWatcher(\n\t\tnew vscode.RelativePattern(folder, '**/*')\n\t)\n\n\tfileWatcher.onDidCreate((uri) => handleFileEvent(uri, 'create'))\n\tfileWatcher.onDidChange((uri) => handleFileEvent(uri, 'change'))\n\tfileWatcher.onDidDelete((uri) => handleFileEvent(uri, 'delete'))\n\n\tcontext.subscriptions.push(fileWatcher)\n}\n\n/**\n * Cleanup the filesystem watcher\n */\nexport function cleanupFilesystemWatcher(): void {\n\tif (fileWatcher) {\n\t\tfileWatcher.dispose()\n\t\tfileWatcher = null\n\t}\n\n\t// Clear pending changes\n\tfor (const [, pending] of pendingChanges) {\n\t\tclearTimeout(pending.timeout)\n\t}\n\tpendingChanges.clear()\n}\n\n/**\n * Reset the filesystem watcher state (invalidate cache)\n */\nexport function resetFilesystemState(): void {\n\tfileCache.clear()\n\n\t// Clear pending changes\n\tfor (const [, pending] of pendingChanges) {\n\t\tclearTimeout(pending.timeout)\n\t}\n\tpendingChanges.clear()\n}\n\n",typescript,tab
80
+ 79,2384086,"src/capture/filesystemWatcher.ts",4474,0,"",typescript,selection_keyboard
81
+ 80,2384191,"src/capture/filesystemWatcher.ts",3310,0,"",typescript,selection_keyboard
82
+ 81,2384333,"src/capture/filesystemWatcher.ts",2108,0,"",typescript,selection_keyboard
83
+ 82,2384466,"src/capture/filesystemWatcher.ts",995,0,"",typescript,selection_keyboard
84
+ 83,2384719,"src/capture/filesystemWatcher.ts",0,0,"",typescript,selection_keyboard
85
+ 84,2388729,"src/capture/filesystemWatcher.ts",1282,0,"",typescript,selection_keyboard
86
+ 85,2389093,"src/capture/filesystemWatcher.ts",2564,0,"",typescript,selection_keyboard
87
+ 86,2390212,"src/capture/filesystemWatcher.ts",3531,0,"",typescript,selection_keyboard
88
+ 87,2390737,"src/capture/filesystemWatcher.ts",4750,0,"",typescript,selection_keyboard
89
+ 88,2391093,"src/capture/filesystemWatcher.ts",5743,0,"",typescript,selection_keyboard
90
+ 89,2391270,"src/capture/filesystemWatcher.ts",6682,0,"",typescript,selection_keyboard
91
+ 90,2392340,"src/capture/filesystemWatcher.ts",0,6682,"/**\n * Filesystem Watcher Module\n * Watches for file changes from external sources (agents, git operations)\n */\n\nimport * as vscode from 'vscode'\nimport * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport { createTwoFilesPatch } from 'diff'\nimport ignore, { type Ignore } from 'ignore'\nimport { LRUCache } from 'lru-cache'\n\n// Configuration\nconst DEBOUNCE_WINDOW_MS = 500\nconst MAX_CACHE_SIZE = 5000\n\nexport type FileChangeCallback = (\n\tfile: string,\n\tchangeType: 'create' | 'change' | 'delete',\n\toldContent: string | null,\n\tnewContent: string | null\n) => void\n\nlet fileChangeCallback!: FileChangeCallback\n\nlet gitignoreMatcher: Ignore | null = null\nlet workspaceRoot: string | null = null\nlet workspaceFolder: vscode.WorkspaceFolder | null = null\n\n// File content cache for diff computation (using lru-cache)\nconst fileCache = new LRUCache<string, string>({ max: MAX_CACHE_SIZE })\n\n// Debounce tracking\nconst pendingChanges = new Map<string, {\n\ttype: 'create' | 'change' | 'delete'\n\ttimeout: NodeJS.Timeout\n}>()\n\n// Filesystem watcher\nlet fileWatcher: vscode.FileSystemWatcher | null = null\n\n/**\n * Check if a file path should be excluded from watching\n */\nfunction isExcluded(filePath: string): boolean {\n\tif (!workspaceRoot || !gitignoreMatcher) {\n\t\treturn false\n\t}\n\n\tconst relativePath = path.relative(workspaceRoot, filePath).replace(/\\/g, '/')\n\treturn gitignoreMatcher.ignores(relativePath)\n}\n\n/**\n * Load gitignore patterns from workspace\n */\nfunction loadGitignore(): void {\n\tconst folder = vscode.workspace.workspaceFolders?.[0]\n\tif (!folder) {\n\t\treturn\n\t}\n\n\tworkspaceFolder = folder\n\tworkspaceRoot = folder.uri.fsPath\n\t\n\tconst ig = ignore()\n\tig.add('.git')\n\t\n\ttry {\n\t\tconst gitignorePath = path.join(workspaceRoot, '.gitignore')\n\t\tconst content = fs.readFileSync(gitignorePath, 'utf-8')\n\t\tig.add(content)\n\t} catch {\n\t\t// .gitignore doesn't exist or can't be read\n\t}\n\t\n\tgitignoreMatcher = ig\n}\n\n/**\n * Check if a file should be tracked (respects VS Code's files.exclude)\n */\nasync function shouldTrackFile(filePath: string): Promise<boolean> {\n\tif (fileCache.has(filePath)) return true\n\tif (isExcluded(filePath)) return false\n\tif (!workspaceRoot || !workspaceFolder) return false\n\t\n\tconst relativePath = path.relative(workspaceRoot, filePath).replace(/\\/g, '/')\n\tconst matches = await vscode.workspace.findFiles(\n\t\tnew vscode.RelativePattern(workspaceFolder, relativePath)\n\t)\n\treturn matches.length > 0\n}\n\n/**\n * Compute a unified diff between old and new content\n * Returns a string representation of the changes in unified diff format\n */\nfunction computeDiff(oldContent: string | null, newContent: string | null, filePath?: string): string | null {\n\tif (oldContent === null && newContent === null) {\n\t\treturn null\n\t}\n\n\tif (oldContent === newContent) {\n\t\treturn null\n\t}\n\n\tconst fileName = filePath ? path.basename(filePath) : 'file'\n\tconst oldStr = oldContent ?? ''\n\tconst newStr = newContent ?? ''\n\n\t// createTwoFilesPatch produces a standard unified diff\n\tconst patch = createTwoFilesPatch(\n\t\t`a/${fileName}`,\n\t\t`b/${fileName}`,\n\t\toldStr,\n\t\tnewStr,\n\t\t'',\n\t\t'',\n\t\t{ context: 3 }\n\t)\n\n\treturn patch\n}\n\n\n\n/**\n * Read file content safely\n */\nasync function readFileContent(filePath: string): Promise<string | null> {\n\ttry {\n\t\tconst content = await fs.promises.readFile(filePath, 'utf-8')\n\t\treturn content\n\t} catch {\n\t\treturn null\n\t}\n}\n\n\n/**\n * Process a file change event (after debounce)\n */\nasync function processFileChange(\n\tfilePath: string,\n\tchangeType: 'create' | 'change' | 'delete'\n): Promise<void> {\n\t// For new files not in cache, check if we should track them\n\tif (!fileCache.has(filePath) && changeType !== 'delete') {\n\t\tconst shouldTrack = await shouldTrackFile(filePath)\n\t\tif (!shouldTrack) {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif (changeType === 'delete') {\n\t\tconst oldContent = fileCache.get(filePath) ?? null\n\t\tfileCache.delete(filePath)\n\t\tfileChangeCallback(filePath, changeType, oldContent, null)\n\t\treturn\n\t}\n\n\tconst oldContent = fileCache.get(filePath) ?? null\n\tconst newContent = await readFileContent(filePath)\n\tif (newContent === null) {\n\t\treturn\n\t}\n\n\t// Check if content actually changed\n\tif (oldContent === newContent && changeType !== 'create') {\n\t\treturn\n\t}\n\n\tfileCache.set(filePath, newContent)\n\tfileChangeCallback(filePath, changeType, oldContent, newContent)\n}\n\n/**\n * Handle a file system event with debouncing\n */\nfunction handleFileEvent(uri: vscode.Uri, eventType: 'create' | 'change' | 'delete'): void {\n\tconst filePath = uri.fsPath\n\n\tif (isExcluded(filePath)) {\n\t\treturn\n\t}\n\n\tconst pending = pendingChanges.get(filePath)\n\tif (pending) {\n\t\tclearTimeout(pending.timeout)\n\t}\n\n\tconst timeout = setTimeout(() => {\n\t\tpendingChanges.delete(filePath)\n\t\tprocessFileChange(filePath, eventType)\n\t}, DEBOUNCE_WINDOW_MS)\n\n\tpendingChanges.set(filePath, {\n\t\ttype: eventType,\n\t\ttimeout\n\t})\n}\n\n/**\n * Background initialization: cache all workspace files\n */\nasync function initializeCacheBackground(): Promise<void> {\n\tconst files = await vscode.workspace.findFiles('**/*')\n\t\n\tfor (const file of files) {\n\t\tif (isExcluded(file.fsPath)) continue\n\t\t\n\t\t// Yield to event loop between files to avoid blocking\n\t\tawait new Promise(resolve => setImmediate(resolve))\n\t\t\n\t\ttry {\n\t\t\tconst content = await vscode.workspace.fs.readFile(file)\n\t\t\tfileCache.set(file.fsPath, content.toString())\n\t\t} catch {\n\t\t\t// File might have been deleted or is unreadable, ignore\n\t\t}\n\t}\n}\n\n\n/**\n * Initialize the filesystem watcher\n */\nexport async function initializeFilesystemWatcher(\n\tcontext: vscode.ExtensionContext,\n\tonFileChange: FileChangeCallback\n): Promise<void> {\n\tfileChangeCallback = onFileChange\n\n\tif (fileWatcher) {\n\t\treturn\n\t}\n\n\tconst folder = vscode.workspace.workspaceFolders?.[0]\n\tif (!folder) {\n\t\treturn\n\t}\n\n\tloadGitignore()\n\n\tinitializeCacheBackground()\n\n\tfileWatcher = vscode.workspace.createFileSystemWatcher(\n\t\tnew vscode.RelativePattern(folder, '**/*')\n\t)\n\n\tfileWatcher.onDidCreate((uri) => handleFileEvent(uri, 'create'))\n\tfileWatcher.onDidChange((uri) => handleFileEvent(uri, 'change'))\n\tfileWatcher.onDidDelete((uri) => handleFileEvent(uri, 'delete'))\n\n\tcontext.subscriptions.push(fileWatcher)\n}\n\n/**\n * Cleanup the filesystem watcher\n */\nexport function cleanupFilesystemWatcher(): void {\n\tif (fileWatcher) {\n\t\tfileWatcher.dispose()\n\t\tfileWatcher = null\n\t}\n\n\t// Clear pending changes\n\tfor (const [, pending] of pendingChanges) {\n\t\tclearTimeout(pending.timeout)\n\t}\n\tpendingChanges.clear()\n}\n\n/**\n * Reset the filesystem watcher state (invalidate cache)\n */\nexport function resetFilesystemState(): void {\n\tfileCache.clear()\n\n\t// Clear pending changes\n\tfor (const [, pending] of pendingChanges) {\n\t\tclearTimeout(pending.timeout)\n\t}\n\tpendingChanges.clear()\n}\n\n",typescript,selection_command
92
+ 91,2392478,"src/capture/filesystemWatcher.ts",6682,0,"",typescript,selection_command
93
+ 92,2750139,"src/capture/filesystemWatcher.ts",412,0,"",typescript,selection_mouse
94
+ 93,2751435,"src/capture/filesystemWatcher.ts",3779,0,"",typescript,selection_command
95
+ 94,2752975,"src/capture/filesystemWatcher.ts",3861,0,"",typescript,selection_command
96
+ 95,2753167,"src/capture/filesystemWatcher.ts",4080,0,"",typescript,selection_command
97
+ 96,2754364,"src/capture/filesystemWatcher.ts",4229,0,"",typescript,selection_command
98
+ 97,2757751,"src/recording.ts",0,0,"",typescript,tab
99
+ 98,2757755,"src/recording.ts",295,0,"",typescript,selection_command
100
+ 99,2758960,"src/recording.ts",2021,0,"",typescript,selection_command
101
+ 100,2760449,"src/recording.ts",3672,0,"",typescript,selection_command
102
+ 101,2765935,"src/recording.ts",5452,0,"",typescript,selection_command
103
+ 102,2770541,"src/recording.ts",5717,0,"",typescript,selection_command
104
+ 103,2772467,"src/recording.ts",8037,0,"",typescript,selection_command
105
+ 104,2773569,"src/recording.ts",8605,0,"",typescript,selection_command
106
+ 105,2774841,"src/recording.ts",8864,0,"",typescript,selection_command
107
+ 106,2775940,"src/recording.ts",9230,0,"",typescript,selection_command
108
+ 107,2777992,"src/recording.ts",9611,0,"",typescript,selection_command
109
+ 108,2778655,"src/recording.ts",9754,0,"",typescript,selection_command
110
+ 109,2781547,"src/recording.ts",10093,0,"",typescript,selection_command
111
+ 110,2784724,"src/recording.ts",11903,0,"",typescript,selection_command
112
+ 111,2851277,"src/recording.ts",10096,0,"",typescript,selection_command
113
+ 112,2852618,"src/recording.ts",10211,6,"",typescript,content
114
+ 113,2852640,"src/recording.ts",10180,22,"diff",typescript,content
115
+ 114,2852641,"src/recording.ts",10159,16,"filterUserEditsFrom",typescript,content
116
+ 115,2852651,"src/recording.ts",10138,0,"d hunk",typescript,content
117
+ 116,2852652,"src/recording.ts",10134,3,"",typescript,content
118
+ 117,2852659,"src/recording.ts",10111,21," and filter out user-mat",typescript,content
119
+ 118,2852664,"src/recording.ts",10097,9,"Parse",typescript,content
120
+ 119,2852685,"src/recording.ts",10021,19,"",typescript,content
121
+ 120,2852686,"src/recording.ts",9891,0,"e'",typescript,content
122
+ 121,2852698,"src/recording.ts",9890,0,"geType === 'crea",typescript,content
123
+ 122,2852701,"src/recording.ts",9889,0,"' || cha",typescript,content
124
+ 123,2852702,"src/recording.ts",9880,7,"changeType === 'dele",typescript,content
125
+ 124,2852707,"src/recording.ts",9876,0,"e) or create, record as agent\n\tif (!diff",typescript,content
126
+ 125,2852723,"src/recording.ts",9875,0,"\n\t}\n\n\t// If no diff (dele",typescript,content
127
+ 126,2852752,"src/recording.ts",9874,0,"tur",typescript,content
128
+ 127,2852765,"src/recording.ts",9873,0,"ion(action)\n\t\tr",typescript,content
129
+ 128,2852768,"src/recording.ts",9872,0,"AndAc",typescript,content
130
+ 129,2852770,"src/recording.ts",9861,9,") {\n\t\tconst action: FileChangeAction = {\n\t\t\tkind: 'file_change',\n\t\t\tsource: 'agent',\n\t\t\tfile: relativePath,\n\t\t\tchangeType,\n\t\t\tdiff,\n\t\t}\n\t\tlogObservati",typescript,content
131
+ 130,2852787,"src/recording.ts",9815,1,"i",typescript,content
132
+ 131,2852789,"src/recording.ts",9800,9,"",typescript,content
133
+ 132,2852796,"src/recording.ts",9796,2,"i",typescript,content
134
+ 133,2852804,"src/recording.ts",9778,15,"",typescript,content
135
+ 134,2852805,"src/recording.ts",9777,0,",",typescript,content
136
+ 135,2852812,"src/recording.ts",9752,0," // Clear regardless",typescript,content
137
+ 136,2852814,"src/recording.ts",9619,10,"",typescript,content
138
+ 137,2852819,"src/recording.ts",9539,19,"",typescript,content
139
+ 138,2852822,"src/recording.ts",8862,366,"",typescript,content
140
+ 139,2852824,"src/recording.ts",8753,1,"",typescript,content
141
+ 140,2852826,"src/recording.ts",8698,40," diff",typescript,content
142
+ 141,2852836,"src/recording.ts",8653,2," ",typescript,content
143
+ 142,2852839,"src/recording.ts",8638,2,"",typescript,content
144
+ 143,2852848,"src/recording.ts",5883,6,".end.line",typescript,content
145
+ 144,2852849,"src/recording.ts",5858,11,"endLine",typescript,content
146
+ 145,2852852,"src/recording.ts",5847,6,".start.line",typescript,content
147
+ 146,2852853,"src/recording.ts",5822,11,"startLine",typescript,content
148
+ 147,2852855,"src/recording.ts",4758,0,"return formatPatch(patch",typescript,content
149
+ 148,2852856,"src/recording.ts",4715,41,"})\n\n\tif (filteredHunks.length === 0) {return null}\n\n\t// Reconstruct diff with only unmatched hunks\n\tpatch.hunks = filteredHunks",typescript,content
150
+ 149,2852863,"src/recording.ts",4713,0," pendingEdits)",typescript,content
151
+ 150,2852867,"src/recording.ts",4612,97,"hunks.filter(hunk => {\n\t\tconst hunkStartLine = hunk.oldStart\n\t\tconst hunkEndLine = hunk.oldStart + hunk.oldLines - 1\n\t\treturn !isHunkMatchedByUserEdit(hunkStartLine, hunkEndL",typescript,content
152
+ 151,2852868,"src/recording.ts",4610,0,"c",typescript,content
153
+ 152,2852869,"src/recording.ts",4599,5,"teredHunks",typescript,content
154
+ 153,2852869,"src/recording.ts",4579,9," = patches[0]",typescript,content
155
+ 154,2852871,"src/recording.ts",4577,0,"pat",typescript,content
156
+ 155,2852872,"src/recording.ts",4564,11,"}\n\n\tcons",typescript,content
157
+ 156,2852874,"src/recording.ts",4550,3,"",typescript,content
158
+ 157,2852876,"src/recording.ts",4537,10,"0",typescript,content
159
+ 158,2852876,"src/recording.ts",4520,12,"patches.length",typescript,content
160
+ 159,2852880,"src/recording.ts",4461,53,"patches = parsePatch(diff)",typescript,content
161
+ 160,2852881,"src/recording.ts",4415,20,"",typescript,content
162
+ 161,2852899,"src/recording.ts",4388,7,"",typescript,content
163
+ 162,2852904,"src/recording.ts",4368,17," pend",typescript,content
164
+ 163,2852906,"src/recording.ts",4347,12,"diff",typescript,content
165
+ 164,2852917,"src/recording.ts",4326,16,"filterUserEditsFrom",typescript,content
166
+ 165,2852919,"src/recording.ts",4277,35,"only agent changes",typescript,content
167
+ 166,2852920,"src/recording.ts",4273,0,"eturn",typescript,content
168
+ 167,2852920,"src/recording.ts",4264,8,"",typescript,content
169
+ 168,2852921,"src/recording.ts",4263,0,",",typescript,content
170
+ 169,2852921,"src/recording.ts",4247,11,"d hunks from a unified",typescript,content
171
+ 170,2852922,"src/recording.ts",4245,0,"c",typescript,content
172
+ 171,2852928,"src/recording.ts",4244,0,"user-ma",typescript,content
173
+ 172,2852928,"src/recording.ts",4243,0,"r",typescript,content
174
+ 173,2852929,"src/recording.ts",4236,5,"Fil",typescript,content
175
+ 174,2852930,"src/recording.ts",4148,77,"endLine >= hunkStartLine\n\t)",typescript,content
176
+ 175,2852932,"src/recording.ts",4079,63,".startLine <= hunkEndLine &&",typescript,content
177
+ 176,2852934,"src/recording.ts",4064,11,"",typescript,content
178
+ 177,2852935,"src/recording.ts",4042,21,"",typescript,content
179
+ 178,2852937,"src/recording.ts",4008,32,"",typescript,content
180
+ 179,2852939,"src/recording.ts",3991,14,"",typescript,content
181
+ 180,2852940,"src/recording.ts",3911,76,"Edits.some(",typescript,content
182
+ 181,2852951,"src/recording.ts",3900,5,"urn p",typescript,content
183
+ 182,2852953,"src/recording.ts",3889,9,"",typescript,content
184
+ 183,2852954,"src/recording.ts",3883,5,"",typescript,content
185
+ 184,2852955,"src/recording.ts",3873,6,"boolean",typescript,content
186
+ 185,2852955,"src/recording.ts",3870,0,"\n",typescript,content
187
+ 186,2852957,"src/recording.ts",3831,20,"(\n\thunkStartLine: number,\n\thunkEndLine: number,\n\tpendingE",typescript,content
188
+ 187,2852961,"src/recording.ts",3818,4,"isHunkMatchedB",typescript,content
189
+ 188,2852968,"src/recording.ts",3780,24,"",typescript,content
190
+ 189,2852970,"src/recording.ts",3771,4,"",typescript,content
191
+ 190,2852971,"src/recording.ts",3679,87,"Check if a diff hunk overlaps with any pending",typescript,content
192
+ 191,2852974,"src/recording.ts",2043,11,"endLine",typescript,content
193
+ 192,2852980,"src/recording.ts",2022,11,"startLine",typescript,content
194
+ 193,2852983,"src/recording.ts",304,14,"parsePatch, format",typescript,content
195
+ 194,2852985,"src/recording.ts",3670,0,"",typescript,selection_command
196
+ 195,2853470,"src/recording.ts",304,18,"createTwoFiles",typescript,content
197
+ 196,2853471,"src/recording.ts",2022,9,"rangeOffset",typescript,content
198
+ 197,2853472,"src/recording.ts",2043,7,"rangeLength",typescript,content
199
+ 198,2853486,"src/recording.ts",3679,46,"Apply user edits to content to reconstruct what the file would look like\n * if only the",typescript,content
200
+ 199,2853493,"src/recording.ts",3771,0," had",typescript,content
201
+ 200,2853498,"src/recording.ts",3780,0,"ed it (no agent changes)",typescript,content
202
+ 201,2853499,"src/recording.ts",3818,14,"appl",typescript,content
203
+ 202,2853500,"src/recording.ts",3831,57,"s(content: string, e",typescript,content
204
+ 203,2853501,"src/recording.ts",3870,1,"",typescript,content
205
+ 204,2853502,"src/recording.ts",3873,7,"string",typescript,content
206
+ 205,2853505,"src/recording.ts",3883,0,"// So",typescript,content
207
+ 206,2853505,"src/recording.ts",3889,0,"t by offs",typescript,content
208
+ 207,2853514,"src/recording.ts",3900,5," desc",typescript,content
209
+ 208,2853516,"src/recording.ts",3911,11," to apply from end to start (preserves earlier offsets)\n\tconst sorted = [...",typescript,content
210
+ 209,2853517,"src/recording.ts",3991,0,"s].sort((a, b)",typescript,content
211
+ 210,2853518,"src/recording.ts",4008,0," b.rangeOffset - a.rangeOffset)\n",typescript,content
212
+ 211,2853519,"src/recording.ts",4042,0,"let result = content\n",typescript,content
213
+ 212,2853519,"src/recording.ts",4064,0,"for (const ",typescript,content
214
+ 213,2853520,"src/recording.ts",4079,28," of sorted) {\n\t\tresult = result.slice(0, edit.rangeOffset)\n\t\t\t+",typescript,content
215
+ 214,2853521,"src/recording.ts",4148,27,"text\n\t\t\t+ result.slice(edit.rangeOffset + edit.rangeLength)\n\t}\n\treturn result",typescript,content
216
+ 215,2853521,"src/recording.ts",4236,3,"Compu",typescript,content
217
+ 216,2853531,"src/recording.ts",4243,1,"",typescript,content
218
+ 217,2853537,"src/recording.ts",4244,7,"",typescript,content
219
+ 218,2853539,"src/recording.ts",4245,1,"",typescript,content
220
+ 219,2853539,"src/recording.ts",4247,22," agent-only",typescript,content
221
+ 220,2853544,"src/recording.ts",4263,1,"",typescript,content
222
+ 221,2853545,"src/recording.ts",4264,0,"by compa",typescript,content
223
+ 222,2853546,"src/recording.ts",4273,5,"",typescript,content
224
+ 223,2853547,"src/recording.ts",4277,18,"user baseline to actual new content",typescript,content
225
+ 224,2853553,"src/recording.ts",4326,19,"computeAgentOnly",typescript,content
226
+ 225,2853553,"src/recording.ts",4347,4,"\n\toldContent",typescript,content
227
+ 226,2853554,"src/recording.ts",4368,5,"\n\tnewContent: str",typescript,content
228
+ 227,2853555,"src/recording.ts",4388,0,",\n\tuser",typescript,content
229
+ 228,2853564,"src/recording.ts",4415,0,",\n\tfilePath: string\n",typescript,content
230
+ 229,2853572,"src/recording.ts",4461,26,"userBaseline = applyUserEdits(oldContent, userEdits)\n",typescript,content
231
+ 230,2853572,"src/recording.ts",4520,14,"userBaseline",typescript,content
232
+ 231,2853579,"src/recording.ts",4537,1,"newContent",typescript,content
233
+ 232,2853580,"src/recording.ts",4550,0,"\n\t\t",typescript,content
234
+ 233,2853581,"src/recording.ts",4564,8," // No agen",typescript,content
235
+ 234,2853582,"src/recording.ts",4577,3,"",typescript,content
236
+ 235,2853583,"src/recording.ts",4579,13,"anges\n\t}\n",typescript,content
237
+ 236,2853586,"src/recording.ts",4599,10,"eName",typescript,content
238
+ 237,2853587,"src/recording.ts",4610,1,"",typescript,content
239
+ 238,2853588,"src/recording.ts",4612,174,"basename(filePath)\n\treturn createTwoFilesPatch(\n\t\t`a/${fileName}`,\n\t\t`b/${fileName}`,\n\t\tuserBasel",typescript,content
240
+ 239,2853589,"src/recording.ts",4713,14,"",typescript,content
241
+ 240,2853590,"src/recording.ts",4715,127,"\tnewContent,\n\t\t'',\n\t\t'',\n\t\t{ context: 3 }",typescript,content
242
+ 241,2853591,"src/recording.ts",4758,24,"",typescript,content
243
+ 242,2853646,"src/recording.ts",5822,9,"rangeOffset",typescript,content
244
+ 243,2853646,"src/recording.ts",5847,11,"Offset",typescript,content
245
+ 244,2853647,"src/recording.ts",5858,7,"rangeLength",typescript,content
246
+ 245,2853648,"src/recording.ts",5883,9,"Length",typescript,content
247
+ 246,2853650,"src/recording.ts",8638,0,"\n\t",typescript,content
248
+ 247,2853650,"src/recording.ts",8653,1,"\n\t",typescript,content
249
+ 248,2853651,"src/recording.ts",8698,5,"\n\toldContent: string | null,\n\tnewContent",typescript,content
250
+ 249,2853657,"src/recording.ts",8753,0,"\n",typescript,content
251
+ 250,2853658,"src/recording.ts",8862,0,"\n\n\t// Helper to compute full diff\n\tconst computeFullDiff = (): string | null => {\n\t\tif (!oldContent && !newContent) {return null}\n\t\tif (oldContent === newContent) {return null}\n\t\tconst fileName = path.basename(file)\n\t\treturn createTwoFilesPatch(\n\t\t\t`a/${fileName}`,\n\t\t\t`b/${fileName}`,\n\t\t\toldContent ?? '',\n\t\t\tnewContent ?? '',\n\t\t\t'',\n\t\t\t'',\n\t\t\t{ context: 3 }\n\t\t)\n\t}",typescript,content
252
+ 251,2853719,"src/recording.ts",9539,0,": computeFullDiff()",typescript,content
253
+ 252,2853720,"src/recording.ts",9619,0,"and clear ",typescript,content
254
+ 253,2853722,"src/recording.ts",9752,20,"",typescript,content
255
+ 254,2853722,"src/recording.ts",9777,1,"",typescript,content
256
+ 255,2853723,"src/recording.ts",9778,0,"or missing cont",typescript,content
257
+ 256,2853724,"src/recording.ts",9796,1,", ",typescript,content
258
+ 257,2853724,"src/recording.ts",9800,0,"cord full",typescript,content
259
+ 258,2853725,"src/recording.ts",9815,1,"a",typescript,content
260
+ 259,2853726,"src/recording.ts",9861,150," || !oldC",typescript,content
261
+ 260,2853726,"src/recording.ts",9872,5,"",typescript,content
262
+ 261,2853727,"src/recording.ts",9873,15,"",typescript,content
263
+ 262,2853728,"src/recording.ts",9874,3,"",typescript,content
264
+ 263,2853728,"src/recording.ts",9875,25,"",typescript,content
265
+ 264,2853729,"src/recording.ts",9876,40,"",typescript,content
266
+ 265,2853729,"src/recording.ts",9880,20,"!newCon",typescript,content
267
+ 266,2853730,"src/recording.ts",9889,8,"",typescript,content
268
+ 267,2853731,"src/recording.ts",9890,16,"",typescript,content
269
+ 268,2853757,"src/recording.ts",9891,2,"",typescript,content
270
+ 269,2853758,"src/recording.ts",10021,0,": computeFullDiff()",typescript,content
271
+ 270,2853759,"src/recording.ts",10097,5,"Three-way",typescript,content
272
+ 271,2853759,"src/recording.ts",10111,24,": compute agent-only ",typescript,content
273
+ 272,2853760,"src/recording.ts",10134,0,"ang",typescript,content
274
+ 273,2853760,"src/recording.ts",10138,6,"",typescript,content
275
+ 274,2853761,"src/recording.ts",10159,19,"computeAgentOnly",typescript,content
276
+ 275,2853761,"src/recording.ts",10180,4,"oldContent, newContent",typescript,content
277
+ 276,2853762,"src/recording.ts",10211,0,", file",typescript,content
278
+ 277,2859017,"src/capture/filesystemWatcher.ts",0,0,"",typescript,tab
279
+ 278,2860290,"src/recording.ts",0,0,"",typescript,tab
280
+ 279,2938625,"src/capture/filesystemWatcher.ts",0,0,"",typescript,tab
281
+ 280,2941209,"src/capture/filesystemWatcher.ts",4534,0,"",typescript,selection_command
282
+ 281,2943004,"src/capture/filesystemWatcher.ts",922,0,"",typescript,selection_command
283
+ 282,2953972,"src/capture/filesystemWatcher.ts",923,0,"",typescript,selection_command
284
+ 283,2957509,"src/capture/filesystemWatcher.ts",4534,0,"",typescript,selection_command
285
+ 284,2963862,"src/capture/filesystemWatcher.ts",4653,0,"",typescript,selection_command
286
+ 285,2963996,"src/capture/filesystemWatcher.ts",4752,0,"",typescript,selection_command
287
+ 286,3097953,"src/capture/filesystemWatcher.ts",4981,0,"",typescript,selection_command
288
+ 287,3098539,"src/capture/filesystemWatcher.ts",4921,0,"",typescript,selection_command
289
+ 288,3099775,"src/capture/filesystemWatcher.ts",4981,0,"",typescript,selection_command
290
+ 289,3100264,"src/capture/filesystemWatcher.ts",2325,0,"",typescript,selection_command
291
+ 290,3103275,"src/capture/filesystemWatcher.ts",2244,0,"",typescript,selection_command
292
+ 291,3103344,"src/capture/filesystemWatcher.ts",2202,0,"",typescript,selection_command
293
+ 292,3103530,"src/capture/filesystemWatcher.ts",2188,0,"",typescript,selection_command
294
+ 293,3103643,"src/capture/filesystemWatcher.ts",2146,0,"",typescript,selection_command
295
+ 294,3103799,"src/capture/filesystemWatcher.ts",2106,0,"",typescript,selection_command
296
+ 295,3103987,"src/capture/filesystemWatcher.ts",2037,0,"",typescript,selection_command
297
+ 296,3104272,"src/capture/filesystemWatcher.ts",2036,0,"",typescript,selection_command
298
+ 297,3104396,"src/capture/filesystemWatcher.ts",2028,0,"",typescript,selection_command
299
+ 298,3104547,"src/capture/filesystemWatcher.ts",2027,0,"",typescript,selection_command
300
+ 299,3104709,"src/capture/filesystemWatcher.ts",2012,0,"",typescript,selection_command
301
+ 300,3105287,"src/capture/filesystemWatcher.ts",3681,0,"",typescript,selection_command
302
+ 301,3271987,"src/capture/filesystemWatcher.ts",2012,0,"",typescript,selection_command
303
+ 302,3273182,"src/capture/filesystemWatcher.ts",2081,0,"",typescript,selection_command
304
+ 303,3333190,"src/capture/filesystemWatcher.ts",2066,41,"\tif (fileCache.has(filePath)) return true",typescript,selection_command
305
+ 304,3345653,"src/capture/filesystemWatcher.ts",2081,0,"",typescript,selection_command
306
+ 305,3428982,"src/recording.ts",0,0,"",typescript,tab
307
+ 306,3428982,"src/recording.ts",295,0,"",typescript,selection_command
308
+ 307,3558142,"src/recording.ts",3835,0,"",typescript,selection_mouse
309
+ 308,3559734,"src/recording.ts",4048,0,"",typescript,selection_mouse
310
+ 309,3563838,"src/recording.ts",4096,0,"",typescript,selection_mouse
311
+ 310,3567379,"src/recording.ts",3672,0,"",typescript,selection_command
312
+ 311,3608517,"src/capture/filesystemWatcher.ts",0,0,"",typescript,tab
313
+ 312,3611045,"src/capture/filesystemWatcher.ts",864,0,"",typescript,selection_command
314
+ 313,3611187,"src/capture/filesystemWatcher.ts",353,0,"",typescript,selection_command
315
+ 314,3613860,"src/capture/filesystemWatcher.ts",336,0,"",typescript,selection_command
316
+ 315,3615031,"src/capture/filesystemWatcher.ts",864,0,"",typescript,selection_command
317
+ 316,3615240,"src/capture/filesystemWatcher.ts",3201,0,"",typescript,selection_command
318
+ 317,3616648,"src/capture/filesystemWatcher.ts",4123,0,"",typescript,selection_command
319
+ 318,3617336,"src/capture/filesystemWatcher.ts",4322,0,"",typescript,selection_command
320
+ 319,3621333,"src/capture/filesystemWatcher.ts",5829,0,"",typescript,selection_command
321
+ 320,3623078,"src/capture/filesystemWatcher.ts",5963,0,"",typescript,selection_command
322
+ 321,3624866,"src/capture/filesystemWatcher.ts",4933,0,"",typescript,selection_keyboard
323
+ 322,3625407,"src/capture/filesystemWatcher.ts",3756,0,"",typescript,selection_keyboard
324
+ 323,3627358,"src/capture/filesystemWatcher.ts",3808,0,"",typescript,selection_command
325
+ 324,3627602,"src/capture/filesystemWatcher.ts",3860,0,"",typescript,selection_command
326
+ 325,3627632,"src/capture/filesystemWatcher.ts",3888,0,"",typescript,selection_command
327
+ 326,3627666,"src/capture/filesystemWatcher.ts",3897,0,"",typescript,selection_command
328
+ 327,3627702,"src/capture/filesystemWatcher.ts",3900,0,"",typescript,selection_command
329
+ 328,3627733,"src/capture/filesystemWatcher.ts",3901,0,"",typescript,selection_command
330
+ 329,3627766,"src/capture/filesystemWatcher.ts",3939,0,"",typescript,selection_command
331
+ 330,3627801,"src/capture/filesystemWatcher.ts",4000,0,"",typescript,selection_command
332
+ 331,3627836,"src/capture/filesystemWatcher.ts",4009,0,"",typescript,selection_command
333
+ 332,3627875,"src/capture/filesystemWatcher.ts",4012,0,"",typescript,selection_command
334
+ 333,3627914,"src/capture/filesystemWatcher.ts",4013,0,"",typescript,selection_command
335
+ 334,3627950,"src/capture/filesystemWatcher.ts",4050,0,"",typescript,selection_command
336
+ 335,3627979,"src/capture/filesystemWatcher.ts",4116,0,"",typescript,selection_command
337
+ 336,3628005,"src/capture/filesystemWatcher.ts",4118,0,"",typescript,selection_command
338
+ 337,3628030,"src/capture/filesystemWatcher.ts",4119,0,"",typescript,selection_command
339
+ 338,3628068,"src/capture/filesystemWatcher.ts",4123,0,"",typescript,selection_command
340
+ 339,3628103,"src/capture/filesystemWatcher.ts",4153,0,"",typescript,selection_command
341
+ 340,3628131,"src/capture/filesystemWatcher.ts",4157,0,"",typescript,selection_command
342
+ 341,3628182,"src/capture/filesystemWatcher.ts",4250,0,"",typescript,selection_command
343
+ 342,3628213,"src/capture/filesystemWatcher.ts",4279,0,"",typescript,selection_command
344
+ 343,3628257,"src/capture/filesystemWatcher.ts",4280,0,"",typescript,selection_command
345
+ 344,3628276,"src/capture/filesystemWatcher.ts",4309,0,"",typescript,selection_command
346
+ 345,3628300,"src/capture/filesystemWatcher.ts",4318,0,"",typescript,selection_command
347
+ 346,3628338,"src/capture/filesystemWatcher.ts",4321,0,"",typescript,selection_command
348
+ 347,3628511,"src/capture/filesystemWatcher.ts",4322,0,"",typescript,selection_command
349
+ 348,3628774,"src/capture/filesystemWatcher.ts",4321,0,"",typescript,selection_command
350
+ 349,3628963,"src/capture/filesystemWatcher.ts",4322,0,"",typescript,selection_command
351
+ 350,3629394,"src/capture/filesystemWatcher.ts",4321,0,"",typescript,selection_command
352
+ 351,3629636,"src/capture/filesystemWatcher.ts",4318,0,"",typescript,selection_command
353
+ 352,3629669,"src/capture/filesystemWatcher.ts",4309,0,"",typescript,selection_command
354
+ 353,3629702,"src/capture/filesystemWatcher.ts",4280,0,"",typescript,selection_command
355
+ 354,3629735,"src/capture/filesystemWatcher.ts",4279,0,"",typescript,selection_command
356
+ 355,3629768,"src/capture/filesystemWatcher.ts",4250,0,"",typescript,selection_command
357
+ 356,3630089,"src/capture/filesystemWatcher.ts",4157,0,"",typescript,selection_command
358
+ 357,3631104,"src/capture/filesystemWatcher.ts",4166,0,"",typescript,selection_command
359
+ 358,3633911,"src/recording.ts",0,0,"",typescript,tab
360
+ 359,3635484,"src/capture/filesystemWatcher.ts",0,0,"",typescript,tab
361
+ 360,3661498,"src/capture/filesystemWatcher.ts",4259,0,"",typescript,selection_command
362
+ 361,3661738,"src/capture/filesystemWatcher.ts",4279,0,"",typescript,selection_command
363
+ 362,3661768,"src/capture/filesystemWatcher.ts",4289,0,"",typescript,selection_command
364
+ 363,3661800,"src/capture/filesystemWatcher.ts",4316,0,"",typescript,selection_command
365
+ 364,3661834,"src/capture/filesystemWatcher.ts",4319,0,"",typescript,selection_command
366
+ 365,3661863,"src/capture/filesystemWatcher.ts",4321,0,"",typescript,selection_command
367
+ 366,3661896,"src/capture/filesystemWatcher.ts",4331,0,"",typescript,selection_command
368
+ 367,3663421,"src/capture/filesystemWatcher.ts",3251,0,"",typescript,selection_command
369
+ 368,3665161,"src/capture/filesystemWatcher.ts",4331,0,"",typescript,selection_command
370
+ 369,3665887,"src/capture/filesystemWatcher.ts",3251,0,"",typescript,selection_command
371
+ 370,3667588,"src/capture/filesystemWatcher.ts",4331,0,"",typescript,selection_command
372
+ 371,3670178,"src/capture/filesystemWatcher.ts",3251,0,"",typescript,selection_command
373
+ 372,3670398,"src/capture/filesystemWatcher.ts",210,43,"",typescript,content
374
+ 373,3672135,"src/capture/filesystemWatcher.ts",4288,0,"",typescript,selection_command
375
+ 374,3673010,"src/capture/filesystemWatcher.ts",210,0,"import { createTwoFilesPatch } from 'diff'\n",typescript,content
376
+ 375,3673088,"src/capture/filesystemWatcher.ts",2267,699,"",typescript,content
377
+ 376,3673088,"src/capture/filesystemWatcher.ts",210,43,"",typescript,content
378
+ 377,3682096,"src/capture/filesystemWatcher.ts",0,0,"",typescript,selection_command
379
+ 378,3688011,"src/capture/filesystemWatcher.ts",2224,0,"",typescript,selection_command
380
+ 379,3689161,"src/capture/filesystemWatcher.ts",2223,0,"",typescript,selection_command
381
+ 380,3703907,"src/capture/filesystemWatcher.ts",0,0,"",typescript,selection_command
382
+ 381,3742634,"src/capture/filesystemWatcher.ts",0,0,"",typescript,tab
383
+ 382,3742634,"src/capture/filesystemWatcher.ts",210,0,"",typescript,selection_command
384
+ 383,3787324,"src/recording.ts",0,0,"",typescript,tab
385
+ 384,3787324,"src/recording.ts",332,4,"diff",typescript,selection_command
386
+ 385,3789086,"src/recording.ts",335,0,"",typescript,selection_command
387
+ 386,3789673,"src/recording.ts",295,0,"",typescript,selection_command
388
+ 387,3789994,"src/recording.ts",302,0,"",typescript,selection_command
389
+ 388,3790132,"src/recording.ts",304,0,"",typescript,selection_command
390
+ 389,3790581,"src/recording.ts",4639,0,"",typescript,selection_command
391
+ 390,3794337,"src/capture/filesystemWatcher.ts",0,0,"",typescript,tab
392
+ 391,3800011,"src/recording.ts",0,0,"",typescript,tab
393
+ 392,3800011,"src/recording.ts",295,0,"",typescript,selection_command
394
+ 393,3911371,"src/recording.ts",0,0,"",typescript,tab
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-46148775-4197-4774-bf77-8631ca6b73f01753557591807-2025_07_26-21.19.58.968/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-46a00613-23fe-46e7-8ec3-6456b356c8531761050958195-2025_10_21-14.49.25.343/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-46c4a757-02fe-4d2b-80c9-10277f3bc6421757061314730-2025_09_05-10.35.23.869/source.csv ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,2,"models/tokenizer.py",0,0,"from typing import Dict, Tuple\n\nimport flax.nnx as nnx\nimport jax.numpy as jnp\nimport jax\n\nfrom utils.preprocess import patchify, unpatchify\nfrom utils.nn import STTransformer, VectorQuantizer\n\n\nclass TokenizerVQVAE(nnx.Module):\n """"""\n ST-ViVit VQ-VAE\n\n Dimension keys:\n B: batch size\n T: sequence length\n N: number of patches per frame\n L: latent dimension\n D: B * T * N\n H: height\n W: width\n C: number of channels\n P: patch token dimension (patch_size^2 * C)\n """"""\n\n def __init__(\n self,\n in_dim: int,\n model_dim: int,\n ffn_dim: int,\n latent_dim: int,\n num_latents: int,\n patch_size: int,\n num_blocks: int,\n num_heads: int,\n dropout: float,\n codebook_dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n rngs: nnx.Rngs,\n ):\n self.in_dim = in_dim\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.latent_dim = latent_dim\n self.num_latents = num_latents\n self.patch_size = patch_size\n self.num_blocks = num_blocks\n self.num_heads = num_heads\n self.dropout = dropout\n self.codebook_dropout = codebook_dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n\n self.encoder = STTransformer(\n self.in_dim * self.patch_size**2,\n self.model_dim,\n self.ffn_dim,\n self.latent_dim,\n self.num_blocks,\n self.num_heads,\n self.dropout,\n self.param_dtype,\n self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=rngs,\n )\n self.vq = VectorQuantizer(\n self.latent_dim,\n self.num_latents,\n self.codebook_dropout,\n self.dtype,\n rngs=rngs,\n )\n self.out_dim = self.in_dim * self.patch_size**2\n self.decoder = STTransformer(\n self.latent_dim,\n self.model_dim,\n self.ffn_dim,\n self.out_dim,\n self.num_blocks,\n self.num_heads,\n self.dropout,\n self.param_dtype,\n self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=rngs,\n )\n\n def __call__(\n self, batch: Dict[str, jax.Array], training: bool = True\n ) -> Dict[str, jax.Array]:\n H, W = batch[""videos""].shape[2:4]\n videos_BTHWC = batch[""videos""]\n outputs = self.vq_encode(videos_BTHWC, training)\n z_q_BTNL = outputs[""z_q""]\n recon_BTHWC = self.decoder(z_q_BTNL)\n recon_BTHWC = recon_BTHWC.astype(jnp.float32)\n recon_BTHWC = nnx.sigmoid(recon_BTHWC)\n recon_BTHWC = recon_BTHWC.astype(self.dtype)\n recon_BTHWC = unpatchify(recon_BTHWC, self.patch_size, H, W)\n outputs[""recon""] = recon_BTHWC\n return outputs\n\n def vq_encode(\n self, videos: jax.Array, training: bool = True\n ) -> Dict[str, jax.Array]:\n # --- Preprocess + encode ---\n B, T = videos.shape[:2]\n patch_BTNP = patchify(videos, self.patch_size)\n N = patch_BTNP.shape[2]\n x_BTNL = self.encoder(patch_BTNP)\n\n # --- Vector quantize ---\n x_DL = x_BTNL.reshape(B * T * N, self.latent_dim)\n z_q_DL, z_DL, emb_DL, indices_D = self.vq(x_DL, training)\n z_q_BTNL = z_q_DL.reshape(B, T, N, self.latent_dim)\n indices_BTN = indices_D.reshape(B, T, N)\n return dict(z_q=z_q_BTNL, z=z_DL, emb=emb_DL, indices=indices_BTN)\n\n def decode(self, indices_BTN: jax.Array, video_hw: Tuple[int, int]) -> jax.Array:\n z_BTNL = self.vq.codebook[indices_BTN]\n recon_BTNP = self.decoder(z_BTNL)\n recon_BTNP = recon_BTNP.astype(jnp.float32)\n recon_BTNP = nnx.sigmoid(recon_BTNP)\n recon_BTNP = recon_BTNP.astype(self.dtype)\n return unpatchify(recon_BTNP, self.patch_size, *video_hw)\n",python,tab
3
+ 2,89,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"10:35:23 AM [info] Activating crowd-code\n10:35:23 AM [info] Recording started\n10:35:23 AM [info] Initializing git provider using file system watchers...\n10:35:23 AM [info] Git repository found\n10:35:23 AM [info] Git provider initialized successfully\n",Log,tab
4
+ 3,125,"extension-output-pdoom-org.crowd-code-#1-crowd-code",250,0,"10:35:23 AM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,9578026,"models/tokenizer.py",0,0,"",python,tab
6
+ 5,9581053,"utils/train_utils.py",0,0,"import jax\nimport optax\nimport operator\n\nfrom train_tokenizer import Args as TokenizerArgs\nfrom train_lam import Args as LAMArgs\nfrom train_dynamics import Args as DynamicsArgs\n\ndef get_lr_schedule(\n lr_schedule: str,\n init_lr: float,\n max_lr: float,\n decay_end: float,\n total_steps: int,\n warmup_steps: int,\n wsd_decay_steps: int,\n) -> optax.Schedule:\n supported_schedules = [""wsd"", ""cos""]\n if lr_schedule == ""cos"":\n assert (\n warmup_steps <= total_steps\n ), ""Warmup steps can't be greater than total steps.""\n return optax.warmup_cosine_decay_schedule(\n init_value=init_lr,\n peak_value=max_lr,\n warmup_steps=warmup_steps,\n decay_steps=total_steps, # Note: decay_steps includes the warmup steps, so we need to pass total value\n end_value=decay_end,\n )\n elif lr_schedule == ""wsd"":\n assert (\n warmup_steps + wsd_decay_steps <= total_steps\n ), ""Warmup and decay period is longer than total steps.""\n schedules = [\n optax.linear_schedule(\n init_value=init_lr, end_value=max_lr, transition_steps=warmup_steps\n ),\n optax.constant_schedule(value=max_lr),\n optax.linear_schedule(\n init_value=max_lr, end_value=decay_end, transition_steps=wsd_decay_steps\n ),\n ]\n boundaries = [warmup_steps, total_steps - wsd_decay_steps]\n return optax.join_schedules(schedules, boundaries)\n else:\n raise ValueError(\n f""Learning rate schedule not supported. Please use one of {supported_schedules}""\n )\n\n\ndef _count_component(component_params):\n """"""Count total parameters in a component.""""""\n params_sizes = jax.tree.map(jax.numpy.size, component_params)\n total_parameters = jax.tree.reduce(operator.add, params_sizes)\n return total_parameters\n\n\ndef count_parameters_by_component(params):\n """"""Count parameters for each component of the model.\n\n Args:\n params: Model parameters from nnx.split(model, nnx.Param, ...)\n\n Returns:\n Dictionary with parameter counts for each component\n """"""\n component_names = list(params.keys())\n print(f""Counting all components: {component_names}"")\n\n counts = {}\n total_params = 0\n\n for name in component_names:\n component_params = params[name]\n count = _count_component(component_params)\n counts[name] = count\n total_params += count\n\n counts[""total""] = total_params\n return counts\n\n\ndef bytes_to_gb(num_bytes):\n return num_bytes / (1024**3)\n\n\ndef print_compiled_memory_stats(compiled_stats):\n """"""from: https://github.com/AI-Hypercomputer/maxtext/blob/b18829fbaa48aec7ac350a03e62248e24c6a76b2/MaxText/max_utils.py#L739""""""\n output_gb = bytes_to_gb(compiled_stats.output_size_in_bytes)\n temp_gb = bytes_to_gb(compiled_stats.temp_size_in_bytes)\n argument_gb = bytes_to_gb(compiled_stats.argument_size_in_bytes)\n alias_gb = bytes_to_gb(compiled_stats.alias_size_in_bytes)\n host_temp_gb = bytes_to_gb(compiled_stats.host_temp_size_in_bytes)\n total_gb = output_gb + temp_gb + argument_gb - alias_gb\n print(\n f""Total memory size: {total_gb:.1f} GB, Output size: {output_gb:.1f} GB, Temp size: {temp_gb:.1f} GB, ""\n f""Argument size: {argument_gb:.1f} GB, Host temp size: {host_temp_gb:.1f} GB.""\n )\n\n\ndef print_compiled_cost_analysis(cost_stats):\n flops = float(cost_stats.get(""flops"", 0.0))\n bytes_accessed = float(cost_stats.get(""bytes accessed"", 0.0))\n gb = bytes_to_gb(bytes_accessed) if bytes_accessed else 0.0\n intensity = (flops / bytes_accessed) if bytes_accessed else float(""nan"")\n print(\n f""FLOPs: {flops:.3e}, Bytes: {bytes_accessed:.3e} ({gb:.1f} GB), ""\n f""Intensity: {intensity:.1f} FLOPs/byte""\n )\n\n\ndef print_mem_stats(label: str):\n """"""from: https://github.com/AI-Hypercomputer/maxtext/blob/7898576359bacde81be25cb3038e348aac1f943b/MaxText/max_utils.py#L713""""""\n print(f""\nMemstats: {label}:"")\n try:\n for d in jax.local_devices():\n stats = d.memory_stats()\n used = round(stats[""bytes_in_use""] / 2**30, 2)\n limit = round(stats[""bytes_limit""] / 2**30, 2)\n print(f""\tUsing (GB) {used} / {limit} ({used/limit:%}) on {d}"")\n except (RuntimeError, KeyError, TypeError) as ex:\n print(f""\tMemstats unavailable, error: {ex}"")\n\ndef _calculate_ffn_tflops_per_device(args):\n """"""Helper function to calculate matmul TFLOP in ffn based on MLP dimension.\n Adapted from https://github.com/AI-Hypercomputer/maxtext/blob/7898576359bacde81be25cb3038e348aac1f943b/MaxText/max_utils.py#L473\n\n Applies to:\n - Dense FFN layers (mlp_dim = config.mlp_dim).\n - MoE FFN layers (mlp_dim = config.moe_mlp_dim),\n need to scale by shared_experts or num_experts_per_tok.\n """"""\n\ndef calculate_tflops_per_device_tokenizer(args: TokenizerArgs):\n """"""Calculate training TFLOP for the Tokenizer.""""""\n input_dim = args.image_channels * (args.patch_size ** 2)\n\n tflops_per_device_encoder = calculate_tflops_per_device_transformer(args, input_dim, args.model_dim, args.ffn_dim, args.latent_dim, fully_causal=False)\n tflops_per_device_decoder = calculate_tflops_per_device_transformer(args, args.latent_dim, args.model_dim, args.ffn_dim, input_dim, fully_causal=False)\n\n batch_per_device = args.batch_size // jax.device_count()\n hn = (args.image_height + args.patch_size - 1) // args.patch_size\n wn = (args.image_width + args.patch_size - 1) // args.patch_size\n N = int(hn * wn)\n L = float(args.latent_dim)\n K = float(args.num_latents)\n\n # VQ distance compute (forward only; gradients do not flow through distances with STE)\n num_tokens = batch_per_device * args.seq_len * N\n vq_flops = 2.0 * num_tokens * L * K\n\n forward_flops = tflops_per_device_encoder + tflops_per_device_decoder\n\n # Training FLOPs: scale forward by ~3 for fwd+bwd+update, add VQ once\n total_training_flops = 3.0 * forward_flops + vq_flops\n\n to_tflops = 1.0 / 1e12\n result = {\n ""encoder_tflops"": tflops_per_device_encoder * to_tflops * 3.0,\n ""decoder_tflops"": tflops_per_device_decoder * to_tflops * 3.0,\n ""vq_tflops"": vq_flops * to_tflops * 3.0,\n ""total_tflops"": total_training_flops * to_tflops,\n }\n\n return result\n\n\ndef calculate_tflops_per_device_transformer(args: TokenizerArgs | LAMArgs | DynamicsArgs, input_dim: int, model_dim: int, ffn_dim: int, out_dim: int, fully_causal: bool = False):\n """"""Calculate training TFLOP for the STTransformer.""""""\n num_devices = jax.device_count()\n batch_per_device = args.batch_size // num_devices\n\n T = int(args.seq_len)\n H = int(args.image_height)\n W = int(args.image_width)\n\n # Number of patches per frame\n hn = (H + args.patch_size - 1) // args.patch_size\n wn = (W + args.patch_size - 1) // args.patch_size\n N = int(hn * wn)\n\n # Token counts for projections\n num_tokens = batch_per_device * T * N\n\n # Per-block FLOPs\n # Spatial attention (non-causal)\n qkv_spatial = 3.0 * 2.0 * num_tokens * model_dim * model_dim\n causal_multiplier = 0.5 if fully_causal else 1.0\n attn_spatial = causal_multiplier * 2.0 * 2.0 * (batch_per_device * T) * (N * N) * model_dim\n proj_spatial = 2.0 * num_tokens * model_dim * model_dim\n\n # Temporal attention (causal)\n qkv_temporal = 3.0 * 2.0 * num_tokens * model_dim * model_dim\n attn_temporal = 2.0 * (batch_per_device * N) * (T * T) * model_dim # = 0.5 * (2 * 2 * B*N * T^2 * M)\n proj_temporal = 2.0 * num_tokens * model_dim * model_dim\n\n # FFN per block (2 matmuls)\n # FIXME (f.srambical):\n ffn_block = 4.0 * batch_per_device * T * N * model_dim * ffn_dim\n\n # NOTE (f.srambical): The calculation omits layer norm flops\n block_total = (\n qkv_spatial\n + attn_spatial\n + proj_spatial\n + qkv_temporal\n + attn_temporal\n + proj_temporal\n + ffn_block\n )\n\n # FIXME (f.srambical):\n input_output = 2.0 * num_tokens * (input_dim * model_dim + model_dim * out_dim)\n return block_total + input_output",python,tab
7
+ 6,9581089,"utils/train_utils.py",41,0,"",python,selection_command
8
+ 7,12383704,"utils/train_utils.py",91,0,"",python,selection_command
9
+ 8,12383874,"utils/train_utils.py",41,0,"",python,selection_command
10
+ 9,12384014,"utils/train_utils.py",91,0,"",python,selection_command
11
+ 10,12384144,"utils/train_utils.py",41,0,"",python,selection_command
12
+ 11,12384256,"utils/train_utils.py",91,0,"",python,selection_command
13
+ 12,12384322,"utils/train_utils.py",41,0,"",python,selection_command
14
+ 13,12384425,"utils/train_utils.py",91,0,"",python,selection_command
15
+ 14,12384682,"utils/train_utils.py",727,0,"",python,selection_command
16
+ 15,12384808,"utils/train_utils.py",1664,0,"",python,selection_command
17
+ 16,12384983,"utils/train_utils.py",2283,0,"",python,selection_command
18
+ 17,12385233,"utils/train_utils.py",2874,0,"",python,selection_command
19
+ 18,12385494,"utils/train_utils.py",3855,0,"",python,selection_command
20
+ 19,12385651,"utils/train_utils.py",4879,0,"",python,selection_command
21
+ 20,12386593,"utils/train_utils.py",8127,0,"",python,selection_command
22
+ 21,13363507,"utils/train_utils.py",6732,0,"",python,selection_keyboard
23
+ 22,13363622,"utils/train_utils.py",4888,0,"",python,selection_keyboard
24
+ 23,13363743,"utils/train_utils.py",3138,0,"",python,selection_keyboard
25
+ 24,13363883,"utils/train_utils.py",1827,0,"",python,selection_keyboard
26
+ 25,13364025,"utils/train_utils.py",286,0,"",python,selection_keyboard
27
+ 26,13364243,"utils/train_utils.py",1827,0,"",python,selection_keyboard
28
+ 27,13364409,"utils/train_utils.py",3138,0,"",python,selection_keyboard
29
+ 28,13364553,"utils/train_utils.py",4888,0,"",python,selection_keyboard
30
+ 29,13364693,"utils/train_utils.py",6732,0,"",python,selection_keyboard
31
+ 30,13364810,"utils/train_utils.py",8127,0,"",python,selection_keyboard
32
+ 31,21321803,"utils/train_utils.py",6732,0,"",python,selection_keyboard
33
+ 32,21321920,"utils/train_utils.py",4888,0,"",python,selection_keyboard
34
+ 33,21322113,"utils/train_utils.py",3138,0,"",python,selection_keyboard
35
+ 34,21322244,"utils/train_utils.py",1827,0,"",python,selection_keyboard
36
+ 35,21322389,"utils/train_utils.py",286,0,"",python,selection_keyboard
37
+ 36,21327285,"utils/train_utils.py",1827,0,"",python,selection_keyboard
38
+ 37,21327434,"utils/train_utils.py",3138,0,"",python,selection_keyboard
39
+ 38,21327609,"utils/train_utils.py",4888,0,"",python,selection_keyboard
40
+ 39,21327756,"utils/train_utils.py",6732,0,"",python,selection_keyboard
41
+ 40,21327898,"utils/train_utils.py",8127,0,"",python,selection_keyboard
42
+ 41,21328133,"utils/train_utils.py",8160,0,"",python,selection_keyboard
43
+ 42,21329536,"utils/train_utils.py",6732,0,"",python,selection_keyboard
44
+ 43,21329842,"utils/train_utils.py",4888,0,"",python,selection_keyboard
45
+ 44,21330144,"utils/train_utils.py",3138,0,"",python,selection_keyboard
46
+ 45,21330445,"utils/train_utils.py",1827,0,"",python,selection_keyboard
47
+ 46,21330686,"utils/train_utils.py",286,0,"",python,selection_keyboard
48
+ 47,21330886,"utils/train_utils.py",0,0,"",python,selection_keyboard
49
+ 48,21334070,"utils/train_utils.py",1376,0,"",python,selection_keyboard
50
+ 49,21334239,"utils/train_utils.py",2559,0,"",python,selection_keyboard
51
+ 50,21334396,"utils/train_utils.py",4334,0,"",python,selection_keyboard
52
+ 51,21334596,"utils/train_utils.py",6239,0,"",python,selection_keyboard
53
+ 52,21334786,"utils/train_utils.py",7763,0,"",python,selection_keyboard
54
+ 53,21335308,"utils/train_utils.py",8160,0,"",python,selection_keyboard
55
+ 54,21336406,"utils/train_utils.py",8076,0,"",python,selection_command
56
+ 55,21336656,"utils/train_utils.py",8037,0,"",python,selection_command
57
+ 56,21336689,"utils/train_utils.py",8011,0,"",python,selection_command
58
+ 57,21336722,"utils/train_utils.py",8009,0,"",python,selection_command
59
+ 58,21336754,"utils/train_utils.py",8003,0,"",python,selection_command
60
+ 59,21336788,"utils/train_utils.py",7983,0,"",python,selection_command
61
+ 60,21336820,"utils/train_utils.py",7959,0,"",python,selection_command
62
+ 61,21336853,"utils/train_utils.py",7935,0,"",python,selection_command
63
+ 62,21336886,"utils/train_utils.py",7912,0,"",python,selection_command
64
+ 63,21336920,"utils/train_utils.py",7889,0,"",python,selection_command
65
+ 64,21337184,"utils/train_utils.py",7866,0,"",python,selection_command
66
+ 65,21337437,"utils/train_utils.py",7846,0,"",python,selection_command
67
+ 66,21337591,"utils/train_utils.py",7800,0,"",python,selection_command
68
+ 67,21337841,"utils/train_utils.py",7762,0,"",python,selection_command
69
+ 68,21337874,"utils/train_utils.py",7730,0,"",python,selection_command
70
+ 69,21337907,"utils/train_utils.py",7691,0,"",python,selection_command
71
+ 70,21337944,"utils/train_utils.py",7664,0,"",python,selection_command
72
+ 71,21337978,"utils/train_utils.py",7633,0,"",python,selection_command
73
+ 72,21338498,"utils/train_utils.py",6054,0,"",python,selection_keyboard
74
+ 73,21339506,"utils/train_utils.py",7633,0,"",python,selection_keyboard
75
+ 74,21339680,"utils/train_utils.py",8160,0,"",python,selection_keyboard
76
+ 75,21359479,"utils/train_utils.py",6758,0,"",python,selection_keyboard
77
+ 76,21360170,"utils/train_utils.py",4921,0,"",python,selection_keyboard
78
+ 77,21360929,"utils/train_utils.py",3171,0,"",python,selection_keyboard
79
+ 78,21361538,"utils/train_utils.py",4921,0,"",python,selection_keyboard
80
+ 79,21362914,"utils/train_utils.py",6000,0,"",python,selection_command
81
+ 80,21367487,"utils/train_utils.py",6054,0,"",python,selection_command
82
+ 81,21367783,"utils/train_utils.py",6059,0,"",python,selection_command
83
+ 82,21367934,"utils/train_utils.py",6086,0,"",python,selection_command
84
+ 83,21368102,"utils/train_utils.py",6101,0,"",python,selection_command
85
+ 84,21373253,"utils/train_utils.py",6172,0,"",python,selection_command
86
+ 85,21380447,"utils/train_utils.py",6243,0,"",python,selection_command
87
+ 86,21380696,"utils/train_utils.py",6292,0,"",python,selection_command
88
+ 87,21381055,"utils/train_utils.py",6350,0,"",python,selection_command
89
+ 88,21381305,"utils/train_utils.py",6352,0,"",python,selection_command
90
+ 89,21381336,"utils/train_utils.py",6357,0,"",python,selection_command
91
+ 90,21381369,"utils/train_utils.py",6371,0,"",python,selection_command
92
+ 91,21381402,"utils/train_utils.py",6372,0,"",python,selection_command
93
+ 92,21381436,"utils/train_utils.py",6377,0,"",python,selection_command
94
+ 93,21381729,"utils/train_utils.py",6372,0,"",python,selection_command
95
+ 94,21381979,"utils/train_utils.py",6371,0,"",python,selection_command
96
+ 95,21382012,"utils/train_utils.py",6357,0,"",python,selection_command
97
+ 96,21382045,"utils/train_utils.py",6352,0,"",python,selection_command
98
+ 97,21382083,"utils/train_utils.py",6350,0,"",python,selection_command
99
+ 98,21382115,"utils/train_utils.py",6292,0,"",python,selection_command
100
+ 99,21382149,"utils/train_utils.py",6243,0,"",python,selection_command
101
+ 100,21382183,"utils/train_utils.py",6172,0,"",python,selection_command
102
+ 101,21382216,"utils/train_utils.py",6101,0,"",python,selection_command
103
+ 102,21382473,"utils/train_utils.py",6172,0,"",python,selection_command
104
+ 103,21382711,"utils/train_utils.py",6101,0,"",python,selection_command
105
+ 104,21382964,"utils/train_utils.py",6086,0,"",python,selection_command
106
+ 105,21382993,"utils/train_utils.py",6059,0,"",python,selection_command
107
+ 106,21383026,"utils/train_utils.py",6054,0,"",python,selection_command
108
+ 107,21383058,"utils/train_utils.py",6000,0,"",python,selection_command
109
+ 108,21383091,"utils/train_utils.py",5926,0,"",python,selection_command
110
+ 109,21383125,"utils/train_utils.py",5921,0,"",python,selection_command
111
+ 110,21383158,"utils/train_utils.py",5851,0,"",python,selection_command
112
+ 111,21383192,"utils/train_utils.py",5846,0,"",python,selection_command
113
+ 112,21383225,"utils/train_utils.py",5810,0,"",python,selection_command
114
+ 113,21383259,"utils/train_utils.py",5757,0,"",python,selection_command
115
+ 114,21383292,"utils/train_utils.py",5666,0,"",python,selection_command
116
+ 115,21383325,"utils/train_utils.py",5661,0,"",python,selection_command
117
+ 116,21383359,"utils/train_utils.py",5633,0,"",python,selection_command
118
+ 117,21383392,"utils/train_utils.py",5602,0,"",python,selection_command
119
+ 118,21383425,"utils/train_utils.py",5581,0,"",python,selection_command
120
+ 119,21383459,"utils/train_utils.py",5512,0,"",python,selection_command
121
+ 120,21383492,"utils/train_utils.py",5442,0,"",python,selection_command
122
+ 121,21383610,"utils/train_utils.py",5512,0,"",python,selection_command
123
+ 122,21383862,"utils/train_utils.py",5581,0,"",python,selection_command
124
+ 123,21383893,"utils/train_utils.py",5602,0,"",python,selection_command
125
+ 124,21383925,"utils/train_utils.py",5633,0,"",python,selection_command
126
+ 125,21385738,"utils/train_utils.py",5661,0,"",python,selection_command
127
+ 126,21385876,"utils/train_utils.py",5666,0,"",python,selection_command
128
+ 127,21390639,"utils/train_utils.py",5757,0,"",python,selection_command
129
+ 128,21393765,"utils/train_utils.py",5810,0,"",python,selection_command
130
+ 129,21412438,"utils/train_utils.py",5846,0,"",python,selection_command
131
+ 130,21412545,"utils/train_utils.py",5851,0,"",python,selection_command
132
+ 131,21412687,"utils/train_utils.py",5921,0,"",python,selection_command
133
+ 132,21412805,"utils/train_utils.py",5926,0,"",python,selection_command
134
+ 133,21413230,"utils/train_utils.py",5922,73," # Training FLOPs: scale forward by ~3 for fwd+bwd+update, add VQ once",python,selection_command
135
+ 134,21413652,"utils/train_utils.py",5922,131," # Training FLOPs: scale forward by ~3 for fwd+bwd+update, add VQ once\n total_training_flops = 3.0 * forward_flops + vq_flops",python,selection_command
136
+ 135,21447757,"utils/nn.py",0,0,"import math\nfrom typing import Tuple, Callable, List\n\nfrom flax import nnx\nimport jax\nimport jax.numpy as jnp\nimport einops\n\n\nclass SpatioTemporalPositionalEncoding(nnx.Module):\n """"""\n Applies separate sinusoidal positional encodings to the temporal and spatial dimensions.\n """"""\n\n def __init__(self, d_model: int, max_len: int = 5000):\n self.d_model = d_model\n self.max_len = max_len\n\n pe = jnp.zeros((self.max_len, self.d_model))\n position = jnp.arange(0, self.max_len, dtype=jnp.float32)[:, None]\n div_term = jnp.exp(\n jnp.arange(0, self.d_model, 2) * (-math.log(10000.0) / self.d_model)\n )\n pe = pe.at[:, 0::2].set(jnp.sin(position * div_term))\n pe = pe.at[:, 1::2].set(jnp.cos(position * div_term))\n self.pe = nnx.Variable(pe)\n\n def __call__(self, x: jax.Array) -> jax.Array:\n """"""\n Args:\n x: The input tensor of shape (Batch, Time, Space, Dimension).\n\n Returns:\n The input tensor with positional encodings added.\n """"""\n assert x.ndim == 4, f""Input must be 4-dimensional, but got shape {x.shape}""\n\n num_timesteps = x.shape[1]\n num_spatial_patches = x.shape[2]\n\n # Temporal positional encoding: (1, T, 1, D)\n temporal_pe = self.pe.value[None, :num_timesteps, None, :]\n x = x + temporal_pe\n\n # Spatial positional encoding: (1, 1, S, D)\n spatial_pe = self.pe.value[None, None, :num_spatial_patches, :]\n x = x + spatial_pe\n\n return x\n\n\nclass STBlock(nnx.Module):\n def __init__(\n self,\n dim: int,\n ffn_dim: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n rngs: nnx.Rngs,\n sow_weights: bool,\n sow_activations: bool,\n ):\n self.dim = dim\n self.ffn_dim = ffn_dim\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.sow_weights = sow_weights\n self.sow_activations = sow_activations\n\n self.spatial_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.spatial_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.dim,\n qkv_features=self.dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=False\n ),\n rngs=rngs,\n decode=False,\n )\n\n self.temporal_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.temporal_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.dim,\n qkv_features=self.dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=False,\n )\n\n self.ffn_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.ffn_dense1 = nnx.Linear(\n in_features=self.dim,\n out_features=self.ffn_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.ffn_dense2 = nnx.Linear(\n in_features=self.ffn_dim,\n out_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n @nnx.remat\n def __call__(self, x_BTNM: jax.Array) -> jax.Array:\n # --- Spatial attention ---\n z_BTNM = self.spatial_norm(x_BTNM)\n z_BTNM = self.spatial_attention(z_BTNM, sow_weights=self.sow_weights)\n x_BTNM = x_BTNM + z_BTNM\n\n # --- Temporal attention ---\n x_BNTM = x_BTNM.swapaxes(1, 2)\n z_BNTM = self.temporal_norm(x_BNTM)\n z_BNTM = self.temporal_attention(z_BNTM, sow_weights=self.sow_weights)\n x_BNTM = x_BNTM + z_BNTM\n x_BTNM = x_BNTM.swapaxes(1, 2)\n\n # --- Feedforward ---\n z_BTNM = self.ffn_norm(x_BTNM)\n z_BTND = self.ffn_dense1(z_BTNM)\n z_BTND = jax.nn.gelu(z_BTND)\n z_BTNM = self.ffn_dense2(z_BTND)\n x_BTNM = x_BTNM + z_BTNM\n if self.sow_activations:\n self.sow(nnx.Intermediate, ""activations"", x_BTNM)\n return x_BTNM\n\n\nclass STTransformer(nnx.Module):\n """"""\n Dimension keys:\n B: batch size\n T: number of frames\n N: number of patches per frame\n I: number of input features\n M: model dimension\n D: FFN dimension\n V: vocabulary size\n """"""\n\n def __init__(\n self,\n input_dim: int,\n model_dim: int,\n ffn_dim: int,\n out_dim: int,\n num_blocks: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n rngs: nnx.Rngs,\n sow_weights: bool = False,\n sow_activations: bool = False,\n sow_logits: bool = False,\n max_len: int = 5000,\n ):\n self.input_dim = input_dim\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.out_dim = out_dim\n self.num_blocks = num_blocks\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.sow_logits = sow_logits\n self.sow_weights = sow_weights\n self.sow_activations = sow_activations\n\n self.input_norm1 = nnx.LayerNorm(\n num_features=self.input_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.input_dense = nnx.Linear(\n in_features=self.input_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.input_norm2 = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n\n self.pos_enc = SpatioTemporalPositionalEncoding(self.model_dim, max_len=max_len)\n\n self.blocks = []\n for _ in range(self.num_blocks):\n self.blocks.append(\n STBlock(\n dim=self.model_dim,\n ffn_dim=self.ffn_dim,\n num_heads=self.num_heads,\n dropout=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=rngs,\n sow_weights=self.sow_weights,\n sow_activations=self.sow_activations,\n )\n )\n\n self.output_dense = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.out_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n def __call__(self, x_BTNI: jax.Array) -> jax.Array:\n x_BTNI = self.input_norm1(x_BTNI)\n x_BTNM = self.input_dense(x_BTNI)\n x_BTNM = self.input_norm2(x_BTNM)\n x_BTNM = self.pos_enc(x_BTNM)\n for block in self.blocks:\n x_BTNM = block(x_BTNM)\n\n x_BTNV = self.output_dense(x_BTNM)\n if self.sow_logits:\n self.sow(nnx.Intermediate, ""logits"", x_BTNV)\n return x_BTNV\n\n\nclass TransformerBlock(nnx.Module):\n def __init__(\n self,\n model_dim: int,\n ffn_dim: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n decode: bool,\n rngs: nnx.Rngs,\n sow_weights: bool,\n sow_activations: bool,\n ):\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.decode = decode\n self.sow_weights = sow_weights\n self.sow_activations = sow_activations\n\n self.temporal_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.spatial_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.ffn_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.temporal_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.model_dim,\n qkv_features=self.model_dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=self.decode,\n )\n self.spatial_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.model_dim,\n qkv_features=self.model_dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=self.decode,\n )\n self.ffn_dense1 = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.ffn_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.ffn_dense2 = nnx.Linear(\n in_features=self.ffn_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n @nnx.remat\n def __call__(\n self, x_BTNM: jax.Array, pos_index: Tuple[jax.Array, jax.Array] | None = None\n ) -> jax.Array:\n # --- Spatial attention ---\n B, T, N, M = x_BTNM.shape\n z_FNM = einops.rearrange(x_BTNM, ""b t n m -> (b t) n m"")\n z_FNM = self.spatial_norm(z_FNM)\n z_FNM = self.spatial_attention(z_FNM, sow_weights=self.sow_weights)\n z_BTNM = einops.rearrange(z_FNM, ""(b t) n m -> b t n m"", t=T)\n x_BTNM = x_BTNM + z_BTNM\n # --- Temporal attention ---\n z_PTM = einops.rearrange(x_BTNM, ""b t n m -> (b n) t m"")\n z_PTM = self.temporal_norm(z_PTM)\n z_PTM = self.temporal_attention(z_PTM, sow_weights=self.sow_weights)\n z_BTNM = einops.rearrange(z_PTM, ""(b n) t m -> b t n m"", n=N)\n x_BTNM = x_BTNM + z_BTNM\n # --- Feedforward ---\n z_BTNM = self.ffn_norm(x_BTNM)\n z_BTND = self.ffn_dense1(z_BTNM)\n z_BTND = jax.nn.gelu(z_BTND)\n z_BTNM = self.ffn_dense2(z_BTND)\n x_BTNM = x_BTNM + z_BTNM\n if self.sow_activations:\n self.sow(nnx.Intermediate, ""activations"", x_BTNM)\n\n return x_BTNM\n\n\nclass Transformer(nnx.Module):\n """"""\n Dimension keys:\n B: batch size\n T: number of frames\n N: number of patches per frame\n I: number of input features\n M: model dimension\n D: FFN dimension\n V: vocabulary size\n F: number of frames in batch\n P: number of patch positions in batch\n """"""\n\n def __init__(\n self,\n input_dim: int,\n model_dim: int,\n ffn_dim: int,\n out_dim: int,\n num_blocks: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n decode: bool,\n rngs: nnx.Rngs,\n sow_logits: bool = False,\n sow_weights: bool = False,\n sow_activations: bool = False,\n max_len: int = 5000,\n ):\n self.input_dim = input_dim\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.out_dim = out_dim\n self.num_blocks = num_blocks\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.sow_logits = sow_logits\n self.sow_weights = sow_weights\n self.sow_activations = sow_activations\n\n self.input_norm1 = nnx.LayerNorm(\n num_features=self.input_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.input_dense = nnx.Linear(\n in_features=self.input_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.input_norm2 = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n\n self.pos_enc = SpatioTemporalPositionalEncoding(self.model_dim, max_len=max_len)\n\n self.blocks: List[TransformerBlock] = []\n for _ in range(self.num_blocks):\n self.blocks.append(\n TransformerBlock(\n model_dim=self.model_dim,\n ffn_dim=self.ffn_dim,\n num_heads=self.num_heads,\n dropout=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n decode=decode,\n sow_weights=self.sow_weights,\n sow_activations=self.sow_activations,\n rngs=rngs,\n )\n )\n self.output_dense = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.out_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n def __call__(\n self, x_BTNI: jax.Array, pos_index: Tuple[jax.Array, jax.Array] | None = None\n ) -> jax.Array:\n x_BTNI = self.input_norm1(x_BTNI)\n x_BTNM = self.input_dense(x_BTNI)\n x_BTNM = self.input_norm2(x_BTNM)\n x_BTNM = self.pos_enc(x_BTNM)\n for block in self.blocks:\n x_BTNM = block(x_BTNM, pos_index)\n\n x_BTNV = self.output_dense(x_BTNM)\n if self.sow_logits:\n self.sow(nnx.Intermediate, ""logits"", x_BTNV)\n return x_BTNV\n\n\ndef normalize(x: jax.Array) -> jax.Array:\n return x / (jnp.linalg.norm(x, ord=2, axis=-1, keepdims=True) + 1e-8)\n\n\nclass VectorQuantizer(nnx.Module):\n """"""\n Dimension keys:\n D: B * T * N\n K: number of latents\n L: latent dimension\n """"""\n\n def __init__(\n self,\n latent_dim: int,\n num_latents: int,\n dropout: float,\n dtype: jnp.dtype,\n rngs: nnx.Rngs,\n ):\n self.latent_dim = latent_dim\n self.num_latents = num_latents\n self.dropout = dropout\n self.dtype = dtype\n\n self.codebook = nnx.Param(\n normalize(\n nnx.initializers.lecun_uniform()(\n rngs.params(), (self.num_latents, self.latent_dim)\n )\n )\n )\n self.drop = nnx.Dropout(self.dropout, rngs=rngs)\n\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D\n\n def get_codes(self, indices_E: jax.Array) -> jax.Array:\n return self.codebook[indices_E]\n\n\ndef _create_flash_attention_fn(use_flash_attention: bool, is_causal: bool) -> Callable:\n """"""\n Create an attention function that uses flash attention if enabled.\n\n flax.nnx.MultiHeadAttention provides tensors with shape (batch..., length, num_heads, head_dim),\n but jax.nn.dot_product_attention expects (batch, length, num_heads, head_dim). We reshape to\n ensure compatibility. cuDNN's flash attention additionally requires a sequence length that\n is a multiple of 4. We pad the sequence length to the nearest multiple of 4 and mask\n accordingly. Note that cuDNN requires the mask to be broadcast before calling the attention\n function due to strict shape checking.\n """"""\n\n def attention_fn(\n query_BTHD, key_BSHD, value_BSHD, bias=None, mask_B111=None, **kwargs\n ):\n implementation = ""cudnn"" if use_flash_attention else None\n\n def _merge_batch_dims(x):\n return einops.rearrange(x, ""... l h k -> (...) l h k"")\n\n def _pad(x, pad_size):\n return jnp.pad(x, ((0, 0), (0, pad_size), (0, 0), (0, 0)))\n\n original_shape = query_BTHD.shape\n T = query_BTHD.shape[-3]\n S = key_BSHD.shape[-3]\n\n # Pad to nearest multiple of 4\n Q = ((T + 3) // 4) * 4\n pad_size_Q = Q - T\n K = ((S + 3) // 4) * 4\n pad_size_K = K - S\n\n query_BQHD = _pad(_merge_batch_dims(query_BTHD), pad_size_Q)\n key_BKHD = _pad(_merge_batch_dims(key_BSHD), pad_size_K)\n value_BKHD = _pad(_merge_batch_dims(value_BSHD), pad_size_K)\n\n attention_mask = jnp.ones((Q, K), dtype=jnp.bool_)\n attention_mask = attention_mask.at[T:, :].set(False)\n attention_mask = attention_mask.at[:, S:].set(False)\n\n mask_11TS = attention_mask[jnp.newaxis, jnp.newaxis, :, :]\n\n bias_4d = (\n jnp.pad(\n _merge_batch_dims(bias),\n ((0, 0), (0, 0), (0, pad_size_Q), (0, pad_size_K)),\n )\n if bias is not None\n else None\n )\n\n # NOTE: jax.nn.dot_product_attention does not support dropout\n output_4d = jax.nn.dot_product_attention(\n query=query_BQHD,\n key=key_BKHD,\n value=value_BKHD,\n bias=bias_4d,\n mask=mask_11TS,\n implementation=implementation,\n is_causal=is_causal,\n )\n return output_4d[..., :T, :, :].reshape(original_shape)\n\n return attention_fn\n",python,tab
137
+ 136,21454994,"utils/nn.py",17381,0,"",python,selection_command
138
+ 137,21455246,"utils/nn.py",17336,0,"",python,selection_command
139
+ 138,21455277,"utils/nn.py",17305,0,"",python,selection_command
140
+ 139,21455309,"utils/nn.py",17300,0,"",python,selection_command
141
+ 140,21455344,"utils/nn.py",17247,0,"",python,selection_command
142
+ 141,21455375,"utils/nn.py",17202,0,"",python,selection_command
143
+ 142,21455409,"utils/nn.py",17171,0,"",python,selection_command
144
+ 143,21455442,"utils/nn.py",17152,0,"",python,selection_command
145
+ 144,21455475,"utils/nn.py",17120,0,"",python,selection_command
146
+ 145,21455508,"utils/nn.py",17065,0,"",python,selection_command
147
+ 146,21455694,"utils/nn.py",17012,0,"",python,selection_command
148
+ 147,21455946,"utils/nn.py",16980,0,"",python,selection_command
149
+ 148,21455979,"utils/nn.py",16950,0,"",python,selection_command
150
+ 149,21456010,"utils/nn.py",16922,0,"",python,selection_command
151
+ 150,21456044,"utils/nn.py",16883,0,"",python,selection_command
152
+ 151,21460025,"utils/nn.py",15845,0,"",python,selection_keyboard
153
+ 152,21564352,"utils/nn.py",15846,0,"",python,selection_command
154
+ 153,21564599,"utils/nn.py",15847,0,"",python,selection_command
155
+ 154,21564634,"utils/nn.py",15889,0,"",python,selection_command
156
+ 155,21564666,"utils/nn.py",15963,0,"",python,selection_command
157
+ 156,21564699,"utils/nn.py",15964,0,"",python,selection_command
158
+ 157,21564733,"utils/nn.py",15965,0,"",python,selection_command
159
+ 158,21564766,"utils/nn.py",16000,0,"",python,selection_command
160
+ 159,21564799,"utils/nn.py",16008,0,"",python,selection_command
161
+ 160,21564834,"utils/nn.py",16028,0,"",python,selection_command
162
+ 161,21564867,"utils/nn.py",16049,0,"",python,selection_command
163
+ 162,21564899,"utils/nn.py",16078,0,"",python,selection_command
164
+ 163,21564932,"utils/nn.py",16106,0,"",python,selection_command
165
+ 164,21564965,"utils/nn.py",16114,0,"",python,selection_command
166
+ 165,21564999,"utils/nn.py",16115,0,"",python,selection_command
167
+ 166,21565032,"utils/nn.py",16133,0,"",python,selection_command
168
+ 167,21565066,"utils/nn.py",16147,0,"",python,selection_command
169
+ 168,21565099,"utils/nn.py",16172,0,"",python,selection_command
170
+ 169,21565132,"utils/nn.py",16198,0,"",python,selection_command
171
+ 170,21565166,"utils/nn.py",16222,0,"",python,selection_command
172
+ 171,21565199,"utils/nn.py",16248,0,"",python,selection_command
173
+ 172,21565232,"utils/nn.py",16272,0,"",python,selection_command
174
+ 173,21565266,"utils/nn.py",16279,0,"",python,selection_command
175
+ 174,21565300,"utils/nn.py",16316,0,"",python,selection_command
176
+ 175,21565333,"utils/nn.py",16355,0,"",python,selection_command
177
+ 176,21565366,"utils/nn.py",16386,0,"",python,selection_command
178
+ 177,21565401,"utils/nn.py",16413,0,"",python,selection_command
179
+ 178,21565433,"utils/nn.py",16414,0,"",python,selection_command
180
+ 179,21565600,"utils/nn.py",17924,0,"",python,selection_keyboard
181
+ 180,21566810,"utils/nn.py",16414,0,"",python,selection_keyboard
182
+ 181,21569220,"utils/nn.py",16449,0,"",python,selection_command
183
+ 182,21569470,"utils/nn.py",16472,0,"",python,selection_command
184
+ 183,21569501,"utils/nn.py",16522,0,"",python,selection_command
185
+ 184,21569534,"utils/nn.py",16593,0,"",python,selection_command
186
+ 185,21569567,"utils/nn.py",16611,0,"",python,selection_command
187
+ 186,21569601,"utils/nn.py",16625,0,"",python,selection_command
188
+ 187,21569634,"utils/nn.py",16635,0,"",python,selection_command
189
+ 188,21569668,"utils/nn.py",16692,0,"",python,selection_command
190
+ 189,21569700,"utils/nn.py",16693,0,"",python,selection_command
191
+ 190,21569733,"utils/nn.py",16711,0,"",python,selection_command
192
+ 191,21569917,"utils/nn.py",16757,0,"",python,selection_command
193
+ 192,21570085,"utils/nn.py",16817,0,"",python,selection_command
194
+ 193,21577035,"utils/nn.py",16853,0,"",python,selection_command
195
+ 194,21577608,"utils/nn.py",16861,0,"",python,selection_command
196
+ 195,21579239,"utils/nn.py",16868,0,"",python,selection_command
197
+ 196,21579331,"utils/nn.py",16959,0,"",python,selection_command
198
+ 197,21582542,"utils/nn.py",16990,0,"",python,selection_command
199
+ 198,21583727,"utils/nn.py",17043,0,"",python,selection_command
200
+ 199,21586248,"utils/nn.py",17109,0,"",python,selection_command
201
+ 200,21586394,"utils/nn.py",17130,0,"",python,selection_command
202
+ 201,21586660,"utils/nn.py",17134,0,"",python,selection_command
203
+ 202,21587667,"utils/nn.py",17171,0,"",python,selection_command
204
+ 203,21587832,"utils/nn.py",17184,0,"",python,selection_command
205
+ 204,21587980,"utils/nn.py",17229,0,"",python,selection_command
206
+ 205,21743695,"utils/nn.py",17282,0,"",python,selection_command
207
+ 206,21743946,"utils/nn.py",17305,0,"",python,selection_command
208
+ 207,21743978,"utils/nn.py",17318,0,"",python,selection_command
209
+ 208,21744014,"utils/nn.py",17363,0,"",python,selection_command
210
+ 209,21744417,"utils/nn.py",17422,0,"",python,selection_command
211
+ 210,21744873,"utils/nn.py",17410,44," return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
212
+ 211,21745842,"utils/nn.py",15965,1489,"class VectorQuantizer(nnx.Module):\n """"""\n Dimension keys:\n D: B * T * N\n K: number of latents\n L: latent dimension\n """"""\n\n def __init__(\n self,\n latent_dim: int,\n num_latents: int,\n dropout: float,\n dtype: jnp.dtype,\n rngs: nnx.Rngs,\n ):\n self.latent_dim = latent_dim\n self.num_latents = num_latents\n self.dropout = dropout\n self.dtype = dtype\n\n self.codebook = nnx.Param(\n normalize(\n nnx.initializers.lecun_uniform()(\n rngs.params(), (self.num_latents, self.latent_dim)\n )\n )\n )\n self.drop = nnx.Dropout(self.dropout, rngs=rngs)\n\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
213
+ 212,21753236,"utils/nn.py",16114,1340,"\n def __init__(\n self,\n latent_dim: int,\n num_latents: int,\n dropout: float,\n dtype: jnp.dtype,\n rngs: nnx.Rngs,\n ):\n self.latent_dim = latent_dim\n self.num_latents = num_latents\n self.dropout = dropout\n self.dtype = dtype\n\n self.codebook = nnx.Param(\n normalize(\n nnx.initializers.lecun_uniform()(\n rngs.params(), (self.num_latents, self.latent_dim)\n )\n )\n )\n self.drop = nnx.Dropout(self.dropout, rngs=rngs)\n\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
214
+ 213,21753686,"utils/nn.py",16413,1041,"\n self.codebook = nnx.Param(\n normalize(\n nnx.initializers.lecun_uniform()(\n rngs.params(), (self.num_latents, self.latent_dim)\n )\n )\n )\n self.drop = nnx.Dropout(self.dropout, rngs=rngs)\n\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
215
+ 214,21754005,"utils/nn.py",16692,762,"\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
216
+ 215,21754187,"utils/nn.py",16950,504,"\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
217
+ 216,21755128,"utils/nn.py",16692,762,"\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
218
+ 217,21756008,"utils/nn.py",16635,819," self.drop = nnx.Dropout(self.dropout, rngs=rngs)\n\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
219
+ 218,21757081,"utils/nn.py",16692,762,"\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
220
+ 219,21757168,"utils/nn.py",16693,761," def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = x_DL.astype(self.dtype)\n codebook = self.codebook.value.astype(self.dtype)\n\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(codebook)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D",python,selection_command
221
+ 220,21757719,"utils/nn.py",16709,0,"",python,selection_command
222
+ 221,22071450,"utils/nn.py",16728,0,"",python,selection_command
223
+ 222,22071700,"utils/nn.py",16774,0,"",python,selection_command
224
+ 223,22071733,"utils/nn.py",16834,0,"",python,selection_command
225
+ 224,22071772,"utils/nn.py",16870,0,"",python,selection_command
226
+ 225,22071806,"utils/nn.py",16909,0,"",python,selection_command
227
+ 226,22071840,"utils/nn.py",16950,0,"",python,selection_command
228
+ 227,22071871,"utils/nn.py",16968,0,"",python,selection_command
229
+ 228,22071905,"utils/nn.py",16999,0,"",python,selection_command
230
+ 229,22071938,"utils/nn.py",17052,0,"",python,selection_command
231
+ 230,22071970,"utils/nn.py",17118,0,"",python,selection_command
232
+ 231,22072005,"utils/nn.py",17139,0,"",python,selection_command
233
+ 232,22072040,"utils/nn.py",17171,0,"",python,selection_command
234
+ 233,22072301,"utils/nn.py",17189,0,"",python,selection_command
235
+ 234,22072457,"utils/nn.py",17234,0,"",python,selection_command
236
+ 235,22072714,"utils/nn.py",17287,0,"",python,selection_command
237
+ 236,22072875,"utils/nn.py",17305,0,"",python,selection_command
238
+ 237,22073027,"utils/nn.py",17323,0,"",python,selection_command
239
+ 238,22073190,"utils/nn.py",17368,0,"",python,selection_command
240
+ 239,22073844,"utils/nn.py",17366,0,"",python,selection_command
241
+ 240,22073993,"utils/nn.py",17359,0,"",python,selection_command
242
+ 241,22074151,"utils/nn.py",17347,0,"",python,selection_command
243
+ 242,22074538,"utils/nn.py",17359,0,"",python,selection_command
244
+ 243,23964374,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
245
+ 244,23965569,"utils/nn.py",0,0,"",python,tab
246
+ 245,82241068,"train_tokenizer.py",0,0,"import os\n\nos.environ.setdefault(""XLA_PYTHON_CLIENT_MEM_FRACTION"", ""0.98"")\n\nfrom dataclasses import dataclass, field\nfrom typing import cast, Optional\n\nimport einops\nimport itertools\nfrom jax.sharding import Mesh, PartitionSpec, NamedSharding\nfrom jax.experimental.mesh_utils import create_device_mesh\nimport optax\nimport orbax.checkpoint as ocp\nimport numpy as np\nimport dm_pix as pix\nimport jax\nimport jax.numpy as jnp\nimport tyro\nimport wandb\nimport grain\nimport flax.nnx as nnx\n\nfrom models.tokenizer import TokenizerVQVAE\nfrom utils.dataloader import get_dataloader\nfrom utils.train_utils import (\n get_lr_schedule,\n count_parameters_by_component,\n print_mem_stats,\n print_compiled_memory_stats,\n print_compiled_cost_analysis,\n)\n\n\n@dataclass\nclass Args:\n # Experiment\n num_steps: int = 300_000\n seed: int = 0\n seq_len: int = 16\n image_channels: int = 3\n image_height: int = 90\n image_width: int = 160\n data_dir: str = """"\n save_ckpt: bool = False\n restore_ckpt: bool = False\n # Optimization\n vq_beta: float = 0.25\n batch_size: int = 48\n init_lr: float = 0.0\n max_lr: float = 3e-4\n decay_end: float = 0.0\n wsd_decay_steps: int = (\n 20000 # NOTE: wsd_decay_steps will only be used when using a wsd-schedule\n )\n lr_schedule: str = ""wsd"" # supported options: wsd, cos\n warmup_steps: int = 10000\n # Tokenizer\n model_dim: int = 512\n ffn_dim: int = 2048\n latent_dim: int = 32\n num_latents: int = 1024\n patch_size: int = 4\n num_blocks: int = 4\n num_heads: int = 8\n dropout: float = 0.0\n codebook_dropout: float = 0.01\n param_dtype = jnp.float32\n dtype = jnp.bfloat16\n # Logging\n log: bool = False\n entity: str = """"\n project: str = """"\n name: str = ""train_tokenizer""\n tags: list[str] = field(default_factory=lambda: [""tokenizer""])\n log_interval: int = 5\n log_image_interval: int = 250\n ckpt_dir: str = """"\n log_checkpoint_interval: int = 10000\n log_checkpoint_keep_period: int = 20000\n log_gradients: bool = False\n wandb_id: str = """"\n use_flash_attention: bool = True\n\n\ndef build_model(args: Args, rng: jax.Array) -> tuple[TokenizerVQVAE, jax.Array]:\n rng, _rng = jax.random.split(rng)\n rngs = nnx.Rngs(_rng)\n return (\n TokenizerVQVAE(\n in_dim=args.image_channels,\n model_dim=args.model_dim,\n ffn_dim=args.ffn_dim,\n latent_dim=args.latent_dim,\n num_latents=args.num_latents,\n patch_size=args.patch_size,\n num_blocks=args.num_blocks,\n num_heads=args.num_heads,\n dropout=args.dropout,\n codebook_dropout=args.codebook_dropout,\n param_dtype=args.param_dtype,\n dtype=args.dtype,\n use_flash_attention=args.use_flash_attention,\n rngs=rngs,\n ),\n rng,\n )\n\n\ndef build_optimizer(\n model: TokenizerVQVAE, args: Args\n) -> tuple[nnx.Optimizer, optax.Schedule]:\n lr_schedule = get_lr_schedule(\n args.lr_schedule,\n args.init_lr,\n args.max_lr,\n args.decay_end,\n args.num_steps,\n args.warmup_steps,\n args.wsd_decay_steps,\n )\n tx = optax.adamw(\n learning_rate=lr_schedule,\n b1=0.9,\n b2=0.9,\n weight_decay=1e-4,\n mu_dtype=args.param_dtype, # moments in full precision\n )\n optimizer = nnx.Optimizer(model, tx)\n return optimizer, lr_schedule\n\n\ndef build_mesh_and_sharding(\n num_devices: int,\n) -> tuple[Mesh, NamedSharding, NamedSharding]:\n device_mesh_arr = create_device_mesh((num_devices,))\n mesh = Mesh(devices=device_mesh_arr, axis_names=(""data"",))\n replicated_sharding = NamedSharding(mesh, PartitionSpec())\n videos_sharding = NamedSharding(mesh, PartitionSpec(""data"", None, None, None, None))\n return mesh, replicated_sharding, videos_sharding\n\n\ndef shard_optimizer_states(\n optimizer: nnx.Optimizer, replicated_sharding: NamedSharding\n) -> None:\n model_state = nnx.state(optimizer.model)\n model_sharded_state = jax.lax.with_sharding_constraint(\n model_state, replicated_sharding\n )\n nnx.update(optimizer.model, model_sharded_state)\n optimizer_state = nnx.state(optimizer, nnx.optimizer.OptState)\n optimizer_sharded_state = jax.lax.with_sharding_constraint(\n optimizer_state, replicated_sharding\n )\n nnx.update(optimizer, optimizer_sharded_state)\n\n\ndef build_dataloader(args: Args) -> grain.DataLoaderIterator:\n image_shape = (args.image_height, args.image_width, args.image_channels)\n array_record_files = [\n os.path.join(args.data_dir, x)\n for x in os.listdir(args.data_dir)\n if x.endswith("".array_record"")\n ]\n grain_dataloader = get_dataloader(\n array_record_files,\n args.seq_len,\n # NOTE: We deliberately pass the global batch size\n # The dataloader shards the dataset across all processes\n args.batch_size,\n *image_shape,\n num_workers=8,\n prefetch_buffer_size=1,\n seed=args.seed,\n )\n initial_state = grain_dataloader._create_initial_state()\n grain_iterator = grain.DataLoaderIterator(grain_dataloader, initial_state)\n return grain_iterator\n\n\ndef build_checkpoint_manager(args: Args) -> ocp.CheckpointManager:\n handler_registry = ocp.handlers.DefaultCheckpointHandlerRegistry()\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeSave, ocp.handlers.PyTreeCheckpointHandler\n )\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeRestore, ocp.handlers.PyTreeCheckpointHandler\n )\n handler_registry.add(\n ""dataloader_state"",\n grain.checkpoint.CheckpointSave,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n handler_registry.add(\n ""dataloader_state"",\n grain.checkpoint.CheckpointRestore,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n checkpoint_options = ocp.CheckpointManagerOptions(\n save_interval_steps=args.log_checkpoint_interval,\n max_to_keep=3,\n keep_period=args.log_checkpoint_keep_period,\n step_format_fixed_length=6,\n cleanup_tmp_directories=True,\n )\n checkpoint_manager = ocp.CheckpointManager(\n args.ckpt_dir,\n options=checkpoint_options,\n handler_registry=handler_registry,\n )\n return checkpoint_manager\n\n\ndef restore_checkpoint_if_needed(\n args: Args,\n checkpoint_manager: ocp.CheckpointManager,\n optimizer: nnx.Optimizer,\n grain_iterator: grain.DataLoaderIterator,\n restore_step: Optional[int] = None,\n) -> tuple[int, nnx.Optimizer, grain.DataLoaderIterator]:\n step = 0\n if restore_step is None:\n restore_step = checkpoint_manager.latest_step()\n if args.restore_ckpt:\n abstract_optimizer = nnx.eval_shape(lambda: optimizer)\n abstract_optimizer_state = nnx.state(abstract_optimizer)\n restored = checkpoint_manager.restore(\n restore_step,\n args=ocp.args.Composite(\n model_state=ocp.args.PyTreeRestore(abstract_optimizer_state), # type: ignore\n dataloader_state=grain.checkpoint.CheckpointRestore(grain_iterator), # type: ignore\n ),\n )\n restored_optimizer_state = restored[""model_state""]\n nnx.update(optimizer, restored_optimizer_state)\n grain_iterator = restored[""dataloader_state""]\n step = restore_step or 0\n print(f""Restored dataloader and model state from step {step}"")\n return step, optimizer, grain_iterator\n\n\ndef main(args: Args) -> None:\n jax.distributed.initialize()\n num_devices = jax.device_count()\n if num_devices == 0:\n raise ValueError(""No JAX devices found."")\n print(f""Running on {num_devices} devices."")\n\n if args.batch_size % num_devices != 0:\n raise ValueError(\n f""Global batch size {args.batch_size} must be divisible by ""\n f""number of devices {num_devices}.""\n )\n\n rng = jax.random.key(args.seed)\n\n # --- Initialize model ---\n tokenizer, rng = build_model(args, rng)\n\n _, params, _ = nnx.split(tokenizer, nnx.Param, ...)\n param_counts = count_parameters_by_component(params)\n\n if args.log and jax.process_index() == 0:\n wandb_init_kwargs = {\n ""entity"": args.entity,\n ""project"": args.project,\n ""name"": args.name,\n ""tags"": args.tags,\n ""group"": ""debug"",\n ""config"": args,\n }\n\n if args.wandb_id:\n wandb_init_kwargs.update(\n {\n ""id"": args.wandb_id,\n ""resume"": ""allow"",\n }\n )\n wandb.init(**wandb_init_kwargs)\n\n wandb.config.update({""model_param_count"": param_counts})\n\n print(""Parameter counts:"")\n print(param_counts)\n\n # --- Initialize optimizer ---\n optimizer, lr_schedule = build_optimizer(tokenizer, args)\n del tokenizer\n\n # FIXME: switch to create_hybrid_device_mesh for runs spanning multiple nodes\n mesh, replicated_sharding, videos_sharding = build_mesh_and_sharding(num_devices)\n\n shard_optimizer_states(optimizer, replicated_sharding)\n\n # --- Initialize checkpoint manager ---\n checkpoint_manager = build_checkpoint_manager(args)\n\n # --- Create DataLoaderIterator from dataloader ---\n grain_iterator = build_dataloader(args)\n\n # --- Restore checkpoint ---\n step, optimizer, grain_iterator = restore_checkpoint_if_needed(\n args, checkpoint_manager, optimizer, grain_iterator\n )\n\n # --- Define loss and train step (close over args) ---\n def tokenizer_loss_fn(\n model: TokenizerVQVAE, inputs: dict\n ) -> tuple[jax.Array, tuple[jax.Array, dict]]:\n gt = jnp.asarray(inputs[""videos""], dtype=jnp.float32) / 255.0\n inputs[""videos""] = gt.astype(args.dtype)\n model.train()\n outputs = model(inputs, training=True)\n outputs[""recon""] = outputs[""recon""].astype(jnp.float32)\n mse = jnp.square(gt - outputs[""recon""]).mean()\n q_loss = jnp.square(jax.lax.stop_gradient(outputs[""emb""]) - outputs[""z""]).mean()\n commitment_loss = jnp.square(\n outputs[""emb""] - jax.lax.stop_gradient(outputs[""z""])\n ).mean()\n loss = mse + q_loss + args.vq_beta * commitment_loss\n\n gt_clipped = gt.clip(0, 1).reshape(-1, *gt.shape[2:])\n recon = outputs[""recon""].clip(0, 1).reshape(-1, *outputs[""recon""].shape[2:])\n psnr = jnp.asarray(pix.psnr(gt_clipped, recon)).mean()\n ssim = jnp.asarray(pix.ssim(gt_clipped, recon)).mean()\n _, index_counts = jnp.unique_counts(\n jnp.ravel(outputs[""indices""]), size=args.num_latents, fill_value=0\n )\n codebook_usage = (index_counts != 0).mean()\n metrics = dict(\n loss=loss,\n mse=mse,\n q_loss=q_loss,\n commitment_loss=commitment_loss,\n psnr=psnr,\n ssim=ssim,\n codebook_usage=codebook_usage,\n )\n return loss, (outputs[""recon""], metrics)\n\n @nnx.jit(donate_argnums=0)\n def train_step(\n optimizer: nnx.Optimizer, inputs: dict\n ) -> tuple[jax.Array, jax.Array, dict]:\n def loss_fn(model: TokenizerVQVAE) -> tuple[jax.Array, tuple[jax.Array, dict]]:\n return tokenizer_loss_fn(model, inputs)\n\n (loss, (recon, metrics)), grads = nnx.value_and_grad(loss_fn, has_aux=True)(\n optimizer.model\n )\n optimizer.update(grads)\n if args.log_gradients:\n metrics[""encoder_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""encoder""]\n )\n metrics[""vq_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""vq""]\n )\n metrics[""decoder_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""decoder""]\n )\n return loss, recon, metrics\n\n # --- TRAIN LOOP ---\n dataloader = (\n jax.make_array_from_process_local_data(videos_sharding, elem)\n for elem in grain_iterator\n )\n if jax.process_index() == 0:\n first_videos = next(dataloader)\n sample_inputs = dict(videos=first_videos)\n compiled = train_step.lower(optimizer, sample_inputs).compile()\n print_compiled_memory_stats(compiled.memory_analysis())\n print_compiled_cost_analysis(compiled.cost_analysis())\n # Do not skip the first batch during training\n dataloader = itertools.chain([first_videos], dataloader)\n print(f""Starting training from step {step}..."")\n first_step = step\n while step < args.num_steps:\n for videos in dataloader:\n # --- Train step ---\n inputs = dict(videos=videos)\n loss, recon, metrics = train_step(optimizer, inputs)\n if step == first_step:\n print_mem_stats(""After params initialized"")\n metrics[""lr""] = lr_schedule(step)\n print(f""Step {step}, loss: {loss}"")\n step += 1\n\n # --- Logging ---\n if args.log:\n if step % args.log_interval == 0 and jax.process_index() == 0:\n wandb.log(\n {\n ""loss"": loss,\n ""step"": step,\n **metrics,\n }\n )\n if step % args.log_image_interval == 0:\n gt_seq = inputs[""videos""][0].astype(jnp.float32) / 255.0\n recon_seq = recon[0].clip(0, 1)\n comparison_seq = jnp.concatenate((gt_seq, recon_seq), axis=1)\n comparison_seq = einops.rearrange(\n comparison_seq * 255, ""t h w c -> h (t w) c""\n )\n # NOTE: Process-dependent control flow deliberately happens\n # after indexing operation since it must not contain code\n # sections that lead to cross-accelerator communication.\n if jax.process_index() == 0:\n log_images = dict(\n image=wandb.Image(np.asarray(gt_seq[0])),\n recon=wandb.Image(np.asarray(recon_seq[0])),\n true_vs_recon=wandb.Image(\n np.asarray(comparison_seq.astype(np.uint8))\n ),\n )\n wandb.log(log_images)\n # --- Checkpointing ---\n if args.save_ckpt and step % args.log_checkpoint_interval == 0:\n optimizer_state = nnx.state(optimizer)\n checkpoint_manager.save(\n step,\n args=ocp.args.Composite(\n model_state=ocp.args.PyTreeSave(optimizer_state), # type: ignore\n dataloader_state=grain.checkpoint.CheckpointSave( # type: ignore\n grain_iterator # type: ignore\n ),\n ),\n )\n print(f""Saved checkpoint at step {step}"")\n if step >= args.num_steps:\n break\n\n checkpoint_manager.close()\n\n\nif __name__ == ""__main__"":\n args = tyro.cli(Args)\n main(args)\n",python,tab
247
+ 246,82241886,"train_tokenizer.py",9762,0,"",python,selection_command
248
+ 247,82242135,"train_tokenizer.py",9813,0,"",python,selection_command
249
+ 248,82242168,"train_tokenizer.py",9883,0,"",python,selection_command
250
+ 249,82242201,"train_tokenizer.py",9932,0,"",python,selection_command
251
+ 250,82242245,"train_tokenizer.py",9954,0,"",python,selection_command
252
+ 251,82242269,"train_tokenizer.py",10001,0,"",python,selection_command
253
+ 252,82242303,"train_tokenizer.py",10065,0,"",python,selection_command
254
+ 253,82242336,"train_tokenizer.py",10120,0,"",python,selection_command
255
+ 254,82242370,"train_tokenizer.py",10209,0,"",python,selection_command
256
+ 255,82242406,"train_tokenizer.py",10247,0,"",python,selection_command
257
+ 256,82242439,"train_tokenizer.py",10309,0,"",python,selection_command
258
+ 257,82242472,"train_tokenizer.py",10329,0,"",python,selection_command
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-48c89b00-1b87-4d4a-baa5-eeafbf11665c1755428958881-2025_08_17-13.09.25.387/source.csv ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,2,"train_dynamics.py",0,0,"from dataclasses import dataclass, field\nimport os\nfrom typing import cast\n\nimport einops\nfrom jax.sharding import Mesh, PartitionSpec, NamedSharding\nfrom jax.experimental.mesh_utils import create_device_mesh\nimport optax\nimport orbax.checkpoint as ocp\nimport numpy as np\nimport dm_pix as pix\nimport jax\nimport jax.numpy as jnp\nimport tyro\nimport wandb\nimport grain\nimport flax.nnx as nnx\n\nfrom genie import Genie, restore_genie_components\nfrom utils.dataloader import get_dataloader\nfrom utils.lr_utils import get_lr_schedule\nfrom utils.parameter_utils import count_parameters_by_component\n\n\n@dataclass\nclass Args:\n # Experiment\n num_steps: int = 200_000\n seed: int = 0\n seq_len: int = 16\n image_channels: int = 3\n image_height: int = 90\n image_width: int = 160\n data_dir: str = """"\n save_ckpt: bool = False\n restore_ckpt: bool = False\n # Optimization\n batch_size: int = 36\n init_lr: float = 0.0\n max_lr: float = 3e-5\n decay_end: float = 0.0\n wsd_decay_steps: int = (\n 10000 # NOTE: wsd_decay_steps will only be used when using a wsd-schedule\n )\n warmup_steps: int = 5000\n lr_schedule: str = ""wsd"" # supported options: wsd, cos\n # Tokenizer\n tokenizer_dim: int = 512\n tokenizer_ffn_dim: int = 2048\n latent_patch_dim: int = 32\n num_patch_latents: int = 1024\n patch_size: int = 4\n tokenizer_num_blocks: int = 4\n tokenizer_num_heads: int = 8\n tokenizer_checkpoint: str = """"\n # LAM\n lam_dim: int = 512\n lam_ffn_dim: int = 2048\n latent_action_dim: int = 32\n num_latent_actions: int = 6\n lam_patch_size: int = 16\n lam_num_blocks: int = 4\n lam_num_heads: int = 8\n lam_checkpoint: str = """"\n # Dynamics\n dyna_type: str = ""maskgit"" # supported options: maskgit, causal\n dyna_dim: int = 512\n dyna_ffn_dim: int = 2048\n dyna_num_blocks: int = 6\n dyna_num_heads: int = 8\n dropout: float = 0.0\n mask_limit: float = 0.5\n param_dtype = jnp.float32\n dtype = jnp.bfloat16\n use_flash_attention: bool = True\n # Logging\n log: bool = False\n entity: str = """"\n project: str = """"\n name: str = ""train_dynamics""\n tags: list[str] = field(default_factory=lambda: [""dynamics""])\n log_interval: int = 5\n log_image_interval: int = 250\n ckpt_dir: str = """"\n log_checkpoint_interval: int = 25000\n log_checkpoint_keep_period: int = 20000\n log_gradients: bool = False\n wandb_id: str = """"\n\n\nargs = tyro.cli(Args)\n\n\ndef dynamics_loss_fn(\n model: Genie, inputs: dict\n) -> tuple[jax.Array, tuple[jax.Array, dict]]:\n """"""Compute masked dynamics loss""""""\n gt = jnp.asarray(inputs[""videos""], dtype=jnp.float32) / 255.0\n inputs[""videos""] = gt.astype(args.dtype)\n model.train()\n outputs = model(inputs, training=True)\n mask = outputs[""mask""]\n outputs[""token_logits""] = outputs[""token_logits""].astype(jnp.float32)\n ce_loss = optax.softmax_cross_entropy_with_integer_labels(\n outputs[""token_logits""], outputs[""video_tokens""]\n )\n ce_loss = (mask * ce_loss).sum() / mask.sum()\n acc = outputs[""token_logits""].argmax(-1) == outputs[""video_tokens""]\n acc = (mask * acc).sum() / mask.sum()\n select_probs = jax.nn.softmax(outputs[""token_logits""])\n gt = gt.clip(0, 1).reshape(-1, *gt.shape[2:])\n recon = outputs[""recon""].clip(0, 1).reshape(-1, *outputs[""recon""].shape[2:])\n psnr = jnp.asarray(pix.psnr(gt, recon)).mean()\n ssim = jnp.asarray(pix.ssim(gt, recon)).mean()\n _, index_counts_lam = jnp.unique_counts(\n jnp.ravel(outputs[""lam_indices""]), size=args.num_latent_actions, fill_value=0\n )\n _, index_counts_tokenizer = jnp.unique_counts(\n jnp.ravel(outputs[""video_tokens""]), size=args.num_patch_latents, fill_value=0\n )\n codebook_usage_lam = (index_counts_lam != 0).mean()\n codebook_usage_tokenizer = (index_counts_tokenizer != 0).mean()\n metrics = dict(\n cross_entropy_loss=ce_loss,\n masked_token_accuracy=acc,\n select_logit=outputs[""token_logits""].max(-1).mean(),\n select_p=select_probs.max(-1).mean(),\n entropy=jax.scipy.special.entr(select_probs).sum(-1).mean(),\n psnr=psnr,\n ssim=ssim,\n codebook_usage_lam=codebook_usage_lam,\n codebook_usage_tokenizer=codebook_usage_tokenizer,\n )\n return ce_loss, (outputs[""recon""], metrics)\n\n\n@nnx.jit\ndef train_step(\n model: Genie, optimizer: nnx.Optimizer, inputs: dict\n) -> tuple[jax.Array, jax.Array, dict]:\n """"""Update state and compute metrics""""""\n\n def loss_fn(model: Genie) -> tuple[jax.Array, tuple[jax.Array, dict]]:\n return dynamics_loss_fn(model, inputs)\n\n (loss, (recon, metrics)), grads = nnx.value_and_grad(loss_fn, has_aux=True)(model)\n optimizer.update(grads)\n if args.log_gradients:\n metrics[""gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""dynamics""]\n )\n return loss, recon, metrics\n\n\nif __name__ == ""__main__"":\n jax.distributed.initialize()\n num_devices = jax.device_count()\n if num_devices == 0:\n raise ValueError(""No JAX devices found."")\n print(f""Running on {num_devices} devices."")\n\n if args.batch_size % num_devices != 0:\n raise ValueError(\n f""Global batch size {args.batch_size} must be divisible by ""\n f""number of devices {num_devices}.""\n )\n\n per_device_batch_size_for_init = args.batch_size // num_devices\n\n rng = jax.random.key(args.seed)\n\n # --- Initialize model ---\n rng, _rng = jax.random.split(rng)\n rngs = nnx.Rngs(_rng)\n genie = Genie(\n # Tokenizer\n in_dim=args.image_channels,\n tokenizer_dim=args.tokenizer_dim,\n tokenizer_ffn_dim=args.tokenizer_ffn_dim,\n latent_patch_dim=args.latent_patch_dim,\n num_patch_latents=args.num_patch_latents,\n patch_size=args.patch_size,\n tokenizer_num_blocks=args.tokenizer_num_blocks,\n tokenizer_num_heads=args.tokenizer_num_heads,\n # LAM\n lam_dim=args.lam_dim,\n lam_ffn_dim=args.lam_ffn_dim,\n latent_action_dim=args.latent_action_dim,\n num_latent_actions=args.num_latent_actions,\n lam_patch_size=args.lam_patch_size,\n lam_num_blocks=args.lam_num_blocks,\n lam_num_heads=args.lam_num_heads,\n lam_co_train=not args.lam_checkpoint,\n # Dynamics\n dyna_type=args.dyna_type,\n dyna_dim=args.dyna_dim,\n dyna_ffn_dim=args.dyna_ffn_dim,\n dyna_num_blocks=args.dyna_num_blocks,\n dyna_num_heads=args.dyna_num_heads,\n dropout=args.dropout,\n mask_limit=args.mask_limit,\n param_dtype=args.param_dtype,\n dtype=args.dtype,\n use_flash_attention=args.use_flash_attention,\n decode=False,\n rngs=rngs,\n )\n\n _, params, _ = nnx.split(genie, nnx.Param, ...)\n param_counts = count_parameters_by_component(params)\n\n if args.log and jax.process_index() == 0:\n wandb_init_kwargs = {\n ""entity"": args.entity,\n ""project"": args.project,\n ""name"": args.name,\n ""tags"": args.tags,\n ""group"": ""debug"",\n ""config"": args,\n }\n\n if args.wandb_id:\n wandb_init_kwargs.update(\n {\n ""id"": args.wandb_id,\n ""resume"": ""allow"",\n }\n )\n wandb.init(**wandb_init_kwargs)\n\n wandb.config.update({""model_param_count"": param_counts})\n\n print(""Parameter counts:"")\n print(param_counts)\n\n # --- Initialize optimizer ---\n lr_schedule = get_lr_schedule(\n args.lr_schedule,\n args.init_lr,\n args.max_lr,\n args.decay_end,\n args.num_steps,\n args.warmup_steps,\n args.wsd_decay_steps,\n )\n tx = optax.adamw(\n learning_rate=lr_schedule,\n b1=0.9,\n b2=0.9,\n weight_decay=1e-4,\n mu_dtype=args.dtype,\n )\n optimizer = nnx.Optimizer(genie, tx)\n del genie\n\n # FIXME: switch to create_hybrid_device_mesh for runs spanning multiple nodes\n device_mesh_arr = create_device_mesh((num_devices,))\n mesh = Mesh(devices=device_mesh_arr, axis_names=(""data"",))\n\n replicated_sharding = NamedSharding(mesh, PartitionSpec())\n videos_sharding = NamedSharding(mesh, PartitionSpec(""data"", None, None, None, None))\n\n model_state = nnx.state(optimizer.model)\n model_sharded_state = jax.lax.with_sharding_constraint(\n model_state, replicated_sharding\n )\n nnx.update(optimizer.model, model_sharded_state)\n optimizer_state = nnx.state(optimizer, nnx.optimizer.OptState)\n optimizer_sharded_state = jax.lax.with_sharding_constraint(\n optimizer_state, replicated_sharding\n )\n nnx.update(optimizer, optimizer_sharded_state)\n\n # --- Initialize checkpoint manager ---\n step = 0\n handler_registry = ocp.handlers.DefaultCheckpointHandlerRegistry()\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeSave, ocp.handlers.PyTreeCheckpointHandler\n )\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeRestore, ocp.handlers.PyTreeCheckpointHandler\n )\n handler_registry.add(\n ""dataloader_state"",\n grain.checkpoint.CheckpointSave,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n handler_registry.add(\n ""dataloader_state"",\n grain.checkpoint.CheckpointRestore,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n\n checkpoint_options = ocp.CheckpointManagerOptions(\n save_interval_steps=args.log_checkpoint_interval,\n max_to_keep=3,\n keep_period=args.log_checkpoint_keep_period,\n step_format_fixed_length=6,\n cleanup_tmp_directories=True,\n )\n\n checkpoint_manager = ocp.CheckpointManager(\n args.ckpt_dir,\n options=checkpoint_options,\n handler_registry=handler_registry,\n )\n\n # --- Create DataLoaderIterator from dataloader ---\n image_shape = (args.image_height, args.image_width, args.image_channels)\n array_record_files = [\n os.path.join(args.data_dir, x)\n for x in os.listdir(args.data_dir)\n if x.endswith("".array_record"")\n ]\n grain_dataloader = get_dataloader(\n array_record_files,\n args.seq_len,\n # NOTE: We deliberately pass the global batch size\n # The dataloader shards the dataset across all processes\n args.batch_size,\n *image_shape,\n num_workers=8,\n prefetch_buffer_size=1,\n seed=args.seed,\n )\n initial_state = grain_dataloader._create_initial_state()\n grain_iterator = grain.DataLoaderIterator(grain_dataloader, initial_state)\n\n # --- Restore checkpoint ---\n if args.restore_ckpt:\n abstract_optimizer = nnx.eval_shape(lambda: optimizer)\n abstract_optimizer_state = nnx.state(abstract_optimizer)\n restored = checkpoint_manager.restore(\n checkpoint_manager.latest_step(),\n args=ocp.args.Composite(\n model_state=ocp.args.PyTreeRestore(abstract_optimizer_state), # type: ignore\n dataloader_state=grain.checkpoint.CheckpointRestore(grain_iterator), # type: ignore\n ),\n )\n restored_optimizer_state = restored[""model_state""]\n nnx.update(optimizer, restored_optimizer_state)\n grain_iterator = restored[""dataloader_state""]\n step = checkpoint_manager.latest_step() or 0\n print(f""Restored dataloader and model state from step {step}"")\n else:\n # Restore from pre-trained tokenizer (and LAM)\n optimizer = restore_genie_components(optimizer, replicated_sharding, rng, args)\n # NOTE: We have to remove the (unused) tokenizer vq dropout due flax.nnx lazily initializing modules.\n # Specifically, the first dynamics model checkpoint will contain the vq dropout module,\n # but the first full restore will fail due to nnx not initializing the module when\n # dropout is set to 0.0.\n del optimizer.model.tokenizer.vq.drop\n\n # --- TRAIN LOOP ---\n dataloader = (\n jax.make_array_from_process_local_data(videos_sharding, elem)\n for elem in grain_iterator\n )\n print(f""Starting training from step {step}..."")\n while step < args.num_steps:\n for videos in dataloader:\n # --- Train step ---\n rng, _rng_mask = jax.random.split(rng, 2)\n inputs = dict(videos=videos, mask_rng=_rng_mask)\n loss, recon, metrics = train_step(optimizer.model, optimizer, inputs)\n metrics[""lr""] = lr_schedule(step)\n print(f""Step {step}, loss: {loss}"")\n step += 1\n\n # --- Logging ---\n if args.log:\n if step % args.log_interval == 0 and jax.process_index() == 0:\n wandb.log(\n {\n ""loss"": loss,\n ""step"": step,\n **metrics,\n }\n )\n if step % args.log_image_interval == 0:\n gt_seq = inputs[""videos""][0].astype(jnp.float32) / 255.0\n recon_seq = recon[0].clip(0, 1)\n comparison_seq = jnp.concatenate((gt_seq, recon_seq), axis=1)\n comparison_seq = einops.rearrange(\n comparison_seq * 255, ""t h w c -> h (t w) c""\n )\n if jax.process_index() == 0:\n log_images = dict(\n image=wandb.Image(np.asarray(gt_seq[args.seq_len - 1])),\n recon=wandb.Image(np.asarray(recon_seq[args.seq_len - 1])),\n true_vs_recon=wandb.Image(\n np.asarray(comparison_seq.astype(np.uint8))\n ),\n )\n wandb.log(log_images)\n # --- Checkpointing ---\n if args.save_ckpt and step % args.log_checkpoint_interval == 0:\n optimizer_state = nnx.state(optimizer)\n checkpoint_manager.save(\n step,\n args=ocp.args.Composite(\n model_state=ocp.args.PyTreeSave(optimizer_state), # type: ignore\n dataloader_state=grain.checkpoint.CheckpointSave( # type: ignore\n grain_iterator # type: ignore\n ),\n ),\n )\n print(f""Saved checkpoint at step {step}"")\n if step >= args.num_steps:\n break\n\n checkpoint_manager.close()\n",python,tab
3
+ 2,86,"TERMINAL",0,0,"",,terminal_focus
4
+ 3,212,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"1:09:25 PM [info] Activating crowd-code\n1:09:25 PM [info] Recording started\n1:09:25 PM [info] Initializing git provider using file system watchers...\n",Log,tab
5
+ 4,363,"extension-output-pdoom-org.crowd-code-#1-crowd-code",150,0,"1:09:25 PM [info] Git repository found\n1:09:25 PM [info] Git provider initialized successfully\n1:09:25 PM [info] Initial git state: [object Object]\n",Log,content
6
+ 5,472,"train_dynamics.py",0,0,"",python,tab
7
+ 6,8511,"train_dynamics.py",2900,0,"",python,selection_command
8
+ 7,9221,"train_dynamics.py",2826,0,"",python,selection_command
9
+ 8,10021,"train_dynamics.py",2831,0,"",python,selection_command
10
+ 9,10281,"train_dynamics.py",2834,0,"",python,selection_command
11
+ 10,10305,"train_dynamics.py",2836,0,"",python,selection_command
12
+ 11,10342,"train_dynamics.py",2843,0,"",python,selection_command
13
+ 12,10371,"train_dynamics.py",2845,0,"",python,selection_command
14
+ 13,10545,"train_dynamics.py",2857,0,"",python,selection_command
15
+ 14,10738,"train_dynamics.py",2860,0,"",python,selection_command
16
+ 15,10902,"train_dynamics.py",2866,0,"",python,selection_command
17
+ 16,11623,"train_dynamics.py",2860,0,"",python,selection_command
18
+ 17,12513,"train_dynamics.py",2806,0,"",python,selection_command
19
+ 18,12991,"train_dynamics.py",2810,0,"",python,selection_command
20
+ 19,13674,"train_dynamics.py",2884,0,"",python,selection_command
21
+ 20,13958,"train_dynamics.py",2892,0,"",python,selection_command
22
+ 21,14207,"train_dynamics.py",2894,0,"",python,selection_command
23
+ 22,14238,"train_dynamics.py",2899,0,"",python,selection_command
24
+ 23,14272,"train_dynamics.py",2900,0,"",python,selection_command
25
+ 24,14545,"train_dynamics.py",2941,0,"",python,selection_command
26
+ 25,14712,"train_dynamics.py",2951,0,"",python,selection_command
27
+ 26,15436,"train_dynamics.py",2941,0,"",python,selection_command
28
+ 27,16124,"train_dynamics.py",2900,0,"",python,selection_command
29
+ 28,110713,"utils/nn.py",0,0,"import math\nfrom typing import Tuple, Callable, List\n\nfrom flax import nnx\nimport jax\nimport jax.numpy as jnp\nimport einops\n\n\nclass SpatioTemporalPositionalEncoding(nnx.Module):\n """"""\n Applies separate sinusoidal positional encodings to the temporal and spatial dimensions.\n """"""\n def __init__(self, d_model: int, max_len: int = 5000):\n self.d_model = d_model\n self.max_len = max_len\n\n pe = jnp.zeros((self.max_len, self.d_model))\n position = jnp.arange(0, self.max_len, dtype=jnp.float32)[:, None]\n div_term = jnp.exp(\n jnp.arange(0, self.d_model, 2) * (-math.log(10000.0) / self.d_model)\n )\n pe = pe.at[:, 0::2].set(jnp.sin(position * div_term))\n pe = pe.at[:, 1::2].set(jnp.cos(position * div_term))\n self.pe = nnx.Variable(pe)\n\n def __call__(self, x: jax.Array) -> jax.Array:\n """"""\n Args:\n x: The input tensor of shape (Batch, Time, Space, Dimension).\n\n Returns:\n The input tensor with positional encodings added.\n """"""\n assert x.ndim == 4, f""Input must be 4-dimensional, but got shape {x.shape}""\n\n num_timesteps = x.shape[1]\n num_spatial_patches = x.shape[2]\n\n # Temporal positional encoding: (1, T, 1, D)\n temporal_pe = self.pe.value[None, :num_timesteps, None, :]\n x = x + temporal_pe\n\n # Spatial positional encoding: (1, 1, S, D)\n spatial_pe = self.pe.value[None, None, :num_spatial_patches, :]\n x = x + spatial_pe\n\n return x\n\n\nclass STBlock(nnx.Module):\n def __init__(\n self,\n dim: int,\n ffn_dim: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n rngs: nnx.Rngs,\n ):\n self.dim = dim\n self.ffn_dim = ffn_dim\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n\n self.spatial_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.spatial_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.dim,\n qkv_features=self.dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=False\n ),\n rngs=rngs,\n decode=False,\n )\n\n self.temporal_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.temporal_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.dim,\n qkv_features=self.dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=False,\n )\n\n self.ffn_norm = nnx.LayerNorm(\n num_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.ffn_dense1 = nnx.Linear(\n in_features=self.dim,\n out_features=self.ffn_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.ffn_dense2 = nnx.Linear(\n in_features=self.ffn_dim,\n out_features=self.dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n @nnx.remat\n def __call__(self, x_BTNM: jax.Array) -> jax.Array:\n # --- Spatial attention ---\n z_BTNM = self.spatial_norm(x_BTNM)\n z_BTNM = self.spatial_attention(z_BTNM)\n x_BTNM = x_BTNM + z_BTNM\n\n # --- Temporal attention ---\n x_BNTM = x_BTNM.swapaxes(1, 2)\n z_BNTM = self.temporal_norm(x_BNTM)\n z_BNTM = self.temporal_attention(z_BNTM)\n x_BNTM = x_BNTM + z_BNTM\n x_BTNM = x_BNTM.swapaxes(1, 2)\n\n # --- Feedforward ---\n z_BTNM = self.ffn_norm(x_BTNM)\n z_BTND = self.ffn_dense1(z_BTNM)\n z_BTND = jax.nn.gelu(z_BTND)\n z_BTNM = self.ffn_dense2(z_BTND)\n x_BTNM = x_BTNM + z_BTNM\n\n return x_BTNM\n\n\nclass STTransformer(nnx.Module):\n """"""\n Dimension keys:\n B: batch size\n T: number of frames\n N: number of patches per frame\n I: number of input features\n M: model dimension\n D: FFN dimension\n O: number of output features\n """"""\n def __init__(\n self,\n input_dim: int,\n model_dim: int,\n ffn_dim: int,\n out_dim: int,\n num_blocks: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n rngs: nnx.Rngs,\n max_len: int = 5000,\n ):\n self.input_dim = input_dim\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.out_dim = out_dim\n self.num_blocks = num_blocks\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n\n self.input_norm1 = nnx.LayerNorm(\n num_features=self.input_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.input_dense = nnx.Linear(\n in_features=self.input_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.input_norm2 = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n\n self.pos_enc = SpatioTemporalPositionalEncoding(self.model_dim, max_len=max_len)\n\n self.blocks = []\n for _ in range(self.num_blocks):\n self.blocks.append(\n STBlock(\n dim=self.model_dim,\n ffn_dim=self.ffn_dim,\n num_heads=self.num_heads,\n dropout=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=rngs,\n )\n )\n\n self.output_dense = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.out_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n def __call__(self, x_BTNI: jax.Array) -> jax.Array:\n x_BTNI = self.input_norm1(x_BTNI)\n x_BTNM = self.input_dense(x_BTNI)\n x_BTNM = self.input_norm2(x_BTNM)\n x_BTNM = self.pos_enc(x_BTNM)\n for block in self.blocks:\n x_BTNM = block(x_BTNM)\n\n x_BTNO = self.output_dense(x_BTNM)\n return x_BTNO\n\nclass TransformerBlock(nnx.Module):\n def __init__(\n self,\n model_dim: int,\n ffn_dim: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n decode: bool,\n rngs: nnx.Rngs,\n ):\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.decode = decode\n\n self.temporal_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.spatial_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.ffn_norm = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.temporal_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.model_dim,\n qkv_features=self.model_dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=self.decode,\n )\n self.spatial_attention = nnx.MultiHeadAttention(\n num_heads=self.num_heads,\n in_features=self.model_dim,\n qkv_features=self.model_dim,\n dropout_rate=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n attention_fn=_create_flash_attention_fn(\n self.use_flash_attention, is_causal=True\n ),\n rngs=rngs,\n decode=self.decode,\n )\n self.ffn_dense1 = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.ffn_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.ffn_dense2 = nnx.Linear(\n in_features=self.ffn_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n @nnx.remat\n def __call__(self, x_BTNM: jax.Array, pos_index: Tuple[jax.Array, jax.Array] | None = None) -> jax.Array:\n # --- Spatial attention ---\n B, T, N, M = x_BTNM.shape\n z_FNM = einops.rearrange(x_BTNM, ""b t n m -> (b t) n m"")\n z_FNM = self.spatial_norm(z_FNM)\n z_FNM = self.spatial_attention(z_FNM)\n z_BTNM = einops.rearrange(z_FNM, ""(b t) n m -> b t n m"", t=T)\n x_BTNM = x_BTNM + z_BTNM\n # --- Temporal attention ---\n z_PTM = einops.rearrange(x_BTNM, ""b t n m -> (b n) t m"")\n z_PTM = self.temporal_norm(z_PTM)\n z_PTM = self.temporal_attention(z_PTM)\n z_BTNM = einops.rearrange(z_PTM, ""(b n) t m -> b t n m"", n=N)\n x_BTNM = x_BTNM + z_BTNM\n # --- Feedforward ---\n z_BTNM = self.ffn_norm(x_BTNM)\n z_BTND = self.ffn_dense1(z_BTNM)\n z_BTND = jax.nn.gelu(z_BTND)\n z_BTNM = self.ffn_dense2(z_BTND)\n x_BTNM = x_BTNM + z_BTNM\n\n return x_BTNM\n\nclass Transformer(nnx.Module):\n """"""\n Dimension keys:\n B: batch size\n T: number of frames\n N: number of patches per frame\n I: number of input features\n M: model dimension\n D: FFN dimension\n O: number of output features\n F: number of frames in batch\n P: number of patch positions in batch\n """"""\n def __init__(\n self,\n input_dim: int,\n model_dim: int,\n ffn_dim: int,\n out_dim: int,\n num_blocks: int,\n num_heads: int,\n dropout: float,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n decode: bool,\n rngs: nnx.Rngs,\n max_len: int = 5000,\n ):\n self.input_dim = input_dim\n self.model_dim = model_dim\n self.ffn_dim = ffn_dim\n self.out_dim = out_dim\n self.num_blocks = num_blocks\n self.num_heads = num_heads\n self.dropout = dropout\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n\n self.input_norm1 = nnx.LayerNorm(\n num_features=self.input_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n self.input_dense = nnx.Linear(\n in_features=self.input_dim,\n out_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n self.input_norm2 = nnx.LayerNorm(\n num_features=self.model_dim,\n param_dtype=self.param_dtype,\n dtype=self.param_dtype, # layer norm in full precision\n rngs=rngs,\n )\n\n self.pos_enc = SpatioTemporalPositionalEncoding(self.model_dim, max_len=max_len)\n\n self.blocks: List[TransformerBlock] = []\n for _ in range(self.num_blocks):\n self.blocks.append(\n TransformerBlock(\n model_dim=self.model_dim,\n ffn_dim=self.ffn_dim,\n num_heads=self.num_heads,\n dropout=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n decode=decode,\n rngs=rngs,\n )\n )\n self.output_dense = nnx.Linear(\n in_features=self.model_dim,\n out_features=self.out_dim,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n rngs=rngs,\n )\n\n def __call__(self, x_BTNI: jax.Array, pos_index: Tuple[jax.Array, jax.Array] | None = None) -> jax.Array:\n x_BTNI = self.input_norm1(x_BTNI)\n x_BTNM = self.input_dense(x_BTNI)\n x_BTNM = self.input_norm2(x_BTNM)\n x_BTNM = self.pos_enc(x_BTNM)\n for block in self.blocks:\n x_BTNM = block(x_BTNM, pos_index)\n\n x_BTNV = self.output_dense(x_BTNM)\n return x_BTNV\n\ndef normalize(x: jax.Array) -> jax.Array:\n return x / (jnp.linalg.norm(x, ord=2, axis=-1, keepdims=True) + 1e-8)\n\n\nclass VectorQuantizer(nnx.Module):\n """"""\n Dimension keys:\n D: B * T * N\n K: number of latents\n L: latent dimension\n """"""\n def __init__(\n self, latent_dim: int, num_latents: int, dropout: float, rngs: nnx.Rngs\n ):\n self.latent_dim = latent_dim\n self.num_latents = num_latents\n self.dropout = dropout\n\n self.codebook = nnx.Param(\n normalize(\n nnx.initializers.lecun_uniform()(\n rngs.params(), (self.num_latents, self.latent_dim)\n )\n )\n )\n self.drop = nnx.Dropout(self.dropout, rngs=rngs)\n\n def __call__(\n self, x_DL: jax.Array, training: bool\n ) -> Tuple[jax.Array, jax.Array, jax.Array, jax.Array]:\n # --- Compute distances ---\n x_DL = normalize(x_DL)\n normalized_codebook_KL = normalize(self.codebook.value)\n distance_DK = -jnp.matmul(x_DL, normalized_codebook_KL.T)\n if training:\n distance_DK = self.drop(distance_DK)\n\n # --- Get indices and embeddings ---\n indices_D = jnp.argmin(distance_DK, axis=-1)\n z_DL = self.codebook[indices_D]\n\n # --- Straight through estimator ---\n z_q_DL = x_DL + jax.lax.stop_gradient(z_DL - x_DL)\n return z_q_DL, z_DL, x_DL, indices_D\n\n def get_codes(self, indices_E: jax.Array) -> jax.Array:\n return self.codebook[indices_E]\n\n\ndef _create_flash_attention_fn(use_flash_attention: bool, is_causal: bool) -> Callable:\n """"""\n Create an attention function that uses flash attention if enabled.\n\n flax.nnx.MultiHeadAttention provides tensors with shape (batch..., length, num_heads, head_dim),\n but jax.nn.dot_product_attention expects (batch, length, num_heads, head_dim). We reshape to\n ensure compatibility. cuDNN's flash attention additionally requires a sequence length that\n is a multiple of 4. We pad the sequence length to the nearest multiple of 4 and mask\n accordingly. Note that cuDNN requires the mask to be broadcast before calling the attention\n function due to strict shape checking.\n """"""\n\n def attention_fn(query_BTHD, key_BSHD, value_BSHD, bias=None, mask_B111=None, **kwargs):\n implementation = ""cudnn"" if use_flash_attention else None\n\n def _merge_batch_dims(x):\n return einops.rearrange(x, ""... l h k -> (...) l h k"")\n\n def _pad(x, pad_size):\n return jnp.pad(x, ((0, 0), (0, pad_size), (0, 0), (0, 0)))\n\n original_shape = query_BTHD.shape\n T = query_BTHD.shape[-3]\n S = key_BSHD.shape[-3]\n\n # Pad to nearest multiple of 4\n Q = ((T + 3) // 4) * 4\n pad_size_Q = Q - T\n K = ((S + 3) // 4) * 4\n pad_size_K = K - S\n\n query_BQHD = _pad(_merge_batch_dims(query_BTHD), pad_size_Q)\n key_BKHD = _pad(_merge_batch_dims(key_BSHD), pad_size_K)\n value_BKHD = _pad(_merge_batch_dims(value_BSHD), pad_size_K)\n\n attention_mask = jnp.ones((Q, K), dtype=jnp.bool_)\n attention_mask = attention_mask.at[T:, :].set(False)\n attention_mask = attention_mask.at[:, S:].set(False)\n\n mask_11TS = attention_mask[jnp.newaxis, jnp.newaxis, :, :]\n\n bias_4d = jnp.pad(_merge_batch_dims(bias), ((0, 0), (0, 0), (0, pad_size_Q), (0, pad_size_K))) if bias is not None else None\n\n # NOTE: jax.nn.dot_product_attention does not support dropout\n output_4d = jax.nn.dot_product_attention(\n query=query_BQHD,\n key=key_BKHD,\n value=value_BKHD,\n bias=bias_4d,\n mask=mask_11TS,\n implementation=implementation,\n is_causal=is_causal,\n )\n return output_4d[..., :T, :, :].reshape(original_shape)\n\n return attention_fn\n",python,tab
30
+ 29,120042,"utils/nn.py",12382,41," self.input_norm1 = nnx.LayerNorm(",python,selection_command
31
+ 30,183341,"utils/nn.py",12413,0,"",python,selection_command
32
+ 31,305013,"utils/nn.py",12382,0,"",python,selection_command
33
+ 32,305620,"utils/nn.py",12381,0,"",python,selection_command
34
+ 33,499306,"Untitled-1",0,0,"",plaintext,tab
35
+ 34,500313,"utils/nn.py",0,0,"",python,tab
36
+ 35,502874,"train_dynamics.py",0,0,"",python,tab
37
+ 36,601221,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"",shellscript,tab
38
+ 37,602437,"train_dynamics.py",0,0,"",python,tab
39
+ 38,604230,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"",shellscript,tab
40
+ 39,609283,"slurm/jobs/alfred/berlin/coinrun/coinrun_dynamics/coinrun_dynamics.sbatch",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=4\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:4\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=train_dynamics_causal_coinrun\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nmodule unload mpi/openmpi/5.0\nmodule unload devel/cuda/12.4\nsource .venv/bin/activate\n\narray_records_dir=/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""dynamics coinrun 38M ${DYNATYPE}""\n\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\ntokenizer_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/train_tokenizer_1e-4_3414046""\nlam_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/train_lam_model_size_scaling_38M_18742""\n\nenv | grep SLURM\n\nsrun python train_dynamics.py \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --batch_size=48 \\n --image_height=64 \\n --image_width=64 \\n --dyna_type=${DYNATYPE} \\n --init_lr=0 \\n --max_lr=1e-5 \\n --log_image_interval=1000 \\n --log \\n --log_checkpoint_interval=1000 \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --lam_checkpoint=""${lam_ckpt_dir}"" \\n --data_dir $array_records_dir &\n\nchild_pid=$!\n\nwait $child_pid\n",shellscript,tab
41
+ 40,610134,"slurm/jobs/alfred/berlin/coinrun/coinrun_dynamics/coinrun_dynamics.sbatch",337,0,"",shellscript,selection_mouse
42
+ 41,610926,"slurm/jobs/alfred/berlin/coinrun/coinrun_dynamics/coinrun_dynamics.sbatch",0,2367,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=4\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:4\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=train_dynamics_causal_coinrun\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nmodule unload mpi/openmpi/5.0\nmodule unload devel/cuda/12.4\nsource .venv/bin/activate\n\narray_records_dir=/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""dynamics coinrun 38M ${DYNATYPE}""\n\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\ntokenizer_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/train_tokenizer_1e-4_3414046""\nlam_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/train_lam_model_size_scaling_38M_18742""\n\nenv | grep SLURM\n\nsrun python train_dynamics.py \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --batch_size=48 \\n --image_height=64 \\n --image_width=64 \\n --dyna_type=${DYNATYPE} \\n --init_lr=0 \\n --max_lr=1e-5 \\n --log_image_interval=1000 \\n --log \\n --log_checkpoint_interval=1000 \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --lam_checkpoint=""${lam_ckpt_dir}"" \\n --data_dir $array_records_dir &\n\nchild_pid=$!\n\nwait $child_pid\n",shellscript,selection_command
43
+ 42,611180,"slurm/jobs/alfred/berlin/coinrun/coinrun_dynamics/coinrun_dynamics.sbatch",2367,0,"",shellscript,selection_command
44
+ 43,611892,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"",shellscript,tab
45
+ 44,612610,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=4\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:4\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/%x_%j.log\n#SBATCH --job-name=train_dynamics_causal_coinrun\n#SBATCH --requeue\n#SBATCH --signal=b:usr1@300 # 5 min before timeout\n\n\n# --- signal trap to requeue job before timeout ---\nrequeue_job() {\n echo ""[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID...""\n # optional: trigger checkpoint saving here\n # e.g., touch $checkpoint_dir/requeue_trigger\n scontrol requeue $SLURM_JOB_ID\n exit 0\n}\n\ntrap requeue_job sigusr1\n\n# set checkpoint flag based on restart count\nrestart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)\n\nif [ $restart_count -eq 0 ]; then\n restore_ckpt_flag=""--no-restore-ckpt""\nelse\n restore_ckpt_flag=""--restore-ckpt""\nfi\n\n\n\n# Log the sbatch script\ncat $0\n\nmodule unload mpi/openmpi/5.0\nmodule unload devel/cuda/12.4\nsource .venv/bin/activate\n\narray_records_dir=/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records\n\njob_name=$SLURM_JOB_NAME\nslurm_job_id=$SLURM_JOB_ID\n\ntags=""dynamics coinrun 38M ${DYNATYPE}""\n\nCHECKPOINT_DIR=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/${job_name}/${slurm_job_id}""\nmkdir -p $CHECKPOINT_DIR\n\ntokenizer_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/train_tokenizer_1e-4_3414046""\nlam_ckpt_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/lam/train_lam_model_size_scaling_38M_18742""\n\nenv | grep SLURM\n\nsrun python train_dynamics.py \\n --save_ckpt \\n $restore_ckpt_flag \\n --wandb_id $SLURM_JOB_ID \\n --ckpt_dir $CHECKPOINT_DIR \\n --batch_size=48 \\n --image_height=64 \\n --image_width=64 \\n --dyna_type=${DYNATYPE} \\n --init_lr=0 \\n --max_lr=1e-5 \\n --log_image_interval=1000 \\n --log \\n --log_checkpoint_interval=1000 \\n --name=""${job_name}_${slurm_job_id}"" \\n --tags ${tags} \\n --entity instant-uv \\n --project jafar \\n --tokenizer_checkpoint=""${tokenizer_ckpt_dir}"" \\n --lam_checkpoint=""${lam_ckpt_dir}"" \\n --data_dir $array_records_dir &\n\nchild_pid=$!\n\nwait $child_pid\n",shellscript,content
46
+ 45,614195,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"",shellscript,selection_command
47
+ 46,615506,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",20,0,"",shellscript,selection_command
48
+ 47,616307,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",21,0,"",shellscript,selection_command
49
+ 48,616788,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",39,0,"",shellscript,selection_command
50
+ 49,616962,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",67,0,"",shellscript,selection_command
51
+ 50,617115,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",91,0,"",shellscript,selection_command
52
+ 51,617225,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",117,0,"",shellscript,selection_command
53
+ 52,617367,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",138,0,"",shellscript,selection_command
54
+ 53,617510,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",231,0,"",shellscript,selection_command
55
+ 54,617700,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",323,0,"",shellscript,selection_command
56
+ 55,618332,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",231,0,"",shellscript,selection_command
57
+ 56,620883,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",232,0,"",shellscript,selection_command
58
+ 57,621052,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",239,0,"",shellscript,selection_command
59
+ 58,621237,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",241,0,"",shellscript,selection_command
60
+ 59,621530,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",246,0,"",shellscript,selection_command
61
+ 60,622141,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,0,"",shellscript,selection_command
62
+ 61,622157,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,1,"/",shellscript,selection_command
63
+ 62,622170,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",246,2,"=/",shellscript,selection_command
64
+ 63,622200,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,1,"/",shellscript,selection_command
65
+ 64,623033,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,0,"",shellscript,selection_command
66
+ 65,623677,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",246,0,"",shellscript,selection_command
67
+ 66,623693,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,0,"",shellscript,selection_command
68
+ 67,623890,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",251,0,"",shellscript,selection_command
69
+ 68,624059,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",252,0,"",shellscript,selection_command
70
+ 69,625090,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",248,0,"",shellscript,selection_command
71
+ 70,625252,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",246,0,"",shellscript,selection_command
72
+ 71,625923,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,0,"",shellscript,selection_command
73
+ 72,625979,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,1,"/",shellscript,selection_command
74
+ 73,626028,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,5,"/fast",shellscript,selection_command
75
+ 74,626227,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,6,"/fast/",shellscript,selection_command
76
+ 75,626478,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,13,"/fast/project",shellscript,selection_command
77
+ 76,626503,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,14,"/fast/project/",shellscript,selection_command
78
+ 77,626535,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,30,"/fast/project/HFMI_SynergyUnit",shellscript,selection_command
79
+ 78,626567,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,31,"/fast/project/HFMI_SynergyUnit/",shellscript,selection_command
80
+ 79,626601,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,39,"/fast/project/HFMI_SynergyUnit/jafar_ws",shellscript,selection_command
81
+ 80,626719,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,40,"/fast/project/HFMI_SynergyUnit/jafar_ws/",shellscript,selection_command
82
+ 81,626911,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,44,"/fast/project/HFMI_SynergyUnit/jafar_ws/logs",shellscript,selection_command
83
+ 82,627082,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,45,"/fast/project/HFMI_SynergyUnit/jafar_ws/logs/",shellscript,selection_command
84
+ 83,627261,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,48,"/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali",shellscript,selection_command
85
+ 84,627429,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,49,"/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/",shellscript,selection_command
86
+ 85,627608,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,56,"/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun",shellscript,selection_command
87
+ 86,627797,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,57,"/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/",shellscript,selection_command
88
+ 87,627998,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,65,"/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics",shellscript,selection_command
89
+ 88,629601,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",310,0,"",shellscript,selection_command
90
+ 89,630366,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",311,0,"",shellscript,selection_command
91
+ 90,630527,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",311,1,"s",shellscript,selection_command
92
+ 91,630996,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",311,2,"s/",shellscript,selection_command
93
+ 92,631142,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",312,0,"",shellscript,selection_command
94
+ 93,631525,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",312,1,"/",shellscript,selection_command
95
+ 94,631844,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",304,9,"dynamics/",shellscript,selection_command
96
+ 95,632093,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",303,10,"/dynamics/",shellscript,selection_command
97
+ 96,632120,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",296,17,"coinrun/dynamics/",shellscript,selection_command
98
+ 97,632152,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",295,18,"/coinrun/dynamics/",shellscript,selection_command
99
+ 98,632185,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",292,21,"ali/coinrun/dynamics/",shellscript,selection_command
100
+ 99,632218,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",291,22,"/ali/coinrun/dynamics/",shellscript,selection_command
101
+ 100,632250,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",287,26,"logs/ali/coinrun/dynamics/",shellscript,selection_command
102
+ 101,632284,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",286,27,"/logs/ali/coinrun/dynamics/",shellscript,selection_command
103
+ 102,632331,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",278,35,"jafar_ws/logs/ali/coinrun/dynamics/",shellscript,selection_command
104
+ 103,632373,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",277,36,"/jafar_ws/logs/ali/coinrun/dynamics/",shellscript,selection_command
105
+ 104,632394,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",261,52,"HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/",shellscript,selection_command
106
+ 105,632490,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",260,53,"/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/",shellscript,selection_command
107
+ 106,632754,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",253,60,"project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/",shellscript,selection_command
108
+ 107,632840,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",252,61,"/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/",shellscript,selection_command
109
+ 108,633043,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",248,65,"fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/",shellscript,selection_command
110
+ 109,633645,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,66,"/fast/project/HFMI_SynergyUnit/jafar_ws/logs/ali/coinrun/dynamics/",shellscript,selection_command
111
+ 110,634309,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",247,0,"",shellscript,selection_command
112
+ 111,1975309,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"Switched from branch 'full-precision-layernorm' to 'main'",shellscript,git_branch_checkout
113
+ 112,2540341,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"Switched from branch 'main' to 'full-precision-layernorm'",shellscript,git_branch_checkout
114
+ 113,3785453,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"Switched from branch 'full-precision-layernorm' to 'main'",shellscript,git_branch_checkout
115
+ 114,6205643,"slurm/jobs/franz/berlin/coinrun/coinrun_dynamics_fp32_layernorm.sh",0,0,"Switched from branch 'main' to 'momentum-in-fp32'",shellscript,git_branch_checkout
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-48dc8d22-5622-471d-af36-8bb5dbaedf1f1764861190077-2025_12_04-16.13.17.323/source.csv ADDED
@@ -0,0 +1,741 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,202,"Untitled-1",0,0,"",plaintext,tab
3
+ 2,402,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"4:13:17 PM [info] Activating crowd-code\n4:13:17 PM [info] Recording started\n4:13:17 PM [info] Initializing git provider using file system watchers...\n4:13:17 PM [info] No workspace folder found\n",Log,tab
4
+ 3,2375,"extension-output-pdoom-org.crowd-code-#1-crowd-code",194,0,"4:13:19 PM [info] Retrying git provider initialization...\n4:13:19 PM [info] No workspace folder found\n",Log,content
5
+ 4,690522,"Untitled-1",0,0,"",plaintext,tab
6
+ 5,690648,"Untitled-2",0,0,"",plaintext,tab
7
+ 6,691833,"Untitled-1",0,0,"",plaintext,tab
8
+ 7,692610,"Untitled-1",0,0,"n",plaintext,content
9
+ 8,692612,"Untitled-1",1,0,"",plaintext,selection_keyboard
10
+ 9,692980,"Untitled-1",0,1,"",plaintext,content
11
+ 10,700770,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",0,0,"#!/usr/bin/env python3\nfrom __future__ import annotations\n\nimport argparse\nimport io\nimport concurrent.futures\nimport os\nimport re\nimport shutil\nimport sys\nimport tempfile\nfrom dataclasses import dataclass\nfrom pathlib import Path\nfrom typing import Iterable, Iterator, List, Optional, Pattern, Sequence, Tuple\n\n\nDEFAULT_TIMESTAMP_PATTERNS: Sequence[str] = (\n # Numeric timestamp format: e.g., 2218,3257761 (two integer groups separated by a comma)\n # Word-boundary-like guards to avoid partial matches inside larger numbers\n r""(?<!\d)\d+,\d+(?!\d)"",\n)\n\n\ndef compile_timestamp_regexes(patterns: Sequence[str]) -> List[Pattern[str]]:\n return [re.compile(p) for p in patterns]\n\n\ndef find_timestamp_spans(text: str, regexes: Sequence[Pattern[str]]) -> List[Tuple[int, int]]:\n spans: List[Tuple[int, int]] = []\n for rx in regexes:\n for m in rx.finditer(text):\n spans.append((m.start(), m.end()))\n spans.sort(key=lambda s: s[0])\n # Merge overlapping/adjacent spans coming from different regexes\n merged: List[Tuple[int, int]] = []\n for s in spans:\n if not merged or s[0] > merged[-1][1]:\n merged.append(list(s)) # type: ignore[list-item]\n else:\n prev_start, prev_end = merged[-1]\n merged[-1] = (prev_start, max(prev_end, s[1]))\n return [(int(a), int(b)) for a, b in merged]\n\n\ndef _is_inside_quotes(line: str, idx: int) -> bool:\n """"""Return True if the character position idx is inside a CSV quoted field.\n\n CSV quoting uses double quotes ("") and doubles them ("""") to escape.\n We scan from start to idx (exclusive) and toggle quote-state, skipping escaped quotes.\n """"""\n in_quotes = False\n i = 0\n # We only need quote state up to the index where a match begins\n while i < idx and i < len(line):\n ch = line[i]\n if ch == '""':\n # Escaped quote inside a quoted field: """"\n if in_quotes and i + 1 < idx and line[i + 1] == '""':\n i += 2\n continue\n in_quotes = not in_quotes\n i += 1\n return in_quotes\n\n\ndef find_row_start_indices(line: str, timestamp_regexes: List[Pattern[str]]) -> List[int]:\n """"""Find indices where a new CSV row likely starts within a (possibly merged) line.\n\n Heuristic:\n - A row start looks like digits,digits (first two numeric columns)\n - It must be OUTSIDE quoted fields\n - It must be either at the start of the line, or NOT immediately preceded by a comma\n (to avoid matching numeric pairs that are simply subsequent columns like 0,0)\n - It should be immediately followed by a comma (end of second numeric column)\n """"""\n indices: List[int] = []\n for rx in timestamp_regexes:\n for m in rx.finditer(line):\n s, e = m.start(), m.end()\n if _is_inside_quotes(line, s):\n continue\n prev = s - 1\n # Must be start-of-line or not immediately after a comma\n if prev >= 0 and line[prev] == ',':\n continue\n # Should be followed by a comma (after the second number ends)\n if e < len(line) and line[e] != ',':\n continue\n indices.append(s)\n\n # Sort and unique\n indices = sorted(set(indices))\n return indices\n\n\ndef needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True\n if len(starts) == 1:\n # Split when a header-like prefix precedes the first timestamp\n prefix = line[: starts[0]]\n if prefix.strip("" ,;|\t\r\n"") != """":\n return True\n return False\n\n\ndef split_line_on_timestamps(line: str, timestamp_regexes: List[Pattern[str]], max_splits_per_line: int) -> List[str]:\n """"""\n Split a line into multiple lines when multiple timestamp tokens are present.\n\n Strategy:\n - Detect all timestamp spans (merged across patterns).\n - If multiple spans exist, start a new CSV row at each timestamp except the first.\n - Keep delimiters and content from each start to right before the next timestamp.\n - Trim leading whitespace/separators between chunks.\n """"""\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) == 0:\n return [line]\n\n # Build chunks: [0:first_start) is kept with first chunk if it's not just separators\n chunks: List[str] = []\n # Pre-chunk content\n prefix = line[: starts[0]]\n # If prefix has non-separator characters, keep it attached to the first chunk.\n # Otherwise, drop it.\n def is_only_separators(s: str) -> bool:\n return s.strip("" ,;|\t\r\n"") == """"\n\n effective_start = 0 if not is_only_separators(prefix) else starts[0]\n\n indices: List[int] = [effective_start] + starts\n # Ensure uniqueness and ascending\n indices = sorted(set(indices))\n\n for i, idx in enumerate(indices):\n next_idx = indices[i + 1] if i + 1 < len(indices) else len(line)\n segment = line[idx:next_idx]\n # Clean up leading separators carried over when we started mid-line\n segment = segment.lstrip("" \t,;|\r"")\n # Also strip trailing newline characters; we'll re-add newline at write time\n segment = segment.rstrip(""\r\n"")\n if segment:\n chunks.append(segment)\n\n if len(chunks) >= max_splits_per_line:\n raise ValueError(f""Suspiciously many splits in line: {line}"")\n\n return chunks if chunks else [line]\n\n\ndef iter_csv_files(root: Path) -> Iterator[Path]:\n for base, _dirs, files in os.walk(root):\n for name in files:\n if name.lower().endswith("".csv""):\n yield Path(base) / name\n\n\ndef atomic_write_text(target: Path, content: str) -> None:\n tmp_dir = target.parent\n with tempfile.NamedTemporaryFile(""w"", delete=False, dir=tmp_dir) as tf:\n tmp_path = Path(tf.name)\n tf.write(content)\n try:\n os.replace(tmp_path, target)\n except Exception:\n tmp_path.unlink(missing_ok=True)\n raise\n\n\ndef process_file(path: Path, timestamp_regexes: List[Pattern[str]], max_splits_per_line: int, dry_run: bool = False) -> Tuple[bool, int]:\n changed = False\n changes_count = 0\n with path.open(""r"", encoding=""utf-8"", errors=""replace"", newline="""") as f:\n original_lines = f.readlines()\n\n output_lines: List[str] = []\n for line in original_lines:\n if needs_split(line, timestamp_regexes):\n parts = split_line_on_timestamps(line, timestamp_regexes, max_splits_per_line)\n if len(parts) > 1:\n changed = True\n changes_count += len(parts) - 1\n for p in parts:\n output_lines.append(p + ""\n"")\n else:\n output_lines.append(line)\n\n if changed and not dry_run:\n atomic_write_text(path, """".join(output_lines))\n\n return changed, changes_count\n\n\ndef parse_args(argv: Optional[Sequence[str]] = None) -> argparse.Namespace:\n p = argparse.ArgumentParser(description=""Insert missing CSV newlines based on timestamp heuristics."")\n p.add_argument(""root"", type=str, help=""Root directory to scan recursively for .csv files"")\n p.add_argument(""--pattern"", ""-p"", action=""append"", default=list(DEFAULT_TIMESTAMP_PATTERNS),\n help=""Regex for timestamps (can be repeated). Default: numeric 'digits,digits'."")\n p.add_argument(""--dry-run"", action=""store_true"", help=""Do not modify files, just report changes"")\n p.add_argument(""--max-splits"", type=int, default=5, help=""Safety: maximum chunks per merged line"")\n p.add_argument(""--jobs"", ""-j"", type=int, default=os.cpu_count() or 1, help=""Number of parallel jobs"")\n return p.parse_args(argv)\n\n\ndef main(argv: Optional[Sequence[str]] = None) -> int:\n args = parse_args(argv)\n root = Path(args.root)\n if not root.exists() or not root.is_dir():\n print(f""Root directory not found: {root}"", file=sys.stderr)\n return 2\n\n timestamp_regexes = compile_timestamp_regexes(args.pattern)\n\n all_files = list(iter_csv_files(root))\n total_files = len(all_files)\n modified_files = 0\n total_inserts = 0\n\n with concurrent.futures.ProcessPoolExecutor(max_workers=args.jobs) as executor:\n future_to_path = {\n executor.submit(process_file, p, timestamp_regexes, args.max_splits, bool(args.dry_run)): p\n for p in all_files\n }\n\n for future in concurrent.futures.as_completed(future_to_path):\n path = future_to_path[future]\n try:\n changed, count = future.result()\n if changed:\n modified_files += 1\n total_inserts += count\n action = ""WOULD FIX"" if args.dry_run else ""FIXED""\n print(f""{action}: {path} (+{count} newline(s))"")\n except Exception as exc:\n print(f""Error processing {path}: {exc}"", file=sys.stderr)\n\n print(f""Scanned {total_files} CSV file(s). Modified {modified_files}. Inserted {total_inserts} newline(s)."")\n return 0\n\n\nif __name__ == ""__main__"":\n raise SystemExit(main())\n\n\n",python,tab
12
+ 11,702539,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",928,0,"",python,selection_command
13
+ 12,703022,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",932,0,"",python,selection_command
14
+ 13,703531,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",932,30,"",python,content
15
+ 14,703864,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",932,0,"s",python,content
16
+ 15,703866,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",933,0,"",python,selection_keyboard
17
+ 16,703927,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",933,0,"p",python,content
18
+ 17,703929,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",934,0,"",python,selection_keyboard
19
+ 18,704054,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",934,0,"a",python,content
20
+ 19,704056,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",935,0,"",python,selection_keyboard
21
+ 20,704132,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",935,0,"n",python,content
22
+ 21,704135,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",936,0,"",python,selection_keyboard
23
+ 22,709828,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",935,0,"",python,selection_command
24
+ 23,710272,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",936,0,"s.sort(key=lambda s: s[0])",python,content
25
+ 24,710277,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",932,0,"",python,selection_command
26
+ 25,710832,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",937,0,"",python,selection_command
27
+ 26,711047,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,0,"",python,selection_command
28
+ 27,711251,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,0,"",python,selection_command
29
+ 28,711843,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",941,0,"",python,selection_command
30
+ 29,711973,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",940,0,"",python,selection_command
31
+ 30,712116,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",939,0,"",python,selection_command
32
+ 31,712243,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,0,"",python,selection_command
33
+ 32,712414,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",937,0,"",python,selection_command
34
+ 33,712867,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,0,"",python,selection_command
35
+ 34,713162,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,24,"",python,content
36
+ 35,713564,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",937,1,"",python,content
37
+ 36,713717,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",937,0,".",python,content
38
+ 37,713720,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,0,"",python,selection_keyboard
39
+ 38,713927,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,0,"s",python,content
40
+ 39,713930,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",939,0,"",python,selection_keyboard
41
+ 40,715238,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",939,0,"o",python,content
42
+ 41,715241,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",940,0,"",python,selection_keyboard
43
+ 42,717362,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",940,0,"r",python,content
44
+ 43,717364,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",941,0,"",python,selection_keyboard
45
+ 44,717727,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",941,0,"t",python,content
46
+ 45,717730,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,0,"",python,selection_keyboard
47
+ 46,719820,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",941,0,"",python,selection_command
48
+ 47,720353,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,0,"",python,selection_command
49
+ 48,722186,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",895,0,"",python,selection_command
50
+ 49,722189,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,0,"",python,selection_command
51
+ 50,724834,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,0,"()",python,content
52
+ 51,724837,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",943,0,"",python,selection_keyboard
53
+ 52,726527,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",944,0,"",python,selection_command
54
+ 53,726816,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",943,0,"",python,selection_command
55
+ 54,728232,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",944,0,"",python,selection_command
56
+ 55,728648,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",943,0,"",python,selection_command
57
+ 56,729560,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",944,0,"",python,selection_command
58
+ 57,729980,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",943,0,"",python,selection_command
59
+ 58,730965,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",944,0,"",python,selection_command
60
+ 59,731250,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",943,1,"",python,content
61
+ 60,733955,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,1,"",python,content
62
+ 61,734123,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",941,1,"",python,content
63
+ 62,735977,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",940,1,"",python,content
64
+ 63,736534,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",939,1,"",python,content
65
+ 64,736688,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,1,"",python,content
66
+ 65,736855,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",937,1,"",python,content
67
+ 66,737097,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",937,0,".",python,content
68
+ 67,737100,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,0,"",python,selection_keyboard
69
+ 68,738488,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",937,0,"",python,selection_command
70
+ 69,738751,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,0,"sort()",python,content
71
+ 70,738756,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",943,0,"",python,selection_command
72
+ 71,739288,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,2,"",python,content
73
+ 72,739297,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",941,0,"",python,selection_command
74
+ 73,739680,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,0,"(key=lambda s: s[0])",python,content
75
+ 74,739685,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",938,0,"",python,selection_command
76
+ 75,742047,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",942,0,"",python,selection_command
77
+ 76,742234,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",943,0,"",python,selection_command
78
+ 77,742526,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",946,0,"",python,selection_command
79
+ 78,744059,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",981,0,"",python,selection_command
80
+ 79,744215,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1050,0,"",python,selection_command
81
+ 80,744461,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1089,0,"",python,selection_command
82
+ 81,744497,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1109,0,"",python,selection_command
83
+ 82,744529,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1156,0,"",python,selection_command
84
+ 83,744563,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1212,0,"",python,selection_command
85
+ 84,744728,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1232,0,"",python,selection_command
86
+ 85,744732,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1278,0,"",python,selection_command
87
+ 86,744736,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1337,0,"",python,selection_command
88
+ 87,744740,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1368,0,"",python,selection_command
89
+ 88,744743,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1369,0,"",python,selection_command
90
+ 89,744772,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1388,0,"",python,selection_command
91
+ 90,744797,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1440,0,"",python,selection_command
92
+ 91,744833,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1501,0,"",python,selection_command
93
+ 92,744862,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1520,0,"",python,selection_command
94
+ 93,744896,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1592,0,"",python,selection_command
95
+ 94,744931,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1671,0,"",python,selection_command
96
+ 95,744965,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1691,0,"",python,selection_command
97
+ 96,744997,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1703,0,"",python,selection_command
98
+ 97,745033,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1723,0,"",python,selection_command
99
+ 98,745073,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1791,0,"",python,selection_command
100
+ 99,745098,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1828,0,"",python,selection_command
101
+ 100,745140,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1849,0,"",python,selection_command
102
+ 101,745165,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1871,0,"",python,selection_command
103
+ 102,745208,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1925,0,"",python,selection_command
104
+ 103,745246,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1990,0,"",python,selection_command
105
+ 104,745270,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2013,0,"",python,selection_command
106
+ 105,745307,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2038,0,"",python,selection_command
107
+ 106,745330,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2071,0,"",python,selection_command
108
+ 107,745364,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2091,0,"",python,selection_command
109
+ 108,745398,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2094,0,"",python,selection_command
110
+ 109,745629,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2091,0,"",python,selection_command
111
+ 110,745862,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2071,0,"",python,selection_command
112
+ 111,745888,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2038,0,"",python,selection_command
113
+ 112,745929,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2013,0,"",python,selection_command
114
+ 113,745967,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1990,0,"",python,selection_command
115
+ 114,745998,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1925,0,"",python,selection_command
116
+ 115,746025,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1871,0,"",python,selection_command
117
+ 116,746063,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1849,0,"",python,selection_command
118
+ 117,746098,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1828,0,"",python,selection_command
119
+ 118,746127,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1791,0,"",python,selection_command
120
+ 119,746282,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1723,0,"",python,selection_command
121
+ 120,746425,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1703,0,"",python,selection_command
122
+ 121,746551,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1691,0,"",python,selection_command
123
+ 122,747292,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"",python,selection_command
124
+ 123,747587,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,5,"",python,content
125
+ 124,748831,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1688,1,"",python,content
126
+ 125,748907,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1688,0," ",python,content
127
+ 126,748909,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"",python,selection_keyboard
128
+ 127,811122,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1688,0,"",python,selection_command
129
+ 128,811335,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"",python,selection_command
130
+ 129,812056,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1688,1,"",python,content
131
+ 130,812239,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1687,1,"",python,content
132
+ 131,812769,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1687,0,"=",python,content
133
+ 132,812771,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1688,0,"",python,selection_keyboard
134
+ 133,813125,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1688,0," ",python,content
135
+ 134,813127,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"",python,selection_keyboard
136
+ 135,816009,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"F",python,content
137
+ 136,816011,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1690,0,"",python,selection_keyboard
138
+ 137,817783,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"",python,selection_command
139
+ 138,817829,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1690,0,"",python,selection_command
140
+ 139,819691,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1690,0,"a",python,content
141
+ 140,819694,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1691,0,"",python,selection_keyboard
142
+ 141,820483,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1690,0,"",python,selection_command
143
+ 142,820487,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1691,0,"",python,selection_command
144
+ 143,822784,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1690,0,"",python,selection_command
145
+ 144,822882,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1690,1,"",python,content
146
+ 145,822887,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"",python,selection_command
147
+ 146,823515,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,1,"",python,content
148
+ 147,823520,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1688,0,"",python,selection_command
149
+ 148,824179,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"False",python,content
150
+ 149,824182,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1689,0,"",python,selection_command
151
+ 150,892438,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1694,0,"\n ",python,content
152
+ 151,893017,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1699,0,"i",python,content
153
+ 152,893019,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1700,0,"",python,selection_keyboard
154
+ 153,893194,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1700,0," ",python,content
155
+ 154,893197,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1701,0,"",python,selection_keyboard
156
+ 155,893460,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1701,0,"=",python,content
157
+ 156,893463,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1702,0,"",python,selection_keyboard
158
+ 157,893567,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1702,0,"0",python,content
159
+ 158,893569,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1703,0,"",python,selection_keyboard
160
+ 159,894182,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1702,1,"",python,content
161
+ 160,894319,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1702,0," ",python,content
162
+ 161,894321,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1703,0,"",python,selection_keyboard
163
+ 162,895783,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1702,1,"",python,content
164
+ 163,895805,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1701,1,"",python,content
165
+ 164,896145,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1695,6,"",python,content
166
+ 165,896796,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1694,1,"",python,content
167
+ 166,896986,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1693,0,"",python,selection_command
168
+ 167,899400,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1703,0,"",python,selection_command
169
+ 168,899512,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1725,0,"",python,selection_command
170
+ 169,899775,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1793,0,"",python,selection_command
171
+ 170,899793,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1829,0,"",python,selection_command
172
+ 171,899832,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1851,0,"",python,selection_command
173
+ 172,899855,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1873,0,"",python,selection_command
174
+ 173,899889,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1927,0,"",python,selection_command
175
+ 174,899924,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1992,0,"",python,selection_command
176
+ 175,899964,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2015,0,"",python,selection_command
177
+ 176,899993,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2040,0,"",python,selection_command
178
+ 177,900028,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2071,0,"",python,selection_command
179
+ 178,900062,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2092,0,"",python,selection_command
180
+ 179,900101,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2094,0,"",python,selection_command
181
+ 180,900134,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2095,0,"",python,selection_command
182
+ 181,900163,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2116,0,"",python,selection_command
183
+ 182,900195,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2207,0,"",python,selection_command
184
+ 183,900234,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2274,0,"",python,selection_command
185
+ 184,900263,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2288,0,"",python,selection_command
186
+ 185,900294,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2310,0,"",python,selection_command
187
+ 186,900329,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2381,0,"",python,selection_command
188
+ 187,900362,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2420,0,"",python,selection_command
189
+ 188,900395,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2509,0,"",python,selection_command
190
+ 189,900429,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2593,0,"",python,selection_command
191
+ 190,900464,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",2661,0,"",python,selection_command
192
+ 191,901235,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",4442,0,"",python,selection_keyboard
193
+ 192,901497,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",6204,0,"",python,selection_keyboard
194
+ 193,901729,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",8262,0,"",python,selection_keyboard
195
+ 194,901899,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9156,0,"",python,selection_keyboard
196
+ 195,903456,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9155,0,"",python,selection_command
197
+ 196,903525,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9154,0,"",python,selection_command
198
+ 197,903787,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9125,0,"",python,selection_command
199
+ 198,903810,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9098,0,"",python,selection_command
200
+ 199,903843,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,0,"",python,selection_command
201
+ 200,903955,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9096,0,"",python,selection_command
202
+ 201,904034,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9083,0,"",python,selection_command
203
+ 202,904416,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9095,0,"\n ",python,content
204
+ 203,904626,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9100,0,"\n ",python,content
205
+ 204,904627,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9096,4,"",python,content
206
+ 205,904995,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,4,"",python,content
207
+ 206,905438,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,0,"d",python,content
208
+ 207,905440,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9098,0,"",python,selection_keyboard
209
+ 208,905604,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9098,0,"e",python,content
210
+ 209,905606,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9099,0,"",python,selection_keyboard
211
+ 210,905855,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9099,0,"f",python,content
212
+ 211,905858,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9100,0,"",python,selection_keyboard
213
+ 212,906181,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9100,0," ",python,content
214
+ 213,906183,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9101,0,"",python,selection_keyboard
215
+ 214,909527,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9101,0,"h",python,content
216
+ 215,909529,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9102,0,"",python,selection_keyboard
217
+ 216,909571,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9102,0,"e",python,content
218
+ 217,909573,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9103,0,"",python,selection_keyboard
219
+ 218,909753,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9103,0,"l",python,content
220
+ 219,909755,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9104,0,"",python,selection_keyboard
221
+ 220,909878,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9104,0,"l",python,content
222
+ 221,909880,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9105,0,"",python,selection_keyboard
223
+ 222,909968,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9105,0,"o",python,content
224
+ 223,909970,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9106,0,"",python,selection_keyboard
225
+ 224,910295,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9106,0,"_",python,content
226
+ 225,910297,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9107,0,"",python,selection_keyboard
227
+ 226,910461,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9107,0,"w",python,content
228
+ 227,910463,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9108,0,"",python,selection_keyboard
229
+ 228,910593,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9108,0,"o",python,content
230
+ 229,910595,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9109,0,"",python,selection_keyboard
231
+ 230,910664,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9109,0,"r",python,content
232
+ 231,910666,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9110,0,"",python,selection_keyboard
233
+ 232,910909,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9110,0,"l",python,content
234
+ 233,910910,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9111,0,"",python,selection_keyboard
235
+ 234,910970,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9111,0,"d",python,content
236
+ 235,910972,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9112,0,"",python,selection_keyboard
237
+ 236,911896,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9112,0,"()",python,content
238
+ 237,911898,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9113,0,"",python,selection_keyboard
239
+ 238,912038,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9113,1,")",python,content
240
+ 239,912040,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9114,0,"",python,selection_keyboard
241
+ 240,912510,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9114,0,":",python,content
242
+ 241,912511,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9115,0,"",python,selection_keyboard
243
+ 242,912744,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9115,0,"\n ",python,content
244
+ 243,920187,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9116,4,"",python,content
245
+ 244,920348,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9115,1,"",python,content
246
+ 245,920581,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9115,0,"\n ",python,content
247
+ 246,923431,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9120,0,"newline",python,content
248
+ 247,924530,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9126,1,"",python,content
249
+ 248,924700,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9125,1,"",python,content
250
+ 249,924851,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9124,1,"",python,content
251
+ 250,925004,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9123,1,"",python,content
252
+ 251,925286,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9122,1,"",python,content
253
+ 252,925446,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9121,1,"",python,content
254
+ 253,925595,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9120,1,"",python,content
255
+ 254,925768,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9120,0,"p",python,content
256
+ 255,925769,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9121,0,"",python,selection_keyboard
257
+ 256,927396,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9120,0,"",python,selection_command
258
+ 257,927468,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9121,0,"",python,selection_command
259
+ 258,930118,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9121,0,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True\n if len(starts) == 1:\n prefix = line[: starts[0]]\n if prefix.strip("" ,;|\t\n"") != """":\n return True\n return False",python,content
260
+ 259,933647,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9442,0,"",python,selection_command
261
+ 260,934548,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9418,0,"",python,selection_command
262
+ 261,934622,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9401,0,"",python,selection_command
263
+ 262,934776,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9377,0,"",python,selection_command
264
+ 263,935030,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9342,0,"",python,selection_command
265
+ 264,935055,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9317,0,"",python,selection_command
266
+ 265,935082,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9297,0,"",python,selection_command
267
+ 266,935110,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9272,0,"",python,selection_command
268
+ 267,935143,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9211,0,"",python,selection_command
269
+ 268,935292,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9131,0,"",python,selection_command
270
+ 269,936414,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9130,0,"",python,selection_command
271
+ 270,936663,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9129,0,"",python,selection_command
272
+ 271,936696,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9128,0,"",python,selection_command
273
+ 272,936737,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9127,0,"",python,selection_command
274
+ 273,936755,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9126,0,"",python,selection_command
275
+ 274,936793,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9125,0,"",python,selection_command
276
+ 275,936830,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9124,0,"",python,selection_command
277
+ 276,936975,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9123,0,"",python,selection_command
278
+ 277,937134,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9122,0,"",python,selection_command
279
+ 278,938375,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9121,0,"",python,selection_command
280
+ 279,938879,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9116,5,"",python,content
281
+ 280,939561,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,0,"",python,selection_command
282
+ 281,941140,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,18,"",python,content
283
+ 282,941635,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,0,"d",python,content
284
+ 283,941637,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9098,0,"",python,selection_keyboard
285
+ 284,942028,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,1,"",python,content
286
+ 285,942548,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,1,"",python,content
287
+ 286,943533,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9176,0,"",python,selection_command
288
+ 287,944528,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",0,0,"",python,selection_command
289
+ 288,946981,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",3295,0,"",python,selection_command
290
+ 289,947543,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",6434,0,"",python,selection_command
291
+ 290,948159,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9101,0,"",python,selection_command
292
+ 291,949143,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,74,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:",python,selection_command
293
+ 292,949274,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,135,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)",python,selection_command
294
+ 293,950070,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,160,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:",python,selection_command
295
+ 294,950207,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,180,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True",python,selection_command
296
+ 295,950476,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,205,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True\n if len(starts) == 1:",python,selection_command
297
+ 296,950545,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,240,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True\n if len(starts) == 1:\n prefix = line[: starts[0]]",python,selection_command
298
+ 297,950675,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,271,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True\n if len(starts) == 1:\n prefix = line[: starts[0]]\n if prefix.strip("" ,;|\t",python,selection_command
299
+ 298,950831,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,281,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True\n if len(starts) == 1:\n prefix = line[: starts[0]]\n if prefix.strip("" ,;|\t\n"") != """":",python,selection_command
300
+ 299,950949,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,305,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True\n if len(starts) == 1:\n prefix = line[: starts[0]]\n if prefix.strip("" ,;|\t\n"") != """":\n return True",python,selection_command
301
+ 300,951148,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,322,"def needs_split(line: str, timestamp_regexes: List[Pattern[str]]) -> bool:\n starts = find_row_start_indices(line, timestamp_regexes)\n if len(starts) >= 2:\n return True\n if len(starts) == 1:\n prefix = line[: starts[0]]\n if prefix.strip("" ,;|\t\n"") != """":\n return True\n return False",python,selection_command
302
+ 301,951569,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,323,"",python,content
303
+ 302,952215,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,1,"",python,content
304
+ 303,953397,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9096,0,"",python,selection_command
305
+ 304,953579,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9083,0,"",python,selection_command
306
+ 305,953771,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9096,0,"",python,selection_command
307
+ 306,953957,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,0,"",python,selection_command
308
+ 307,956269,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,1,"",python,content
309
+ 308,957250,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",6888,0,"",python,selection_keyboard
310
+ 309,957519,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",5283,0,"",python,selection_keyboard
311
+ 310,957627,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",6888,0,"",python,selection_keyboard
312
+ 311,957908,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9097,0,"",python,selection_keyboard
313
+ 312,957916,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9155,0,"",python,selection_keyboard
314
+ 313,958698,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9154,1,"",python,content
315
+ 314,959123,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9153,1,"",python,content
316
+ 315,962117,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9153,0,"\n",python,content
317
+ 316,963423,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",9153,1,"",python,content
318
+ 317,977780,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",6923,0,"",python,selection_keyboard
319
+ 318,977955,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",5338,0,"",python,selection_keyboard
320
+ 319,980206,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",3366,0,"",python,selection_keyboard
321
+ 320,980284,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",1502,0,"",python,selection_keyboard
322
+ 321,980459,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",0,0,"",python,selection_keyboard
323
+ 322,982604,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",23,0,"",python,selection_command
324
+ 323,982859,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",58,0,"",python,selection_command
325
+ 324,982888,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",59,0,"",python,selection_command
326
+ 325,982911,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",75,0,"",python,selection_command
327
+ 326,982947,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",85,0,"",python,selection_command
328
+ 327,982978,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",111,0,"",python,selection_command
329
+ 328,983011,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",121,0,"",python,selection_command
330
+ 329,983045,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",131,0,"",python,selection_command
331
+ 330,1168840,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
332
+ 331,1169434,"/home/franz.srambical/crowd-pilot/crowd_pilot/insert_missing_csv_newlines.py",0,0,"",python,tab
333
+ 332,1407944,"Untitled-1",0,0,"",plaintext,tab
334
+ 333,1409909,"Untitled-1",0,0,"""",plaintext,content
335
+ 334,1409911,"Untitled-1",1,0,"",plaintext,selection_keyboard
336
+ 335,1410048,"Untitled-1",1,0,"""",plaintext,content
337
+ 336,1410049,"Untitled-1",2,0,"",plaintext,selection_keyboard
338
+ 337,1410865,"Untitled-1",2,0,"""",plaintext,content
339
+ 338,1410867,"Untitled-1",3,0,"",plaintext,selection_keyboard
340
+ 339,1411571,"Untitled-1",3,0,"h",plaintext,content
341
+ 340,1411573,"Untitled-1",4,0,"",plaintext,selection_keyboard
342
+ 341,1411619,"Untitled-1",4,0,"e",plaintext,content
343
+ 342,1411621,"Untitled-1",5,0,"",plaintext,selection_keyboard
344
+ 343,1411814,"Untitled-1",5,0,"l",plaintext,content
345
+ 344,1411815,"Untitled-1",6,0,"",plaintext,selection_keyboard
346
+ 345,1411936,"Untitled-1",6,0,"l",plaintext,content
347
+ 346,1411938,"Untitled-1",7,0,"",plaintext,selection_keyboard
348
+ 347,1412028,"Untitled-1",7,0,"o",plaintext,content
349
+ 348,1412030,"Untitled-1",8,0,"",plaintext,selection_keyboard
350
+ 349,1412228,"Untitled-1",8,0," ",plaintext,content
351
+ 350,1412230,"Untitled-1",9,0,"",plaintext,selection_keyboard
352
+ 351,1412233,"Untitled-1",9,0,"w",plaintext,content
353
+ 352,1412234,"Untitled-1",10,0,"",plaintext,selection_keyboard
354
+ 353,1412320,"Untitled-1",10,0,"o",plaintext,content
355
+ 354,1412322,"Untitled-1",11,0,"",plaintext,selection_keyboard
356
+ 355,1413902,"Untitled-1",11,0,"r",plaintext,content
357
+ 356,1413904,"Untitled-1",12,0,"",plaintext,selection_keyboard
358
+ 357,1414079,"Untitled-1",12,0,"l",plaintext,content
359
+ 358,1414080,"Untitled-1",13,0,"",plaintext,selection_keyboard
360
+ 359,1414196,"Untitled-1",13,0,"d",plaintext,content
361
+ 360,1414197,"Untitled-1",14,0,"",plaintext,selection_keyboard
362
+ 361,1414253,"Untitled-1",14,0," ",plaintext,content
363
+ 362,1414255,"Untitled-1",15,0,"",plaintext,selection_keyboard
364
+ 363,1414515,"Untitled-1",15,0,"f",plaintext,content
365
+ 364,1414517,"Untitled-1",16,0,"",plaintext,selection_keyboard
366
+ 365,1414521,"Untitled-1",16,0,"u",plaintext,content
367
+ 366,1414524,"Untitled-1",17,0,"",plaintext,selection_keyboard
368
+ 367,1414652,"Untitled-1",17,0,"n",plaintext,content
369
+ 368,1414653,"Untitled-1",18,0,"",plaintext,selection_keyboard
370
+ 369,1414709,"Untitled-1",18,0,"c",plaintext,content
371
+ 370,1414711,"Untitled-1",19,0,"",plaintext,selection_keyboard
372
+ 371,1414903,"Untitled-1",19,0,"t",plaintext,content
373
+ 372,1414905,"Untitled-1",20,0,"",plaintext,selection_keyboard
374
+ 373,1414944,"Untitled-1",20,0,"i",plaintext,content
375
+ 374,1414946,"Untitled-1",21,0,"",plaintext,selection_keyboard
376
+ 375,1414984,"Untitled-1",21,0,"o",plaintext,content
377
+ 376,1414986,"Untitled-1",22,0,"",plaintext,selection_keyboard
378
+ 377,1415027,"Untitled-1",22,0,"n",plaintext,content
379
+ 378,1415029,"Untitled-1",23,0,"",plaintext,selection_keyboard
380
+ 379,1415392,"Untitled-1",23,0,"""",plaintext,content
381
+ 380,1415394,"Untitled-1",24,0,"",plaintext,selection_keyboard
382
+ 381,1415886,"Untitled-1",24,0,"""",plaintext,content
383
+ 382,1415887,"Untitled-1",25,0,"",plaintext,selection_keyboard
384
+ 383,1415901,"Untitled-1",25,0,"""",plaintext,content
385
+ 384,1415902,"Untitled-1",26,0,"",plaintext,selection_keyboard
386
+ 385,1416285,"Untitled-1",26,0,"\n",plaintext,content
387
+ 386,1418194,"Untitled-1",27,0,"d",plaintext,content
388
+ 387,1418196,"Untitled-1",28,0,"",plaintext,selection_keyboard
389
+ 388,1418304,"Untitled-1",28,0,"e",plaintext,content
390
+ 389,1418306,"Untitled-1",29,0,"",plaintext,selection_keyboard
391
+ 390,1418507,"Untitled-1",29,0,"f",plaintext,content
392
+ 391,1418508,"Untitled-1",30,0,"",plaintext,selection_keyboard
393
+ 392,1418553,"Untitled-1",30,0," ",plaintext,content
394
+ 393,1421469,"Untitled-1",31,0,"h",plaintext,content
395
+ 394,1421471,"Untitled-1",32,0,"",plaintext,selection_keyboard
396
+ 395,1421531,"Untitled-1",32,0,"e",plaintext,content
397
+ 396,1421532,"Untitled-1",33,0,"",plaintext,selection_keyboard
398
+ 397,1421726,"Untitled-1",33,0,"l",plaintext,content
399
+ 398,1421728,"Untitled-1",34,0,"",plaintext,selection_keyboard
400
+ 399,1421845,"Untitled-1",34,0,"l",plaintext,content
401
+ 400,1421847,"Untitled-1",35,0,"",plaintext,selection_keyboard
402
+ 401,1422160,"Untitled-1",35,0,"o",plaintext,content
403
+ 402,1422163,"Untitled-1",36,0,"",plaintext,selection_keyboard
404
+ 403,1422851,"Untitled-1",36,0,"_",plaintext,content
405
+ 404,1422853,"Untitled-1",37,0,"",plaintext,selection_keyboard
406
+ 405,1423401,"Untitled-1",37,0,"w",plaintext,content
407
+ 406,1423403,"Untitled-1",38,0,"",plaintext,selection_keyboard
408
+ 407,1423405,"Untitled-1",38,0,"o",plaintext,content
409
+ 408,1423406,"Untitled-1",39,0,"",plaintext,selection_keyboard
410
+ 409,1423460,"Untitled-1",39,0,"r",plaintext,content
411
+ 410,1423461,"Untitled-1",40,0,"",plaintext,selection_keyboard
412
+ 411,1423757,"Untitled-1",40,0,"l",plaintext,content
413
+ 412,1423759,"Untitled-1",41,0,"",plaintext,selection_keyboard
414
+ 413,1423875,"Untitled-1",41,0,"()",plaintext,content
415
+ 414,1423877,"Untitled-1",42,0,"",plaintext,selection_keyboard
416
+ 415,1423961,"Untitled-1",42,1,")",plaintext,content
417
+ 416,1423963,"Untitled-1",43,0,"",plaintext,selection_keyboard
418
+ 417,1424659,"Untitled-1",43,0,":",plaintext,content
419
+ 418,1424661,"Untitled-1",44,0,"",plaintext,selection_keyboard
420
+ 419,1424895,"Untitled-1",44,0,"\n",plaintext,content
421
+ 420,1431737,"Untitled-1",43,0,":",plaintext,content
422
+ 421,1432787,"Untitled-1",45,1,"",plaintext,content
423
+ 422,1433168,"Untitled-1",44,1,"",plaintext,content
424
+ 423,1433568,"Untitled-1",44,0,"\n",plaintext,content
425
+ 424,1435099,"Untitled-1",45,0," ",plaintext,content
426
+ 425,1436481,"Untitled-1",49,0,"p",plaintext,content
427
+ 426,1436483,"Untitled-1",50,0,"",plaintext,selection_keyboard
428
+ 427,1439790,"Untitled-1",50,0,"r",plaintext,content
429
+ 428,1439792,"Untitled-1",51,0,"",plaintext,selection_keyboard
430
+ 429,1439828,"Untitled-1",51,0,"i",plaintext,content
431
+ 430,1439830,"Untitled-1",52,0,"",plaintext,selection_keyboard
432
+ 431,1439948,"Untitled-1",52,0,"n",plaintext,content
433
+ 432,1439951,"Untitled-1",53,0,"",plaintext,selection_keyboard
434
+ 433,1439956,"Untitled-1",53,0,"t",plaintext,content
435
+ 434,1439958,"Untitled-1",54,0,"",plaintext,selection_keyboard
436
+ 435,1444009,"Untitled-1",54,0,"()",plaintext,content
437
+ 436,1444011,"Untitled-1",55,0,"",plaintext,selection_keyboard
438
+ 437,1444074,"Untitled-1",55,0,"()",plaintext,content
439
+ 438,1444076,"Untitled-1",56,0,"",plaintext,selection_keyboard
440
+ 439,1444593,"Untitled-1",55,2,"",plaintext,content
441
+ 440,1445276,"Untitled-1",56,0,"",plaintext,selection_command
442
+ 441,1446369,"Untitled-1",55,0,"",plaintext,selection_command
443
+ 442,1448044,"Untitled-1",37,0,"",plaintext,selection_command
444
+ 443,1448787,"Untitled-1",55,0,"",plaintext,selection_command
445
+ 444,1449465,"Untitled-1",37,0,"",plaintext,selection_command
446
+ 445,1449938,"Untitled-1",36,0,"",plaintext,selection_command
447
+ 446,1450311,"Untitled-1",54,0,"",plaintext,selection_command
448
+ 447,1451158,"Untitled-1",44,12,"",plaintext,content
449
+ 448,1451162,"Untitled-1",27,0,"",plaintext,selection_command
450
+ 449,1451933,"Untitled-1",44,0,"",plaintext,selection_command
451
+ 450,1452190,"Untitled-1",43,1,"",plaintext,content
452
+ 451,1452339,"Untitled-1",42,1,"",plaintext,content
453
+ 452,1452466,"Untitled-1",41,1,"",plaintext,content
454
+ 453,1452565,"Untitled-1",41,0,"d",plaintext,content
455
+ 454,1452567,"Untitled-1",42,0,"",plaintext,selection_keyboard
456
+ 455,1452807,"Untitled-1",42,0,"()",plaintext,content
457
+ 456,1452809,"Untitled-1",43,0,"",plaintext,selection_keyboard
458
+ 457,1452959,"Untitled-1",43,1,")",plaintext,content
459
+ 458,1452960,"Untitled-1",44,0,"",plaintext,selection_keyboard
460
+ 459,1453339,"Untitled-1",44,0,":",plaintext,content
461
+ 460,1453341,"Untitled-1",45,0,"",plaintext,selection_keyboard
462
+ 461,1453573,"Untitled-1",45,0,"\n",plaintext,content
463
+ 462,1457675,"Untitled-1",46,0," print(""hello world"")",plaintext,content
464
+ 463,1459925,"Untitled-1",69,0,"",plaintext,selection_command
465
+ 464,1460463,"Untitled-1",44,0,"",plaintext,selection_command
466
+ 465,1460533,"Untitled-1",23,0,"",plaintext,selection_command
467
+ 466,1460882,"Untitled-1",44,0,"",plaintext,selection_command
468
+ 467,1461018,"Untitled-1",69,0,"",plaintext,selection_command
469
+ 468,1461681,"Untitled-1",44,0,"",plaintext,selection_command
470
+ 469,1461806,"Untitled-1",23,0,"",plaintext,selection_command
471
+ 470,1462027,"Untitled-1",44,0,"",plaintext,selection_command
472
+ 471,1462186,"Untitled-1",69,0,"",plaintext,selection_command
473
+ 472,1462420,"Untitled-1",44,0,"",plaintext,selection_command
474
+ 473,1462565,"Untitled-1",23,0,"",plaintext,selection_command
475
+ 474,1462969,"Untitled-1",44,0,"",plaintext,selection_command
476
+ 475,1463125,"Untitled-1",69,0,"",plaintext,selection_command
477
+ 476,1463331,"Untitled-1",44,0,"",plaintext,selection_command
478
+ 477,1464225,"Untitled-1",23,0,"",plaintext,selection_command
479
+ 478,1465068,"Untitled-1",0,26,"""""""hello world function""""""",plaintext,selection_command
480
+ 479,1465401,"Untitled-1",0,45,"""""""hello world function""""""\ndef hello_world():",plaintext,selection_command
481
+ 480,1465550,"Untitled-1",0,70,"""""""hello world function""""""\ndef hello_world():\n print(""hello world"")",plaintext,selection_command
482
+ 481,1465849,"Untitled-1",0,70,"",plaintext,content
483
+ 482,1466288,"Untitled-1",0,0,"""",plaintext,content
484
+ 483,1466290,"Untitled-1",1,0,"",plaintext,selection_keyboard
485
+ 484,1466443,"Untitled-1",1,0,"""",plaintext,content
486
+ 485,1466445,"Untitled-1",2,0,"",plaintext,selection_keyboard
487
+ 486,1466960,"Untitled-1",2,0,"""",plaintext,content
488
+ 487,1466961,"Untitled-1",3,0,"",plaintext,selection_keyboard
489
+ 488,1468031,"Untitled-1",3,0,"f",plaintext,content
490
+ 489,1468032,"Untitled-1",4,0,"",plaintext,selection_keyboard
491
+ 490,1468051,"Untitled-1",4,0,"i",plaintext,content
492
+ 491,1468052,"Untitled-1",5,0,"",plaintext,selection_keyboard
493
+ 492,1468109,"Untitled-1",5,0,"n",plaintext,content
494
+ 493,1468110,"Untitled-1",6,0,"",plaintext,selection_keyboard
495
+ 494,1468218,"Untitled-1",6,0,"b",plaintext,content
496
+ 495,1468220,"Untitled-1",7,0,"",plaintext,selection_keyboard
497
+ 496,1468805,"Untitled-1",6,1,"",plaintext,content
498
+ 497,1469012,"Untitled-1",5,1,"",plaintext,content
499
+ 498,1469016,"Untitled-1",5,0,"b",plaintext,content
500
+ 499,1469017,"Untitled-1",6,0,"",plaintext,selection_keyboard
501
+ 500,1469468,"Untitled-1",6,0,"o",plaintext,content
502
+ 501,1469469,"Untitled-1",7,0,"",plaintext,selection_keyboard
503
+ 502,1469528,"Untitled-1",7,0,"n",plaintext,content
504
+ 503,1469530,"Untitled-1",8,0,"",plaintext,selection_keyboard
505
+ 504,1469735,"Untitled-1",8,0,"a",plaintext,content
506
+ 505,1469736,"Untitled-1",9,0,"",plaintext,selection_keyboard
507
+ 506,1469816,"Untitled-1",9,0,"c",plaintext,content
508
+ 507,1469818,"Untitled-1",10,0,"",plaintext,selection_keyboard
509
+ 508,1469969,"Untitled-1",10,0,"c",plaintext,content
510
+ 509,1469971,"Untitled-1",11,0,"",plaintext,selection_keyboard
511
+ 510,1470055,"Untitled-1",11,0,"i",plaintext,content
512
+ 511,1470057,"Untitled-1",12,0,"",plaintext,selection_keyboard
513
+ 512,1470330,"Untitled-1",12,0," ",plaintext,content
514
+ 513,1470332,"Untitled-1",13,0,"",plaintext,selection_keyboard
515
+ 514,1471700,"Untitled-1",13,0,"f",plaintext,content
516
+ 515,1471701,"Untitled-1",14,0,"",plaintext,selection_keyboard
517
+ 516,1471704,"Untitled-1",14,0,"u",plaintext,content
518
+ 517,1471706,"Untitled-1",15,0,"",plaintext,selection_keyboard
519
+ 518,1471835,"Untitled-1",15,0,"n",plaintext,content
520
+ 519,1471836,"Untitled-1",16,0,"",plaintext,selection_keyboard
521
+ 520,1471874,"Untitled-1",16,0,"c",plaintext,content
522
+ 521,1471876,"Untitled-1",17,0,"",plaintext,selection_keyboard
523
+ 522,1472097,"Untitled-1",17,0,"t",plaintext,content
524
+ 523,1472099,"Untitled-1",18,0,"",plaintext,selection_keyboard
525
+ 524,1472177,"Untitled-1",18,0,"i",plaintext,content
526
+ 525,1472179,"Untitled-1",19,0,"",plaintext,selection_keyboard
527
+ 526,1472217,"Untitled-1",19,0,"o",plaintext,content
528
+ 527,1472218,"Untitled-1",20,0,"",plaintext,selection_keyboard
529
+ 528,1472288,"Untitled-1",20,0,"n",plaintext,content
530
+ 529,1472289,"Untitled-1",21,0,"",plaintext,selection_keyboard
531
+ 530,1472599,"Untitled-1",21,0,"""",plaintext,content
532
+ 531,1472601,"Untitled-1",22,0,"",plaintext,selection_keyboard
533
+ 532,1472736,"Untitled-1",22,0,"""",plaintext,content
534
+ 533,1472738,"Untitled-1",23,0,"",plaintext,selection_keyboard
535
+ 534,1472896,"Untitled-1",23,0,"""",plaintext,content
536
+ 535,1472897,"Untitled-1",24,0,"",plaintext,selection_keyboard
537
+ 536,1473164,"Untitled-1",24,0,"\n",plaintext,content
538
+ 537,1475103,"Untitled-1",25,0,"d",plaintext,content
539
+ 538,1475105,"Untitled-1",26,0,"",plaintext,selection_keyboard
540
+ 539,1475194,"Untitled-1",26,0,"e",plaintext,content
541
+ 540,1475196,"Untitled-1",27,0,"",plaintext,selection_keyboard
542
+ 541,1475401,"Untitled-1",27,0,"f",plaintext,content
543
+ 542,1475403,"Untitled-1",28,0,"",plaintext,selection_keyboard
544
+ 543,1475439,"Untitled-1",28,0," ",plaintext,content
545
+ 544,1475441,"Untitled-1",29,0,"",plaintext,selection_keyboard
546
+ 545,1476573,"Untitled-1",25,0,"def fibonacci(n):",plaintext,content
547
+ 546,1479750,"Untitled-1",45,0,"",plaintext,selection_command
548
+ 547,1480223,"Untitled-1",25,21,"",plaintext,content
549
+ 548,1480501,"Untitled-1",25,0,"d",plaintext,content
550
+ 549,1480503,"Untitled-1",26,0,"",plaintext,selection_keyboard
551
+ 550,1480580,"Untitled-1",26,0,"e",plaintext,content
552
+ 551,1480582,"Untitled-1",27,0,"",plaintext,selection_keyboard
553
+ 552,1480773,"Untitled-1",27,0,"f",plaintext,content
554
+ 553,1480775,"Untitled-1",28,0,"",plaintext,selection_keyboard
555
+ 554,1480828,"Untitled-1",28,0," ",plaintext,content
556
+ 555,1480829,"Untitled-1",29,0,"",plaintext,selection_keyboard
557
+ 556,1483899,"Untitled-1",29,0,"fibonacci",plaintext,content
558
+ 557,1485540,"Untitled-1",38,0,"()",plaintext,content
559
+ 558,1485542,"Untitled-1",39,0,"",plaintext,selection_keyboard
560
+ 559,1488168,"Untitled-1",40,0,"",plaintext,selection_command
561
+ 560,1488618,"Untitled-1",40,0,":",plaintext,content
562
+ 561,1488621,"Untitled-1",41,0,"",plaintext,selection_keyboard
563
+ 562,1491203,"Untitled-1",41,0,"\n",plaintext,content
564
+ 563,1492930,"Untitled-1",41,1,"",plaintext,content
565
+ 564,1493093,"Untitled-1",40,1,"",plaintext,content
566
+ 565,1493602,"Untitled-1",39,1,"",plaintext,content
567
+ 566,1493754,"Untitled-1",39,0,"n",plaintext,content
568
+ 567,1493756,"Untitled-1",40,0,"",plaintext,selection_keyboard
569
+ 568,1494661,"Untitled-1",40,0,")",plaintext,content
570
+ 569,1494662,"Untitled-1",41,0,"",plaintext,selection_keyboard
571
+ 570,1495551,"Untitled-1",41,0,":",plaintext,content
572
+ 571,1495553,"Untitled-1",42,0,"",plaintext,selection_keyboard
573
+ 572,1495762,"Untitled-1",42,0,"\n",plaintext,content
574
+ 573,1503506,"Untitled-1",43,0," ",plaintext,content
575
+ 574,1504051,"Untitled-1",43,4,"",plaintext,content
576
+ 575,1511620,"Untitled-1",43,0," if n <= 0:\n return 0\n elif n == 1:\n return 1\n else:\n return fibonacci(n-1) + fibonacci(n-2)",plaintext,content
577
+ 576,1513080,"Untitled-1",164,0,"",plaintext,selection_command
578
+ 577,1513679,"Untitled-1",117,0,"",plaintext,selection_command
579
+ 578,1513793,"Untitled-1",107,0,"",plaintext,selection_command
580
+ 579,1514041,"Untitled-1",90,0,"",plaintext,selection_command
581
+ 580,1514074,"Untitled-1",73,0,"",plaintext,selection_command
582
+ 581,1514110,"Untitled-1",56,0,"",plaintext,selection_command
583
+ 582,1514138,"Untitled-1",41,0,"",plaintext,selection_command
584
+ 583,1515879,"Untitled-1",56,0,"",plaintext,selection_command
585
+ 584,1516329,"Untitled-1",43,14," if n <= 0:",plaintext,selection_command
586
+ 585,1516844,"Untitled-1",43,31," if n <= 0:\n return 0",plaintext,selection_command
587
+ 586,1517009,"Untitled-1",43,48," if n <= 0:\n return 0\n elif n == 1:",plaintext,selection_command
588
+ 587,1517163,"Untitled-1",43,65," if n <= 0:\n return 0\n elif n == 1:\n return 1",plaintext,selection_command
589
+ 588,1517312,"Untitled-1",43,75," if n <= 0:\n return 0\n elif n == 1:\n return 1\n else:",plaintext,selection_command
590
+ 589,1517469,"Untitled-1",43,122," if n <= 0:\n return 0\n elif n == 1:\n return 1\n else:\n return fibonacci(n-1) + fibonacci(n-2)",plaintext,selection_command
591
+ 590,1517924,"Untitled-1",132,0,"",plaintext,selection_command
592
+ 591,1518862,"Untitled-1",117,0,"",plaintext,selection_command
593
+ 592,1519026,"Untitled-1",105,0,"",plaintext,selection_command
594
+ 593,1519193,"Untitled-1",88,0,"",plaintext,selection_command
595
+ 594,1519574,"Untitled-1",105,0,"",plaintext,selection_command
596
+ 595,1519818,"Untitled-1",117,0,"",plaintext,selection_command
597
+ 596,1519849,"Untitled-1",132,0,"",plaintext,selection_command
598
+ 597,1521720,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
599
+ 598,1522498,"Untitled-1",0,0,"",plaintext,tab
600
+ 599,1525621,"Untitled-1",117,0,"",plaintext,selection_command
601
+ 600,1525757,"Untitled-1",105,0,"",plaintext,selection_command
602
+ 601,1525891,"Untitled-1",88,0,"",plaintext,selection_command
603
+ 602,1526000,"Untitled-1",71,0,"",plaintext,selection_command
604
+ 603,1526183,"Untitled-1",56,0,"",plaintext,selection_command
605
+ 604,1527178,"Untitled-1",71,0,"",plaintext,selection_command
606
+ 605,1527328,"Untitled-1",88,0,"",plaintext,selection_command
607
+ 606,1527587,"Untitled-1",71,0,"",plaintext,selection_command
608
+ 607,1533206,"Untitled-1",57,0,"\n ",plaintext,content
609
+ 608,1533212,"Untitled-1",62,0," ",plaintext,content
610
+ 609,1534400,"Untitled-1",66,0,"r",plaintext,content
611
+ 610,1534402,"Untitled-1",67,0,"",plaintext,selection_keyboard
612
+ 611,1534570,"Untitled-1",67,0,"a",plaintext,content
613
+ 612,1534571,"Untitled-1",68,0,"",plaintext,selection_keyboard
614
+ 613,1534609,"Untitled-1",68,0,"i",plaintext,content
615
+ 614,1534611,"Untitled-1",69,0,"",plaintext,selection_keyboard
616
+ 615,1534824,"Untitled-1",69,0,"s",plaintext,content
617
+ 616,1534826,"Untitled-1",70,0,"",plaintext,selection_keyboard
618
+ 617,1534828,"Untitled-1",70,0,"e",plaintext,content
619
+ 618,1534829,"Untitled-1",71,0,"",plaintext,selection_keyboard
620
+ 619,1534901,"Untitled-1",71,0," ",plaintext,content
621
+ 620,1534902,"Untitled-1",72,0,"",plaintext,selection_keyboard
622
+ 621,1537286,"Untitled-1",72,0,"V",plaintext,content
623
+ 622,1537288,"Untitled-1",73,0,"",plaintext,selection_keyboard
624
+ 623,1537498,"Untitled-1",73,0,"a",plaintext,content
625
+ 624,1537500,"Untitled-1",74,0,"",plaintext,selection_keyboard
626
+ 625,1537615,"Untitled-1",74,0,"l",plaintext,content
627
+ 626,1537617,"Untitled-1",75,0,"",plaintext,selection_keyboard
628
+ 627,1537619,"Untitled-1",75,0,"u",plaintext,content
629
+ 628,1537621,"Untitled-1",76,0,"",plaintext,selection_keyboard
630
+ 629,1537682,"Untitled-1",76,0,"e",plaintext,content
631
+ 630,1537683,"Untitled-1",77,0,"",plaintext,selection_keyboard
632
+ 631,1538059,"Untitled-1",77,0,"E",plaintext,content
633
+ 632,1538061,"Untitled-1",78,0,"",plaintext,selection_keyboard
634
+ 633,1538273,"Untitled-1",78,0,"r",plaintext,content
635
+ 634,1538275,"Untitled-1",79,0,"",plaintext,selection_keyboard
636
+ 635,1538435,"Untitled-1",79,0,"r",plaintext,content
637
+ 636,1538436,"Untitled-1",80,0,"",plaintext,selection_keyboard
638
+ 637,1538512,"Untitled-1",80,0,"o",plaintext,content
639
+ 638,1538514,"Untitled-1",81,0,"",plaintext,selection_keyboard
640
+ 639,1538612,"Untitled-1",81,0,"r",plaintext,content
641
+ 640,1538614,"Untitled-1",82,0,"",plaintext,selection_keyboard
642
+ 641,1539976,"Untitled-1",82,0,"()",plaintext,content
643
+ 642,1539978,"Untitled-1",83,0,"",plaintext,selection_keyboard
644
+ 643,1540074,"Untitled-1",83,1,")",plaintext,content
645
+ 644,1540076,"Untitled-1",84,0,"",plaintext,selection_keyboard
646
+ 645,1540506,"Untitled-1",83,0,"",plaintext,selection_command
647
+ 646,1540861,"Untitled-1",83,0,"""",plaintext,content
648
+ 647,1540862,"Untitled-1",84,0,"",plaintext,selection_keyboard
649
+ 648,1541274,"Untitled-1",84,0,"T",plaintext,content
650
+ 649,1541276,"Untitled-1",85,0,"",plaintext,selection_keyboard
651
+ 650,1541771,"Untitled-1",85,0,"h",plaintext,content
652
+ 651,1541773,"Untitled-1",86,0,"",plaintext,selection_keyboard
653
+ 652,1541810,"Untitled-1",86,0,"i",plaintext,content
654
+ 653,1541812,"Untitled-1",87,0,"",plaintext,selection_keyboard
655
+ 654,1541949,"Untitled-1",87,0,"s",plaintext,content
656
+ 655,1541952,"Untitled-1",88,0,"",plaintext,selection_keyboard
657
+ 656,1542029,"Untitled-1",88,0," ",plaintext,content
658
+ 657,1542031,"Untitled-1",89,0,"",plaintext,selection_keyboard
659
+ 658,1542165,"Untitled-1",89,0,"s",plaintext,content
660
+ 659,1542168,"Untitled-1",90,0,"",plaintext,selection_keyboard
661
+ 660,1542172,"Untitled-1",90,0,"h",plaintext,content
662
+ 661,1542173,"Untitled-1",91,0,"",plaintext,selection_keyboard
663
+ 662,1542207,"Untitled-1",91,0,"o",plaintext,content
664
+ 663,1542210,"Untitled-1",92,0,"",plaintext,selection_keyboard
665
+ 664,1542298,"Untitled-1",92,0,"u",plaintext,content
666
+ 665,1542301,"Untitled-1",93,0,"",plaintext,selection_keyboard
667
+ 666,1542614,"Untitled-1",93,0,"l",plaintext,content
668
+ 667,1542616,"Untitled-1",94,0,"",plaintext,selection_keyboard
669
+ 668,1542649,"Untitled-1",94,0,"d",plaintext,content
670
+ 669,1542651,"Untitled-1",95,0,"",plaintext,selection_keyboard
671
+ 670,1542708,"Untitled-1",95,0," ",plaintext,content
672
+ 671,1542711,"Untitled-1",96,0,"",plaintext,selection_keyboard
673
+ 672,1543089,"Untitled-1",89,7,"",plaintext,content
674
+ 673,1543250,"Untitled-1",84,5,"",plaintext,content
675
+ 674,1543861,"Untitled-1",84,0,"T",plaintext,content
676
+ 675,1543863,"Untitled-1",85,0,"",plaintext,selection_keyboard
677
+ 676,1543969,"Untitled-1",85,0,"h",plaintext,content
678
+ 677,1543971,"Untitled-1",86,0,"",plaintext,selection_keyboard
679
+ 678,1544025,"Untitled-1",86,0,"i",plaintext,content
680
+ 679,1544026,"Untitled-1",87,0,"",plaintext,selection_keyboard
681
+ 680,1544163,"Untitled-1",87,0,"s",plaintext,content
682
+ 681,1544165,"Untitled-1",88,0,"",plaintext,selection_keyboard
683
+ 682,1544243,"Untitled-1",88,0," ",plaintext,content
684
+ 683,1544244,"Untitled-1",89,0,"",plaintext,selection_keyboard
685
+ 684,1544366,"Untitled-1",89,0,"l",plaintext,content
686
+ 685,1544369,"Untitled-1",90,0,"",plaintext,selection_keyboard
687
+ 686,1544371,"Untitled-1",90,0,"i",plaintext,content
688
+ 687,1544373,"Untitled-1",91,0,"",plaintext,selection_keyboard
689
+ 688,1544398,"Untitled-1",91,0,"n",plaintext,content
690
+ 689,1544400,"Untitled-1",92,0,"",plaintext,selection_keyboard
691
+ 690,1544456,"Untitled-1",92,0,"e",plaintext,content
692
+ 691,1544458,"Untitled-1",93,0,"",plaintext,selection_keyboard
693
+ 692,1544630,"Untitled-1",93,0," ",plaintext,content
694
+ 693,1544632,"Untitled-1",94,0,"",plaintext,selection_keyboard
695
+ 694,1544740,"Untitled-1",94,0,"s",plaintext,content
696
+ 695,1544742,"Untitled-1",95,0,"",plaintext,selection_keyboard
697
+ 696,1544744,"Untitled-1",95,0,"h",plaintext,content
698
+ 697,1544745,"Untitled-1",96,0,"",plaintext,selection_keyboard
699
+ 698,1544774,"Untitled-1",96,0,"o",plaintext,content
700
+ 699,1544775,"Untitled-1",97,0,"",plaintext,selection_keyboard
701
+ 700,1544848,"Untitled-1",97,0,"u",plaintext,content
702
+ 701,1544849,"Untitled-1",98,0,"",plaintext,selection_keyboard
703
+ 702,1545117,"Untitled-1",98,0,"l",plaintext,content
704
+ 703,1545119,"Untitled-1",99,0,"",plaintext,selection_keyboard
705
+ 704,1545135,"Untitled-1",99,0,"d",plaintext,content
706
+ 705,1545137,"Untitled-1",100,0,"",plaintext,selection_keyboard
707
+ 706,1545176,"Untitled-1",100,0," ",plaintext,content
708
+ 707,1545178,"Untitled-1",101,0,"",plaintext,selection_keyboard
709
+ 708,1545221,"Untitled-1",101,0,"b",plaintext,content
710
+ 709,1545222,"Untitled-1",102,0,"",plaintext,selection_keyboard
711
+ 710,1545308,"Untitled-1",102,0,"e",plaintext,content
712
+ 711,1545312,"Untitled-1",103,0,"",plaintext,selection_keyboard
713
+ 712,1545477,"Untitled-1",103,0," ",plaintext,content
714
+ 713,1545480,"Untitled-1",104,0,"",plaintext,selection_keyboard
715
+ 714,1545585,"Untitled-1",104,0,"d",plaintext,content
716
+ 715,1545587,"Untitled-1",105,0,"",plaintext,selection_keyboard
717
+ 716,1545648,"Untitled-1",105,0,"e",plaintext,content
718
+ 717,1545650,"Untitled-1",106,0,"",plaintext,selection_keyboard
719
+ 718,1545837,"Untitled-1",106,0,"l",plaintext,content
720
+ 719,1545839,"Untitled-1",107,0,"",plaintext,selection_keyboard
721
+ 720,1545853,"Untitled-1",107,0,"e",plaintext,content
722
+ 721,1545854,"Untitled-1",108,0,"",plaintext,selection_keyboard
723
+ 722,1545898,"Untitled-1",108,0,"t",plaintext,content
724
+ 723,1545899,"Untitled-1",109,0,"",plaintext,selection_keyboard
725
+ 724,1546008,"Untitled-1",109,0,"e",plaintext,content
726
+ 725,1546010,"Untitled-1",110,0,"",plaintext,selection_keyboard
727
+ 726,1546217,"Untitled-1",110,0,"d",plaintext,content
728
+ 727,1546219,"Untitled-1",111,0,"",plaintext,selection_keyboard
729
+ 728,1546642,"Untitled-1",111,0,"""",plaintext,content
730
+ 729,1546644,"Untitled-1",112,0,"",plaintext,selection_keyboard
731
+ 730,1547355,"Untitled-1",111,0,"",plaintext,selection_command
732
+ 731,1549302,"Untitled-1",129,0,"",plaintext,selection_command
733
+ 732,1551001,"Untitled-1",130,0,"",plaintext,selection_command
734
+ 733,1562647,"Untitled-1",74,0,"",plaintext,selection_command
735
+ 734,1571659,"Untitled-1",58,40,"",plaintext,content
736
+ 735,1574323,"Untitled-1",73,0,"",plaintext,selection_command
737
+ 736,1590754,"Untitled-1",58,15,"if n <= 0: # base case",plaintext,content
738
+ 737,1592217,"Untitled-1",79,0,"",plaintext,selection_command
739
+ 738,1592738,"Untitled-1",58,23,"",plaintext,content
740
+ 739,1592743,"Untitled-1",66,0,"",plaintext,selection_command
741
+ 740,1593075,"Untitled-1",51,0,"",plaintext,selection_command
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-496e7336-e907-40cd-b40d-8cabdd82c9b21758267888193-2025_09_19-09.44.55.786/source.csv ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,3,"train_dynamics.py",0,0,"import os\n\n\nos.environ.setdefault(""XLA_PYTHON_CLIENT_MEM_FRACTION"", ""0.98"")\n\nfrom dataclasses import dataclass, field\nimport itertools\nfrom typing import cast, Optional\n\nimport einops\nfrom jax.sharding import Mesh, PartitionSpec, NamedSharding\nfrom jax.experimental.mesh_utils import create_device_mesh\nimport optax\nimport orbax.checkpoint as ocp\nimport numpy as np\nimport dm_pix as pix\nimport jax\nimport jax.numpy as jnp\nimport tyro\nimport wandb\nimport grain\nimport flax.nnx as nnx\n\nfrom genie import Genie, restore_genie_components\nfrom utils.dataloader import get_dataloader\nfrom utils.train_utils import (\n get_lr_schedule,\n count_parameters_by_component,\n print_mem_stats,\n print_compiled_memory_stats,\n print_compiled_cost_analysis,\n)\n\n\n@dataclass\nclass Args:\n # Experiment\n num_steps: int = 200_000\n seed: int = 0\n seq_len: int = 16\n image_channels: int = 3\n image_height: int = 90\n image_width: int = 160\n data_dir: str = """"\n save_ckpt: bool = False\n restore_ckpt: bool = False\n # Optimization\n batch_size: int = 36\n init_lr: float = 0.0\n max_lr: float = 3e-5\n decay_end: float = 0.0\n wsd_decay_steps: int = (\n 10000 # NOTE: wsd_decay_steps will only be used when using a wsd-schedule\n )\n warmup_steps: int = 5000\n lr_schedule: str = ""wsd"" # supported options: wsd, cos\n # Tokenizer\n tokenizer_dim: int = 512\n tokenizer_ffn_dim: int = 2048\n latent_patch_dim: int = 32\n num_patch_latents: int = 1024\n patch_size: int = 4\n tokenizer_num_blocks: int = 4\n tokenizer_num_heads: int = 8\n tokenizer_checkpoint: str = """"\n # LAM\n lam_dim: int = 512\n lam_ffn_dim: int = 2048\n latent_action_dim: int = 32\n num_latent_actions: int = 6\n lam_patch_size: int = 16\n lam_num_blocks: int = 4\n lam_num_heads: int = 8\n lam_checkpoint: str = """"\n # Dynamics\n dyna_type: str = ""maskgit"" # supported options: maskgit, causal\n dyna_dim: int = 512\n dyna_ffn_dim: int = 2048\n dyna_num_blocks: int = 6\n dyna_num_heads: int = 8\n dropout: float = 0.0\n mask_limit: float = 0.5\n param_dtype = jnp.float32\n dtype = jnp.bfloat16\n use_flash_attention: bool = True\n use_gt_actions: bool = False\n # Logging\n log: bool = False\n entity: str = """"\n project: str = """"\n name: str = ""train_dynamics""\n tags: list[str] = field(default_factory=lambda: [""dynamics""])\n log_interval: int = 5\n log_image_interval: int = 250\n ckpt_dir: str = """"\n log_checkpoint_interval: int = 25000\n log_checkpoint_keep_period: int = 20000\n log_gradients: bool = False\n val_data_dir: str = """"\n val_interval: int = 20_000\n val_steps: int = 50\n eval_full_frame: bool = False\n val_maskgit_steps: int = 25\n val_temperature: float = 1\n val_sample_argmax: bool = False\n wandb_id: str = """"\n\n\ndef build_model(args: Args, rng: jax.Array) -> tuple[Genie, jax.Array]:\n rng, _rng = jax.random.split(rng)\n rngs = nnx.Rngs(_rng)\n genie = Genie(\n # Tokenizer\n in_dim=args.image_channels,\n tokenizer_dim=args.tokenizer_dim,\n tokenizer_ffn_dim=args.tokenizer_ffn_dim,\n latent_patch_dim=args.latent_patch_dim,\n num_patch_latents=args.num_patch_latents,\n patch_size=args.patch_size,\n tokenizer_num_blocks=args.tokenizer_num_blocks,\n tokenizer_num_heads=args.tokenizer_num_heads,\n # LAM\n lam_dim=args.lam_dim,\n lam_ffn_dim=args.lam_ffn_dim,\n latent_action_dim=args.latent_action_dim,\n num_latent_actions=args.num_latent_actions,\n lam_patch_size=args.lam_patch_size,\n lam_num_blocks=args.lam_num_blocks,\n lam_num_heads=args.lam_num_heads,\n lam_co_train=not args.lam_checkpoint,\n use_gt_actions=args.use_gt_actions,\n # Dynamics\n dyna_type=args.dyna_type,\n dyna_dim=args.dyna_dim,\n dyna_ffn_dim=args.dyna_ffn_dim,\n dyna_num_blocks=args.dyna_num_blocks,\n dyna_num_heads=args.dyna_num_heads,\n dropout=args.dropout,\n mask_limit=args.mask_limit,\n param_dtype=args.param_dtype,\n dtype=args.dtype,\n use_flash_attention=args.use_flash_attention,\n decode=False,\n rngs=rngs,\n )\n assert not (\n args.lam_checkpoint and args.use_gt_actions\n ), ""Can not use LAM when using GT actions. Please choose either.""\n if not args.use_gt_actions:\n del genie.lam.decoder\n return genie, rng\n\n\ndef build_optimizer(genie: Genie, args: Args) -> tuple[nnx.Optimizer, optax.Schedule]:\n lr_schedule = get_lr_schedule(\n args.lr_schedule,\n args.init_lr,\n args.max_lr,\n args.decay_end,\n args.num_steps,\n args.warmup_steps,\n args.wsd_decay_steps,\n )\n tx = optax.adamw(\n learning_rate=lr_schedule,\n b1=0.9,\n b2=0.9,\n weight_decay=1e-4,\n mu_dtype=args.param_dtype, # moments in full precision\n )\n optimizer = nnx.Optimizer(genie, tx)\n return optimizer, lr_schedule\n\n\ndef build_mesh_and_sharding(\n num_devices: int,\n) -> tuple[Mesh, NamedSharding, NamedSharding, NamedSharding]:\n device_mesh_arr = create_device_mesh((num_devices,))\n mesh = Mesh(devices=device_mesh_arr, axis_names=(""data"",))\n replicated_sharding = NamedSharding(mesh, PartitionSpec())\n videos_sharding = NamedSharding(mesh, PartitionSpec(""data"", None, None, None, None))\n actions_sharding = NamedSharding(mesh, PartitionSpec(""data"", None))\n return mesh, replicated_sharding, videos_sharding, actions_sharding\n\n\ndef shard_optimizer_states(\n optimizer: nnx.Optimizer, replicated_sharding: NamedSharding\n) -> None:\n model_state = nnx.state(optimizer.model)\n model_sharded_state = jax.lax.with_sharding_constraint(\n model_state, replicated_sharding\n )\n nnx.update(optimizer.model, model_sharded_state)\n optimizer_state = nnx.state(optimizer, nnx.optimizer.OptState)\n optimizer_sharded_state = jax.lax.with_sharding_constraint(\n optimizer_state, replicated_sharding\n )\n nnx.update(optimizer, optimizer_sharded_state)\n\n\ndef build_dataloader(args: Args, data_dir: str) -> grain.DataLoaderIterator:\n image_shape = (args.image_height, args.image_width, args.image_channels)\n array_record_files = [\n os.path.join(data_dir, x)\n for x in os.listdir(data_dir)\n if x.endswith("".array_record"")\n ]\n grain_dataloader = get_dataloader(\n array_record_files,\n args.seq_len,\n # NOTE: We deliberately pass the global batch size\n # The dataloader shards the dataset across all processes\n args.batch_size,\n *image_shape,\n num_workers=8,\n prefetch_buffer_size=1,\n seed=args.seed,\n )\n initial_state = grain_dataloader._create_initial_state()\n grain_iterator = grain.DataLoaderIterator(grain_dataloader, initial_state)\n return grain_iterator\n\n\ndef build_checkpoint_manager(args: Args) -> ocp.CheckpointManager:\n handler_registry = ocp.handlers.DefaultCheckpointHandlerRegistry()\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeSave, ocp.handlers.PyTreeCheckpointHandler\n )\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeRestore, ocp.handlers.PyTreeCheckpointHandler\n )\n handler_registry.add(\n ""train_dataloader_state"",\n grain.checkpoint.CheckpointSave,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n handler_registry.add(\n ""train_dataloader_state"",\n grain.checkpoint.CheckpointRestore,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n if args.val_data_dir:\n handler_registry.add(\n ""val_dataloader_state"",\n grain.checkpoint.CheckpointSave,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n handler_registry.add(\n ""val_dataloader_state"",\n grain.checkpoint.CheckpointRestore,\n cast(ocp.handlers.CheckpointHandler, grain.checkpoint.CheckpointHandler),\n )\n checkpoint_options = ocp.CheckpointManagerOptions(\n save_interval_steps=args.log_checkpoint_interval,\n max_to_keep=3,\n keep_period=args.log_checkpoint_keep_period,\n step_format_fixed_length=6,\n cleanup_tmp_directories=True,\n )\n checkpoint_manager = ocp.CheckpointManager(\n args.ckpt_dir,\n options=checkpoint_options,\n handler_registry=handler_registry,\n )\n return checkpoint_manager\n\n\ndef restore_or_initialize_components(\n args: Args,\n checkpoint_manager: ocp.CheckpointManager,\n optimizer: nnx.Optimizer,\n train_iterator: grain.DataLoaderIterator,\n rng: jax.Array,\n replicated_sharding: NamedSharding,\n val_iterator: Optional[grain.DataLoaderIterator],\n restore_step: Optional[int] = None,\n) -> tuple[\n int, nnx.Optimizer, grain.DataLoaderIterator, grain.DataLoaderIterator, jax.Array\n]:\n step = 0\n if restore_step is None:\n restore_step = checkpoint_manager.latest_step()\n if args.restore_ckpt:\n abstract_optimizer = nnx.eval_shape(lambda: optimizer)\n abstract_optimizer_state = nnx.state(abstract_optimizer)\n if val_iterator:\n restore_args = ocp.args.Composite(\n model_state=ocp.args.PyTreeRestore(abstract_optimizer_state), # type: ignore\n train_dataloader_state=grain.checkpoint.CheckpointRestore(train_iterator), # type: ignore\n val_dataloader_state=grain.checkpoint.CheckpointRestore(val_iterator), # type: ignore\n )\n else:\n restore_args = ocp.args.Composite(\n model_state=ocp.args.PyTreeRestore(abstract_optimizer_state), # type: ignore\n train_dataloader_state=grain.checkpoint.CheckpointRestore(train_iterator), # type: ignore\n )\n restored = checkpoint_manager.restore(\n checkpoint_manager.latest_step(), args=restore_args\n )\n restored_optimizer_state = restored[""model_state""]\n nnx.update(optimizer, restored_optimizer_state)\n train_iterator = restored[""train_dataloader_state""]\n if val_iterator:\n val_iterator = restored[""val_dataloader_state""]\n step = checkpoint_manager.latest_step() or 0\n print(f""Restored dataloader and model state from step {step}"")\n else:\n # Restore from pre-trained tokenizer (and LAM)\n rng, _rng = jax.random.split(rng)\n optimizer = restore_genie_components(optimizer, replicated_sharding, _rng, args)\n # NOTE: We have to remove the (unused) tokenizer vq dropout due flax.nnx lazily initializing modules.\n # Specifically, the first dynamics model checkpoint will contain the vq dropout module,\n # but the first full restore will fail due to nnx not initializing the module when\n # dropout is set to 0.0.\n del optimizer.model.tokenizer.vq.drop\n return step, optimizer, train_iterator, val_iterator, rng\n\n\ndef _calculate_step_metrics(\n outputs: dict[str, jax.Array],\n gt: jax.Array,\n num_latent_actions: int,\n num_patch_latents: int,\n) -> tuple[jax.Array, dict]:\n mask = outputs[""mask""]\n outputs[""token_logits""] = outputs[""token_logits""].astype(jnp.float32)\n ce_loss = optax.softmax_cross_entropy_with_integer_labels(\n outputs[""token_logits""], outputs[""video_tokens""]\n )\n ce_loss = (mask * ce_loss).sum() / mask.sum()\n acc = outputs[""token_logits""].argmax(-1) == outputs[""video_tokens""]\n acc = (mask * acc).sum() / mask.sum()\n select_probs = jax.nn.softmax(outputs[""token_logits""])\n gt_val = gt.clip(0, 1).reshape(-1, *gt.shape[2:])\n recon = outputs[""recon""].clip(0, 1).reshape(-1, *outputs[""recon""].shape[2:])\n psnr = jnp.asarray(pix.psnr(gt_val, recon)).mean()\n ssim = jnp.asarray(pix.ssim(gt_val, recon)).mean()\n _, index_counts_tokenizer = jnp.unique_counts(\n jnp.ravel(outputs[""video_tokens""]),\n size=num_patch_latents,\n fill_value=0,\n )\n codebook_usage_tokenizer = (index_counts_tokenizer != 0).mean()\n metrics = dict(\n cross_entropy_loss=ce_loss,\n masked_token_accuracy=acc,\n select_logit=outputs[""token_logits""].max(-1).mean(),\n select_p=select_probs.max(-1).mean(),\n entropy=jax.scipy.special.entr(select_probs).sum(-1).mean(),\n psnr=psnr,\n ssim=ssim,\n codebook_usage_tokenizer=codebook_usage_tokenizer,\n )\n if ""lam_indices"" in outputs.keys():\n _, index_counts_lam = jnp.unique_counts(\n jnp.ravel(outputs[""lam_indices""]),\n size=num_latent_actions,\n fill_value=0,\n )\n codebook_usage_lam = (index_counts_lam != 0).mean()\n metrics[""codebook_usage_lam""] = codebook_usage_lam\n return ce_loss, metrics\n\n\ndef main(args: Args) -> None:\n jax.distributed.initialize()\n num_devices = jax.device_count()\n if num_devices == 0:\n raise ValueError(""No JAX devices found."")\n print(f""Running on {num_devices} devices."")\n\n if args.batch_size % num_devices != 0:\n raise ValueError(\n f""Global batch size {args.batch_size} must be divisible by ""\n f""number of devices {num_devices}.""\n )\n\n rng = jax.random.key(args.seed)\n\n # --- Initialize model ---\n genie, rng = build_model(args, rng)\n _, params, _ = nnx.split(genie, nnx.Param, ...)\n param_counts = count_parameters_by_component(params)\n\n if args.log and jax.process_index() == 0:\n wandb_init_kwargs = {\n ""entity"": args.entity,\n ""project"": args.project,\n ""name"": args.name,\n ""tags"": args.tags,\n ""group"": ""debug"",\n ""config"": args,\n }\n\n if args.wandb_id:\n wandb_init_kwargs.update(\n {\n ""id"": args.wandb_id,\n ""resume"": ""allow"",\n }\n )\n wandb.init(**wandb_init_kwargs)\n\n wandb.config.update({""model_param_count"": param_counts})\n\n print(""Parameter counts:"")\n print(param_counts)\n\n # --- Initialize optimizer ---\n optimizer, lr_schedule = build_optimizer(genie, args)\n del genie\n\n # FIXME: switch to create_hybrid_device_mesh for runs spanning multiple nodes\n _, replicated_sharding, videos_sharding, actions_sharding = build_mesh_and_sharding(\n num_devices\n )\n\n shard_optimizer_states(optimizer, replicated_sharding)\n\n # --- Initialize checkpoint manager ---\n checkpoint_manager = build_checkpoint_manager(args)\n\n # --- Create DataLoaderIterator from dataloader ---\n train_iterator = build_dataloader(args, args.data_dir)\n val_iterator = None\n if args.val_data_dir:\n val_iterator = build_dataloader(args, args.val_data_dir)\n\n # --- Restore checkpoint ---\n step, optimizer, train_iterator, val_iterator, rng = (\n restore_or_initialize_components(\n args,\n checkpoint_manager,\n optimizer,\n train_iterator,\n rng,\n replicated_sharding,\n val_iterator,\n )\n )\n\n # --- Define loss and train step (close over args) ---\n def dynamics_loss_fn(\n model: Genie,\n inputs: dict,\n training: bool = False,\n ) -> tuple[jax.Array, tuple[jax.Array, dict]]:\n gt = jnp.asarray(inputs[""videos""], dtype=jnp.float32) / 255.0\n inputs[""videos""] = gt.astype(args.dtype)\n outputs = model(inputs, training=training)\n ce_loss, metrics = _calculate_step_metrics(\n outputs, gt, args.num_latent_actions, args.num_patch_latents\n )\n return ce_loss, (outputs[""recon""], metrics)\n\n @nnx.jit(donate_argnums=0)\n def train_step(\n optimizer: nnx.Optimizer, inputs: dict\n ) -> tuple[jax.Array, jax.Array, dict]:\n def loss_fn(model: Genie) -> tuple[jax.Array, tuple[jax.Array, dict]]:\n model.train()\n return dynamics_loss_fn(model, inputs, training=True)\n\n (loss, (recon, metrics)), grads = nnx.value_and_grad(loss_fn, has_aux=True)(\n optimizer.model\n )\n optimizer.update(grads)\n if args.log_gradients:\n metrics[""gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""dynamics""]\n )\n return loss, recon, metrics\n\n @nnx.jit\n def val_step(genie: Genie, inputs: dict) -> dict:\n """"""Evaluate model and compute metrics""""""\n genie.eval()\n (loss, (recon, metrics)) = dynamics_loss_fn(genie, inputs, training=False)\n val_output = {""loss"": loss, ""recon"": recon, ""metrics"": metrics}\n\n # --- Evaluate full frame prediction (sampling) ---\n if args.eval_full_frame:\n lam_indices = genie.vq_encode(inputs, training=False)\n tokenizer_outputs = genie.tokenizer.vq_encode(\n inputs[""videos""], training=False\n )\n tokens_full_frame = tokenizer_outputs[""indices""]\n inputs[""latent_actions""] = lam_indices\n gt = jnp.asarray(inputs[""videos""], dtype=jnp.float32) / 255.0\n inputs[""videos""] = gt[:, :-1].astype(\n args.dtype\n ) # remove last frame for generation\n recon_full_frame, logits_full_frame = genie.sample(\n inputs,\n args.seq_len,\n args.val_temperature,\n args.val_sample_argmax,\n args.val_maskgit_steps,\n )\n step_outputs = {\n ""recon"": recon_full_frame,\n ""token_logits"": logits_full_frame,\n ""video_tokens"": tokens_full_frame,\n ""mask"": jnp.zeros_like(tokens_full_frame).at[:, -1].set(True),\n ""lam_indices"": lam_indices,\n }\n loss_full_frame, metrics_full_frame = _calculate_step_metrics(\n step_outputs, gt, args.num_latent_actions, args.num_patch_latents\n )\n val_output.update(\n {\n ""loss_full_frame"": loss_full_frame,\n ""recon_full_frame"": recon_full_frame,\n ""metrics_full_frame"": metrics_full_frame,\n }\n )\n return val_output\n\n def calculate_validation_metrics(val_dataloader, genie, rng):\n step = 0\n loss_per_step = []\n metrics_per_step = []\n loss_full_frame_per_step = []\n metrics_full_frame_per_step = []\n batch = None\n recon = None\n recon_full_frame = None\n for batch in val_dataloader:\n rng, _rng_mask = jax.random.split(rng, 2)\n batch[""rng""] = _rng_mask\n val_outputs = val_step(genie, batch)\n loss_per_step.append(val_outputs[""loss""])\n metrics_per_step.append(val_outputs[""metrics""])\n if args.eval_full_frame:\n loss_full_frame_per_step.append(val_outputs[""loss_full_frame""])\n metrics_full_frame_per_step.append(val_outputs[""metrics_full_frame""])\n step += 1\n if step > args.val_steps:\n break\n\n if step < args.val_steps:\n print(\n f""Warning: Your validation dataset is too small to make val_steps many steps. Made {step} steps, expected {args.val_steps}""\n )\n\n val_metrics = {\n f""val_{key}"": np.mean([float(m[key]) for m in metrics_per_step])\n for key in metrics_per_step[0].keys()\n }\n val_metrics[""val_loss""] = np.mean(loss_per_step)\n if args.eval_full_frame:\n val_metrics_full_frame = {\n f""val_full_frame_{key}"": np.mean(\n [float(m[key]) for m in metrics_full_frame_per_step]\n )\n for key in metrics_full_frame_per_step[0].keys()\n }\n val_metrics.update(val_metrics_full_frame)\n val_metrics[""val_loss_full_frame""] = np.mean(loss_full_frame_per_step)\n return val_metrics, batch, recon, recon_full_frame\n\n # --- TRAIN LOOP ---\n dataloader_train = (\n {\n ""videos"": jax.make_array_from_process_local_data(\n videos_sharding, local_data=elem[""videos""]\n ),\n ""actions"": (\n jax.make_array_from_process_local_data(\n actions_sharding, elem[""actions""]\n )\n if args.use_gt_actions\n else None\n ),\n }\n for elem in train_iterator\n )\n dataloader_val = None\n if val_iterator:\n dataloader_val = (\n {\n ""videos"": jax.make_array_from_process_local_data(\n videos_sharding, elem[""videos""]\n ),\n ""actions"": (\n jax.make_array_from_process_local_data(\n actions_sharding, elem[""actions""]\n )\n if args.use_gt_actions\n else None\n ),\n }\n for elem in val_iterator\n )\n if jax.process_index() == 0:\n first_batch = next(dataloader_train)\n first_batch[""rng""] = rng # type: ignore\n compiled = train_step.lower(optimizer, first_batch).compile()\n print_compiled_memory_stats(compiled.memory_analysis())\n print_compiled_cost_analysis(compiled.cost_analysis())\n # Do not skip the first batch during training\n dataloader_train = itertools.chain([first_batch], dataloader_train)\n print(f""Starting training from step {step}..."")\n first_step = step\n while step < args.num_steps:\n for batch in dataloader_train:\n # --- Train step ---\n rng, _rng_mask = jax.random.split(rng, 2)\n batch[""rng""] = _rng_mask\n loss, recon, metrics = train_step(optimizer, batch)\n if step == first_step:\n print_mem_stats(""After params initialized"")\n metrics[""lr""] = lr_schedule(step)\n print(f""Step {step}, loss: {loss}"")\n step += 1\n\n # --- Validation loss ---\n val_results = {}\n if dataloader_val and step % args.val_interval == 0:\n rng, _rng_mask_val = jax.random.split(rng, 2)\n print(""Calculating validation metrics..."")\n val_metrics, val_gt_batch, val_recon, val_recon_full_frame = (\n calculate_validation_metrics(\n dataloader_val, optimizer.model, _rng_mask_val\n )\n )\n print(f""Step {step}, validation loss: {val_metrics['val_loss']}"")\n val_results = {\n ""metrics"": val_metrics,\n ""gt_batch"": val_gt_batch,\n ""recon"": val_recon,\n ""full_frame"": val_recon_full_frame,\n }\n\n # --- Logging ---\n if args.log:\n if step % args.log_interval == 0 and jax.process_index() == 0:\n log_dict = {""loss"": loss, ""step"": step, **metrics}\n if val_results:\n log_dict.update(val_results[""metrics""])\n wandb.log(log_dict)\n if step % args.log_image_interval == 0:\n gt_seq = batch[""videos""][0].astype(jnp.float32) / 255.0\n recon_seq = recon[0].clip(0, 1)\n comparison_seq = jnp.concatenate((gt_seq, recon_seq), axis=1)\n comparison_seq = einops.rearrange(\n comparison_seq * 255, ""t h w c -> h (t w) c""\n )\n if val_results:\n val_results[""gt_seq_val""] = (\n val_results[""gt_batch""][""videos""][0].astype(jnp.float32)\n / 255.0\n )\n val_results[""recon_seq_val""] = val_results[""recon""].clip(0, 1)\n val_comparison_seq = jnp.concatenate(\n (val_results[""gt_seq_val""], val_results[""recon_seq_val""]),\n axis=1,\n )\n val_results[""val_comparison_seq""] = einops.rearrange(\n val_comparison_seq * 255, ""t h w c -> h (t w) c""\n )\n if args.eval_full_frame:\n val_results[""full_frame_seq_val""] = val_results[\n ""full_frame""\n ][0].clip(0, 1)\n val_results[""val_full_frame_comparison_seq""] = (\n jnp.concatenate(\n (\n val_results[""gt_seq_val""],\n val_results[""full_frame_seq_val""],\n ),\n axis=1,\n )\n )\n val_results[""val_full_frame_comparison_seq""] = (\n einops.rearrange(\n val_results[""val_full_frame_comparison_seq""] * 255,\n ""t h w c -> h (t w) c"",\n )\n )\n # NOTE: Process-dependent control flow deliberately happens\n # after indexing operation since it must not contain code\n # sections that lead to cross-accelerator communication.\n if jax.process_index() == 0:\n log_images = dict(\n image=wandb.Image(np.asarray(gt_seq[args.seq_len - 1])),\n recon=wandb.Image(np.asarray(recon_seq[args.seq_len - 1])),\n true_vs_recon=wandb.Image(\n np.asarray(comparison_seq.astype(np.uint8))\n ),\n )\n if val_results:\n log_images.update(\n dict(\n val_image=wandb.Image(\n np.asarray(\n val_results[""gt_seq_val""][args.seq_len - 1]\n )\n ),\n val_recon=wandb.Image(\n np.asarray(\n val_results[""recon_seq_val""][\n args.seq_len - 1\n ]\n )\n ),\n val_true_vs_recon=wandb.Image(\n np.asarray(\n val_results[""val_comparison_seq""].astype(\n np.uint8\n )\n )\n ),\n )\n )\n if args.eval_full_frame:\n log_images.update(\n dict(\n val_full_frame=wandb.Image(\n np.asarray(\n val_results[""full_frame_seq_val""][\n args.seq_len - 1\n ]\n )\n ),\n val_true_vs_full_frame=wandb.Image(\n np.asarray(\n val_results[\n ""val_full_frame_comparison_seq""\n ].astype(np.uint8)\n )\n ),\n )\n )\n wandb.log(log_images)\n # --- Checkpointing ---\n if args.save_ckpt and step % args.log_checkpoint_interval == 0:\n optimizer_state = nnx.state(optimizer)\n if args.val_data_dir:\n ckpt_manager_args = ocp.args.Composite(\n model_state=ocp.args.PyTreeSave(optimizer_state), # type: ignore\n train_dataloader_state=grain.checkpoint.CheckpointSave( # type: ignore\n train_iterator # type: ignore\n ),\n val_dataloader_state=grain.checkpoint.CheckpointSave( # type: ignore\n val_iterator # type: ignore\n ),\n )\n else:\n ckpt_manager_args = ocp.args.Composite(\n model_state=ocp.args.PyTreeSave(optimizer_state), # type: ignore\n train_dataloader_state=grain.checkpoint.CheckpointSave( # type: ignore\n train_iterator # type: ignore\n ),\n )\n checkpoint_manager.save(step, args=ckpt_manager_args)\n print(f""Saved checkpoint at step {step}"")\n if step >= args.num_steps:\n break\n\n checkpoint_manager.close()\n\n\nif __name__ == ""__main__"":\n args = tyro.cli(Args)\n main(args)\n",python,tab
3
+ 2,114,"anysphere.remote-ssh.Remote - SSH",0,0,"2025-09-18 21:42:34.258 [info] Resolving ssh remote authority 'login.haicore.berlin' (Unparsed 'ssh-remote+7b22686f73744e616d65223a226c6f67696e2e686169636f72652e6265726c696e227d') (attempt #1)\n2025-09-18 21:42:34.266 [info] SSH askpass server listening on /var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor-ssh-3VhYfQ/socket.sock\n2025-09-18 21:42:34.266 [info] Using configured platform linux for remote host login.haicore.berlin\n2025-09-18 21:42:34.266 [info] Using askpass script: /Users/franzsrambical/.cursor/extensions/anysphere.remote-ssh-1.0.30/dist/scripts/launchSSHAskpass.sh with javascript file /Users/franzsrambical/.cursor/extensions/anysphere.remote-ssh-1.0.30/dist/scripts/sshAskClient.js. Askpass handle: /var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor-ssh-3VhYfQ/socket.sock\n2025-09-18 21:42:34.268 [info] Launching SSH server via shell with command: cat ""/var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor_remote_install_7c696bbc-a7db-4d9d-8fb7-646a99575826.sh"" | ssh -T -D 50210 login.haicore.berlin bash --login -c bash\n2025-09-18 21:42:34.268 [info] Establishing SSH connection: cat ""/var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor_remote_install_7c696bbc-a7db-4d9d-8fb7-646a99575826.sh"" | ssh -T -D 50210 login.haicore.berlin bash --login -c bash\n2025-09-18 21:42:34.268 [info] Started installation script. Waiting for it to finish...\n2025-09-18 21:42:34.268 [info] Waiting for server to install. Timeout: 30000ms\n2025-09-18 21:42:35.142 [info] (ssh_tunnel) stdout: Configuring Cursor Server on Remote\nUsing TMP_DIR: /run/user/961800067\nLocking /run/user/961800067/cursor-remote-lock.c403edc4db82e26fa41a0903d75ac6d0\nDownloading server via wget from https://downloads.cursor.com/production/d750e54bba5cffada6d7b3d18e5688ba5e944ad9/linux/x64/cursor-reh-linux-x64.tar.gz to cursor-server-c55764f6-f499-455c-9a37-d4980d1a4d3c.tar.gz\n\n2025-09-18 21:42:35.146 [info] (ssh_tunnel) stderr: --2025-09-18 21:42:35-- https://downloads.cursor.com/production/d750e54bba5cffada6d7b3d18e5688ba5e944ad9/linux/x64/cursor-reh-linux-x64.tar.gz\n\n2025-09-18 21:42:35.204 [info] (ssh_tunnel) stderr: Resolving downloads.cursor.com (downloads.cursor.com)... \n2025-09-18 21:42:35.261 [info] (ssh_tunnel) stderr: 104.18.16.128, 104.18.17.128, 2606:4700::6812:1180, ...\nConnecting to downloads.cursor.com (downloads.cursor.com)|104.18.16.128|:443... connected.\n\n2025-09-18 21:42:35.330 [info] (ssh_tunnel) stderr: HTTP request sent, awaiting response... \n2025-09-18 21:42:35.355 [info] (ssh_tunnel) stderr: 200 OK\nLength: 65792481 (63M) [application/gzip]\nSaving to: ‘cursor-server-c55764f6-f499-455c-9a37-d4980d1a4d3c.tar.gz’\n\n\ncursor-server-c5576 0%[ ] 0 --.-KB/s \n2025-09-18 21:42:35.560 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 0%[ ] 625.90K 3.01MB/s \n2025-09-18 21:42:35.764 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 2%[ ] 1.28M 3.14MB/s \n2025-09-18 21:42:35.968 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 3%[ ] 1.92M 3.15MB/s \n2025-09-18 21:42:36.165 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 4%[ ] 2.63M 3.25MB/s \n2025-09-18 21:42:36.368 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 5%[> ] 3.35M 3.31MB/s \n2025-09-18 21:42:36.570 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 6%[> ] 3.95M 3.26MB/s \n2025-09-18 21:42:36.778 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 7%[> ] 4.69M 3.31MB/s \n2025-09-18 21:42:36.980 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 8%[> ] 5.34M 3.30MB/s \n2025-09-18 21:42:37.187 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 9%[> ] 6.09M 3.34MB/s \n2025-09-18 21:42:37.379 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 10%[=> ] 6.84M 3.38MB/s \n2025-09-18 21:42:37.583 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 12%[=> ] 7.57M 3.40MB/s \n2025-09-18 21:42:37.783 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 13%[=> ] 8.19M 3.37MB/s \n2025-09-18 21:42:37.984 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 14%[=> ] 8.84M 3.36MB/s \n2025-09-18 21:42:38.189 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 14%[=> ] 9.34M 3.30MB/s \n2025-09-18 21:42:38.390 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 16%[==> ] 10.08M 3.32MB/s eta 16s \n2025-09-18 21:42:38.597 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 16%[==> ] 10.62M 3.30MB/s eta 16s \n2025-09-18 21:42:38.794 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 18%[==> ] 11.29M 3.29MB/s eta 16s \n2025-09-18 21:42:38.997 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 19%[==> ] 11.99M 3.28MB/s eta 16s \n2025-09-18 21:42:39.201 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 20%[===> ] 12.56M 3.28MB/s eta 16s \n2025-09-18 21:42:39.402 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 21%[===> ] 13.32M 3.27MB/s eta 15s \n2025-09-18 21:42:39.603 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 22%[===> ] 13.93M 3.26MB/s eta 15s \n2025-09-18 21:42:39.805 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 23%[===> ] 14.79M 3.32MB/s eta 15s \n2025-09-18 21:42:40.010 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 24%[===> ] 15.56M 3.36MB/s eta 15s \n2025-09-18 21:42:40.214 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 25%[====> ] 16.08M 3.32MB/s eta 15s \n2025-09-18 21:42:40.415 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 27%[====> ] 16.97M 3.33MB/s eta 14s \n2025-09-18 21:42:40.611 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 28%[====> ] 17.76M 3.41MB/s eta 14s \n2025-09-18 21:42:40.815 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 29%[====> ] 18.25M 3.34MB/s eta 14s \n2025-09-18 21:42:41.015 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 30%[=====> ] 19.01M 3.35MB/s eta 14s \n2025-09-18 21:42:41.218 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 31%[=====> ] 19.81M 3.41MB/s eta 14s \n2025-09-18 21:42:41.417 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 32%[=====> ] 20.46M 3.42MB/s eta 13s \n2025-09-18 21:42:41.626 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 33%[=====> ] 21.10M 3.45MB/s eta 13s \n2025-09-18 21:42:41.824 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 34%[=====> ] 21.63M 3.39MB/s eta 13s \n2025-09-18 21:42:42.026 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 35%[======> ] 22.32M 3.42MB/s eta 13s \n2025-09-18 21:42:42.230 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 36%[======> ] 22.83M 3.39MB/s eta 13s \n2025-09-18 21:42:42.432 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 37%[======> ] 23.43M 3.39MB/s eta 12s \n2025-09-18 21:42:42.717 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 38%[======> ] 24.23M 3.39MB/s eta 12s \n2025-09-18 21:42:42.840 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 39%[======> ] 24.83M 3.32MB/s eta 12s \n2025-09-18 21:42:43.126 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 40%[=======> ] 25.53M 3.31MB/s eta 12s \n2025-09-18 21:42:43.244 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 41%[=======> ] 26.20M 3.29MB/s eta 12s \n2025-09-18 21:42:43.445 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 42%[=======> ] 26.85M 3.27MB/s eta 11s \n2025-09-18 21:42:43.646 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 43%[=======> ] 27.56M 3.22MB/s eta 11s \n2025-09-18 21:42:43.846 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 44%[=======> ] 28.13M 3.21MB/s eta 11s \n2025-09-18 21:42:44.050 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 45%[========> ] 28.83M 3.23MB/s eta 11s \n2025-09-18 21:42:44.252 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 47%[========> ] 29.54M 3.22MB/s eta 11s \n2025-09-18 21:42:44.463 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 47%[========> ] 30.03M 3.16MB/s eta 10s \n2025-09-18 21:42:44.656 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 48%[========> ] 30.44M 3.07MB/s eta 10s \n2025-09-18 21:42:44.866 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 49%[========> ] 30.96M 3.09MB/s eta 10s \n2025-09-18 21:42:45.065 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 50%[=========> ] 31.47M 3.04MB/s eta 10s \n2025-09-18 21:42:45.264 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 51%[=========> ] 32.14M 3.04MB/s eta 10s \n2025-09-18 21:42:45.463 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 51%[=========> ] 32.57M 3.01MB/s eta 9s \n2025-09-18 21:42:45.665 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 52%[=========> ] 33.14M 3.00MB/s eta 9s \n2025-09-18 21:42:45.871 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 53%[=========> ] 33.83M 2.97MB/s eta 9s \n2025-09-18 21:42:46.075 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 55%[==========> ] 34.55M 2.98MB/s eta 9s \n2025-09-18 21:42:46.269 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 56%[==========> ] 35.14M 2.98MB/s eta 9s \n2025-09-18 21:42:46.506 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 56%[==========> ] 35.70M 2.93MB/s eta 8s \n2025-09-18 21:42:46.686 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 57%[==========> ] 36.36M 2.94MB/s eta 8s \n2025-09-18 21:42:46.892 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 58%[==========> ] 36.96M 2.88MB/s eta 8s \n2025-09-18 21:42:47.085 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 59%[==========> ] 37.52M 2.87MB/s eta 8s \n2025-09-18 21:42:47.292 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 60%[===========> ] 38.09M 2.85MB/s eta 8s \n2025-09-18 21:42:47.484 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 61%[===========> ] 38.69M 2.84MB/s eta 8s \n2025-09-18 21:42:47.735 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 62%[===========> ] 39.19M 2.85MB/s eta 8s \n2025-09-18 21:42:47.894 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 63%[===========> ] 39.79M 2.89MB/s eta 8s \n2025-09-18 21:42:48.144 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 64%[===========> ] 40.31M 2.91MB/s eta 8s \n2025-09-18 21:42:48.306 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 65%[============> ] 40.93M 2.94MB/s eta 8s \n2025-09-18 21:42:48.508 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 66%[============> ] 41.56M 2.94MB/s eta 7s \n2025-09-18 21:42:48.706 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 66%[============> ] 42.04M 2.93MB/s eta 7s \n2025-09-18 21:42:48.907 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 67%[============> ] 42.45M 2.90MB/s eta 7s \n2025-09-18 21:42:49.110 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 68%[============> ] 42.96M 2.76MB/s eta 7s \n2025-09-18 21:42:49.311 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 69%[============> ] 43.57M 2.80MB/s eta 7s \n2025-09-18 21:42:49.520 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 70%[=============> ] 44.09M 2.77MB/s eta 6s \n2025-09-18 21:42:49.727 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 70%[=============> ] 44.43M 2.65MB/s eta 6s \n2025-09-18 21:42:49.924 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 71%[=============> ] 45.09M 2.73MB/s eta 6s \n2025-09-18 21:42:50.126 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 73%[=============> ] 46.09M 2.83MB/s eta 6s \n2025-09-18 21:42:50.329 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 74%[=============> ] 46.58M 2.79MB/s eta 6s \n2025-09-18 21:42:50.526 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 75%[==============> ] 47.33M 2.87MB/s eta 5s \n2025-09-18 21:42:50.732 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 76%[==============> ] 47.85M 2.84MB/s eta 5s \n2025-09-18 21:42:50.933 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 77%[==============> ] 48.32M 2.81MB/s eta 5s \n2025-09-18 21:42:51.133 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 77%[==============> ] 48.85M 2.82MB/s eta 5s \n2025-09-18 21:42:51.338 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 78%[==============> ] 49.52M 2.84MB/s eta 5s \n2025-09-18 21:42:51.539 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 80%[===============> ] 50.27M 2.86MB/s eta 4s \n2025-09-18 21:42:51.738 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 80%[===============> ] 50.77M 2.89MB/s eta 4s \n2025-09-18 21:42:51.947 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 82%[===============> ] 51.59M 2.98MB/s eta 4s \n2025-09-18 21:42:52.151 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 83%[===============> ] 52.20M 3.03MB/s eta 4s \n2025-09-18 21:42:52.346 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 84%[===============> ] 53.01M 3.11MB/s eta 4s \n2025-09-18 21:42:52.552 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 85%[================> ] 53.71M 3.17MB/s eta 3s \n2025-09-18 21:42:52.754 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 86%[================> ] 54.22M 3.22MB/s eta 3s \n2025-09-18 21:42:52.959 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 87%[================> ] 54.92M 3.22MB/s eta 3s \n2025-09-18 21:42:53.157 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 88%[================> ] 55.32M 3.11MB/s eta 3s \n2025-09-18 21:42:53.356 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 89%[================> ] 55.88M 3.03MB/s eta 3s \n2025-09-18 21:42:53.561 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 89%[================> ] 56.42M 2.98MB/s eta 2s \n2025-09-18 21:42:53.763 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 91%[=================> ] 57.11M 3.02MB/s eta 2s \n2025-09-18 21:42:53.959 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 92%[=================> ] 57.74M 3.06MB/s eta 2s \n2025-09-18 21:42:54.162 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 92%[=================> ] 58.31M 3.09MB/s eta 2s \n2025-09-18 21:42:54.363 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 93%[=================> ] 58.81M 3.10MB/s eta 2s \n2025-09-18 21:42:54.567 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 94%[=================> ] 59.39M 3.07MB/s eta 1s \n2025-09-18 21:42:54.771 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 95%[==================> ] 59.96M 3.04MB/s eta 1s \n2025-09-18 21:42:54.973 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 96%[==================> ] 60.57M 3.02MB/s eta 1s \n2025-09-18 21:42:55.183 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 97%[==================> ] 61.09M 2.94MB/s eta 1s \n2025-09-18 21:42:55.378 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 98%[==================> ] 61.70M 2.90MB/s eta 1s \n2025-09-18 21:42:55.583 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 99%[==================> ] 62.38M 2.89MB/s eta 0s \n2025-09-18 21:42:55.714 [info] (ssh_tunnel) stderr: \ncursor-server-c5576 100%[===================>] 62.74M 2.87MB/s in 20s \n\n2025-09-18 21:42:55 (3.08 MB/s) - ‘cursor-server-c55764f6-f499-455c-9a37-d4980d1a4d3c.tar.gz’ saved [65792481/65792481]\n\n\n2025-09-18 21:42:55.716 [info] (ssh_tunnel) stdout: Extracting server contents from cursor-server-c55764f6-f499-455c-9a37-d4980d1a4d3c.tar.gz\n\n2025-09-18 21:43:25.725 [error] Error installing server: Failed to install server within the timeout\n2025-09-18 21:43:25.725 [info] Deleting local script /var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor_remote_install_7c696bbc-a7db-4d9d-8fb7-646a99575826.sh\n2025-09-18 21:43:25.726 [error] Error resolving SSH authority Failed to install server within the timeout\n2025-09-18 21:43:31.869 [info] (ssh_tunnel) stdout: Checking node executable\n\n2025-09-18 21:43:31.910 [info] (ssh_tunnel) stdout: v20.18.2\n\n2025-09-18 21:43:31.934 [info] (ssh_tunnel) stdout: Cleaning up stale build 5b19bac7a947f54e4caa3eb7e4c5fbf832389850\n\n2025-09-18 21:43:41.270 [info] (ssh_tunnel) stdout: Checking for running multiplex server: /home/franz.srambical/.cursor-server/bin/multiplex-server/45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15.js\n\n2025-09-18 21:43:41.283 [info] (ssh_tunnel) stdout: Running multiplex server: \n\n2025-09-18 21:43:41.286 [info] (ssh_tunnel) stdout: Creating multiplex server token file /run/user/961800067/cursor-remote-multiplex.token.c403edc4db82e26fa41a0903d75ac6d0.45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15\n\n2025-09-18 21:43:41.290 [info] (ssh_tunnel) stdout: Creating directory for multiplex server: /home/franz.srambical/.cursor-server/bin/multiplex-server\n\n2025-09-18 21:43:41.293 [info] (ssh_tunnel) stdout: Writing multiplex server script to /home/franz.srambical/.cursor-server/bin/multiplex-server/45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15.js\n\n2025-09-18 21:43:41.298 [info] (ssh_tunnel) stdout: Starting multiplex server: /home/franz.srambical/.cursor-server/bin/d750e54bba5cffada6d7b3d18e5688ba5e944ad0/node /home/franz.srambical/.cursor-server/bin/multiplex-server/45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15.js 93dfd71e-e326-4d55-bf86-a96c5a726027\n\n2025-09-18 21:43:41.299 [info] (ssh_tunnel) stdout: Multiplex server started with PID 1439570 and wrote pid to file /run/user/961800067/cursor-remote-multiplex.pid.c403edc4db82e26fa41a0903d75ac6d0.45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15\nReading multiplex server token file /run/user/961800067/cursor-remote-multiplex.token.c403edc4db82e26fa41a0903d75ac6d0.45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15\n\n2025-09-18 21:43:41.300 [info] (ssh_tunnel) stdout: Multiplex server token file found\n\n2025-09-18 21:43:41.301 [info] (ssh_tunnel) stdout: Reading multiplex server log file /run/user/961800067/cursor-remote-multiplex.log.c403edc4db82e26fa41a0903d75ac6d0.45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15\n\n2025-09-18 21:43:41.810 [info] (ssh_tunnel) stdout: Checking for code servers\n\n2025-09-18 21:43:41.829 [info] (ssh_tunnel) stdout: Code server script is not running\n\n2025-09-18 21:43:41.830 [info] (ssh_tunnel) stdout: Creating code server token file /run/user/961800067/cursor-remote-code.token.c403edc4db82e26fa41a0903d75ac6d0\n\n2025-09-18 21:43:41.832 [info] (ssh_tunnel) stdout: Starting code server script /home/franz.srambical/.cursor-server/bin/d750e54bba5cffada6d7b3d18e5688ba5e944ad0/bin/cursor-server --start-server --host=127.0.0.1 --port 0 --connection-token-file /run/user/961800067/cursor-remote-code.token.c403edc4db82e26fa41a0903d75ac6d0 --telemetry-level off --enable-remote-auto-shutdown --accept-server-license-terms &> /run/user/961800067/cursor-remote-code.log.c403edc4db82e26fa41a0903d75ac6d0 &\n\n2025-09-18 21:43:41.834 [info] (ssh_tunnel) stdout: Code server started with PID 1439597 and wrote pid to file /run/user/961800067/cursor-remote-code.pid.c403edc4db82e26fa41a0903d75ac6d0\n\n2025-09-18 21:43:41.835 [info] (ssh_tunnel) stdout: Code server log file is /run/user/961800067/cursor-remote-code.log.c403edc4db82e26fa41a0903d75ac6d0\n\n2025-09-18 21:43:42.346 [info] (ssh_tunnel) stdout: ab40692bd5cf9eb0b7920857: start\nexitCode==0==\nnodeExecutable==/home/franz.srambical/.cursor-server/bin/d750e54bba5cffada6d7b3d18e5688ba5e944ad0/node==\nerrorMessage====\nisFatalError==false==\nmultiplexListeningOn==41735==\nmultiplexConnectionToken==93dfd71e-e326-4d55-bf86-a96c5a726027==\ncodeListeningOn==44279==\ncodeConnectionToken==bf62f12b-7cd6-4e8a-b2de-bfe12f096cc9==\ndetectedPlatform==linux==\narch==x64==\nSSH_AUTH_SOCK====\nab40692bd5cf9eb0b7920857: end\n\n2025-09-18 21:43:42.349 [info] (ssh_tunnel) stdout: Unlocking /run/user/961800067/cursor-remote-lock.c403edc4db82e26fa41a0903d75ac6d0\n\n2025-09-18 21:43:42.353 [info] (ssh_tunnel) stdout: \n***********************************************************************\n* This terminal is used to establish and maintain the SSH connection. *\n* Closing this terminal will terminate the connection and disconnect *\n* Cursor from the remote server. *\n***********************************************************************\n\n2025-09-19 09:44:49.008 [info] Resolving ssh remote authority 'login.haicore.berlin' (Unparsed 'ssh-remote+7b22686f73744e616d65223a226c6f67696e2e686169636f72652e6265726c696e227d') (attempt #1)\n2025-09-19 09:44:49.013 [info] SSH askpass server listening on /var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor-ssh-D89V5q/socket.sock\n2025-09-19 09:44:49.013 [info] Using configured platform linux for remote host login.haicore.berlin\n2025-09-19 09:44:49.014 [info] Using askpass script: /Users/franzsrambical/.cursor/extensions/anysphere.remote-ssh-1.0.30/dist/scripts/launchSSHAskpass.sh with javascript file /Users/franzsrambical/.cursor/extensions/anysphere.remote-ssh-1.0.30/dist/scripts/sshAskClient.js. Askpass handle: /var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor-ssh-D89V5q/socket.sock\n2025-09-19 09:44:49.016 [info] Launching SSH server via shell with command: cat ""/var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor_remote_install_f372bc64-0116-4993-ab13-bd38f95b07f3.sh"" | ssh -T -D 54357 login.haicore.berlin bash --login -c bash\n2025-09-19 09:44:49.016 [info] Establishing SSH connection: cat ""/var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor_remote_install_f372bc64-0116-4993-ab13-bd38f95b07f3.sh"" | ssh -T -D 54357 login.haicore.berlin bash --login -c bash\n2025-09-19 09:44:49.016 [info] Started installation script. Waiting for it to finish...\n2025-09-19 09:44:49.016 [info] Waiting for server to install. Timeout: 30000ms\n2025-09-19 09:44:50.066 [info] (ssh_tunnel) stdout: Configuring Cursor Server on Remote\n\n2025-09-19 09:44:50.070 [info] (ssh_tunnel) stdout: Using TMP_DIR: /run/user/961800067\n\n2025-09-19 09:44:50.114 [info] (ssh_tunnel) stdout: Locking /run/user/961800067/cursor-remote-lock.c403edc4db82e26fa41a0903d75ac6d0\n\n2025-09-19 09:44:50.117 [info] (ssh_tunnel) stdout: Server script already installed in /home/franz.srambical/.cursor-server/bin/d750e54bba5cffada6d7b3d18e5688ba5e944ad0/bin/cursor-server\nChecking node executable\n\n2025-09-19 09:44:50.277 [info] (ssh_tunnel) stdout: v20.18.2\n\n2025-09-19 09:44:50.287 [info] (ssh_tunnel) stdout: Checking for running multiplex server: /home/franz.srambical/.cursor-server/bin/multiplex-server/45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15.js\n\n2025-09-19 09:44:50.316 [info] (ssh_tunnel) stdout: Running multiplex server: \nCreating multiplex server token file /run/user/961800067/cursor-remote-multiplex.token.c403edc4db82e26fa41a0903d75ac6d0.45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15\nCreating directory for multiplex server: /home/franz.srambical/.cursor-server/bin/multiplex-server\nWriting multiplex server script to /home/franz.srambical/.cursor-server/bin/multiplex-server/45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15.js\n\n2025-09-19 09:44:50.319 [info] (ssh_tunnel) stdout: Starting multiplex server: /home/franz.srambical/.cursor-server/bin/d750e54bba5cffada6d7b3d18e5688ba5e944ad0/node /home/franz.srambical/.cursor-server/bin/multiplex-server/45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15.js eaf7d393-777e-415d-a724-1482702d85ed\n\n2025-09-19 09:44:50.323 [info] (ssh_tunnel) stdout: Multiplex server started with PID 1228649 and wrote pid to file /run/user/961800067/cursor-remote-multiplex.pid.c403edc4db82e26fa41a0903d75ac6d0.45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15\nReading multiplex server token file /run/user/961800067/cursor-remote-multiplex.token.c403edc4db82e26fa41a0903d75ac6d0.45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15\nMultiplex server token file found\nReading multiplex server log file /run/user/961800067/cursor-remote-multiplex.log.c403edc4db82e26fa41a0903d75ac6d0.45e440a0fc5a5d12380c7a83a49ab82c55f715a5d60292da31f8d75730a9ee15\n\n2025-09-19 09:44:50.852 [info] (ssh_tunnel) stdout: Checking for code servers\nCode server script is not running\nCreating code server token file /run/user/961800067/cursor-remote-code.token.c403edc4db82e26fa41a0903d75ac6d0\nStarting code server script /home/franz.srambical/.cursor-server/bin/d750e54bba5cffada6d7b3d18e5688ba5e944ad0/bin/cursor-server --start-server --host=127.0.0.1 --port 0 --connection-token-file /run/user/961800067/cursor-remote-code.token.c403edc4db82e26fa41a0903d75ac6d0 --telemetry-level off --enable-remote-auto-shutdown --accept-server-license-terms &> /run/user/961800067/cursor-remote-code.log.c403edc4db82e26fa41a0903d75ac6d0 &\n\n2025-09-19 09:44:50.852 [info] (ssh_tunnel) stdout: Code server started with PID 1228673 and wrote pid to file /run/user/961800067/cursor-remote-code.pid.c403edc4db82e26fa41a0903d75ac6d0\n\n2025-09-19 09:44:50.853 [info] (ssh_tunnel) stdout: Code server log file is /run/user/961800067/cursor-remote-code.log.c403edc4db82e26fa41a0903d75ac6d0\n\n2025-09-19 09:44:51.363 [info] (ssh_tunnel) stdout: 09f095a162d9060dac5b6973: start\nexitCode==0==\nnodeExecutable==/home/franz.srambical/.cursor-server/bin/d750e54bba5cffada6d7b3d18e5688ba5e944ad0/node==\nerrorMessage====\nisFatalError==false==\nmultiplexListeningOn==41891==\nmultiplexConnectionToken==eaf7d393-777e-415d-a724-1482702d85ed==\ncodeListeningOn==33467==\ncodeConnectionToken==543a4aae-f8e4-409f-82df-97d7638835ab==\ndetectedPlatform==linux==\narch==x64==\nSSH_AUTH_SOCK====\n09f095a162d9060dac5b6973: end\n\n2025-09-19 09:44:51.364 [info] Server install command exit code: 0\n2025-09-19 09:44:51.364 [info] Deleting local script /var/folders/nn/241fnlwx03d7k7qt2jg98txr0000gn/T/cursor_remote_install_f372bc64-0116-4993-ab13-bd38f95b07f3.sh\n2025-09-19 09:44:51.365 [info] [forwarding][code] creating new forwarding server\n2025-09-19 09:44:51.365 [info] [forwarding][code] server listening on 127.0.0.1:54360\n2025-09-19 09:44:51.365 [info] [forwarding][code] Set up server\n2025-09-19 09:44:51.366 [info] [remote-ssh] codeListeningOn (remote=127.0.0.1:33467; local=127.0.0.1:54360) codeConnectionToken: 543a4aae-f8e4-409f-82df-97d7638835ab\n2025-09-19 09:44:51.366 [info] [forwarding][multiplex] creating new forwarding server\n2025-09-19 09:44:51.366 [info] [forwarding][multiplex] server listening on 127.0.0.1:54361\n2025-09-19 09:44:51.366 [info] [forwarding][multiplex] Set up server\n2025-09-19 09:44:51.367 [info] [remote-ssh] multiplexListeningOn (remote=[object Object]; local=[object Object]) multiplexConnectionToken: eaf7d393-777e-415d-a724-1482702d85ed\n2025-09-19 09:44:51.367 [info] [remote-ssh] Pinging remote server via 127.0.0.1:54361...\n2025-09-19 09:44:51.368 [info] [remote-ssh] Resolved exec server. Socks port: 54357\n2025-09-19 09:44:51.368 [info] Setting up 0 default forwarded ports\n2025-09-19 09:44:51.368 [info] [remote-ssh] Resolved authority: {""host"":""127.0.0.1"",""port"":54360,""connectionToken"":""543a4aae-f8e4-409f-82df-97d7638835ab"",""extensionHostEnv"":{}}. Socks port: 54357\n2025-09-19 09:44:51.369 [info] (ssh_tunnel) stdout: Unlocking /run/user/961800067/cursor-remote-lock.c403edc4db82e26fa41a0903d75ac6d0\n \n***********************************************************************\n* This terminal is used to establish and maintain the SSH connection. *\n* Closing this terminal will terminate the connection and disconnect *\n* Cursor from the remote server. *\n***********************************************************************\n\n2025-09-19 09:44:51.370 [info] [forwarding][multiplex][127.0.0.1:54361 -> 127.0.0.1:41891][6e9bfa00-642f-44b3-b9c7-9babcf14f2d2] received connection request\n2025-09-19 09:44:51.370 [info] [command][b9c15628-b6df-4ba9-8173-a6d180a62773] Sending command request: {""command"":""echo"",""args"":[""1""],""env"":{},""token"":""eaf7d393-777e-415d-a724-1482702d85ed"",""id"":""b9c15628-b6df-4ba9-8173-a6d180a62773""}\n2025-09-19 09:44:51.398 [info] [forwarding][multiplex][127.0.0.1:54361 -> 127.0.0.1:54357 -> 127.0.0.1:41891][6e9bfa00-642f-44b3-b9c7-9babcf14f2d2] socks forwarding established\n2025-09-19 09:44:51.409 [info] [forwarding][code][127.0.0.1:54360 -> 127.0.0.1:33467][57669757-90bb-4719-85e7-f10c67cc93fc] received connection request\n2025-09-19 09:44:51.427 [info] [command][b9c15628-b6df-4ba9-8173-a6d180a62773] Process exited with code 0\n2025-09-19 09:44:51.427 [info] [command][b9c15628-b6df-4ba9-8173-a6d180a62773] Socket close event received\n2025-09-19 09:44:51.428 [info] [forwarding][multiplex][127.0.0.1:54361 -> 127.0.0.1:54357 -> 127.0.0.1:41891][6e9bfa00-642f-44b3-b9c7-9babcf14f2d2] socks connection closed\n2025-09-19 09:44:51.436 [info] [forwarding][code][127.0.0.1:54360 -> 127.0.0.1:54357 -> 127.0.0.1:33467][57669757-90bb-4719-85e7-f10c67cc93fc] socks forwarding established\n2025-09-19 09:44:51.476 [info] [forwarding][code][127.0.0.1:54360 -> 127.0.0.1:33467][5f3fb94e-5ff5-4129-adde-6c1378730e57] received connection request\n2025-09-19 09:44:51.502 [info] [forwarding][code][127.0.0.1:54360 -> 127.0.0.1:54357 -> 127.0.0.1:33467][5f3fb94e-5ff5-4129-adde-6c1378730e57] socks forwarding established\n2025-09-19 09:44:51.625 [info] Saved platform linux for remote host login.haicore.berlin\n2025-09-19 09:44:54.434 [info] [tunnel-forwarding][localhost:8888 -> 127.0.0.1:8888] server listening\n2025-09-19 09:44:54.434 [info] Cross binding to [::1]:8888. Originally bound to 127.0.0.1:8888\n2025-09-19 09:44:54.434 [info] [tunnel-forwarding][::1:8888 -> 127.0.0.1:8888] server listening\n2025-09-19 09:44:54.448 [info] [tunnel-forwarding][localhost:6006 -> localhost:6006] server listening\n2025-09-19 09:44:54.448 [info] Cross binding to [::1]:6006. Originally bound to 127.0.0.1:6006\n2025-09-19 09:44:54.448 [info] [tunnel-forwarding][::1:6006 -> localhost:6006] server listening\n",log,tab
4
+ 3,117,"train_dynamics.py",0,0,"",python,tab
5
+ 4,147,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"9:44:55 AM [info] Activating crowd-code\n9:44:55 AM [info] Recording started\n9:44:55 AM [info] Initializing git provider using file system watchers...\n",Log,tab
6
+ 5,201,"extension-output-pdoom-org.crowd-code-#1-crowd-code",150,0,"9:44:55 AM [info] Git repository found\n9:44:55 AM [info] Git provider initialized successfully\n9:44:55 AM [info] Initial git state: [object Object]\n",Log,content
7
+ 6,3937,"TERMINAL",0,0,"",,terminal_command
8
+ 7,10701,"TERMINAL",0,0,"",,terminal_command
9
+ 8,19624,"input_pipeline/generate_atari_dataset.py",0,0,"",python,tab
10
+ 9,118840,"TERMINAL",0,0,"",,terminal_command
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-49d30a9b-2bd1-4042-8682-5ad6555396c71759741630177-2025_10_06-11.07.17.431/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-4c510e1e-c7fc-4bd2-bf45-93d5487c2a0d1760868436827-2025_10_19-12.07.22.935/source.csv ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,3,"slurm/dev/franz/berlin/coinrun/sample/maskgit/sample_mila_submission_case_study_vanilla.sh",0,0,"#!/usr/bin/env bash\n\n#SBATCH --nodes=1\n#SBATCH --ntasks-per-node=1\n#SBATCH --time=24:00:00\n#SBATCH --cpus-per-task=8\n#SBATCH --gres=gpu:1\n#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics_sample/%x_%j.log\n#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/dynamics_sample/%x_%j.log\n#SBATCH --job-name=coinrun_sample_maskgit_mila_submission_case_study_vanilla\n\n# Activate virtual environment\nsource .venv/bin/activate\n\narray_records_dir=""/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_10M_npy_arr_rec/array_record/test""\nCHECKPOINT_PATH=""/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/dynamics/dynamics_case_study_dataset_10M_30031""\n\ncurrent_branch=$(git rev-parse --abbrev-ref HEAD)\nif [ ""$current_branch"" != ""main"" ]; then\n echo ""This script must be run from the main branch. Current branch is $current_branch. Exiting.""\n exit 1\nfi\n\necho ""Sampling from checkpoint: $CHECKPOINT_PATH""\n\nsrun python jasmine/sample.py \\n --seed=1 \\n --maskgit_steps=1 \\n --tokenizer_ffn_dim=512 \\n --tokenizer_num_blocks=8 \\n --dyna_ffn_dim=512 \\n --dyna_num_blocks=12 \\n --output_dir=gifs/dynamics_case_study_dataset_10M_vanilla \\n --checkpoint $CHECKPOINT_PATH \\n --data_dir=$array_records_dir \\n --seq_len=16 \\n --batch_size=32 \\n --patch_size=4 \\n --start_frame=4 \\n --image_height=64 \\n --image_width=64 \\n --dyna_type=maskgit\n",shellscript,tab
3
+ 2,228,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"12:07:22 PM [info] Activating crowd-code\n12:07:22 PM [info] Recording started\n12:07:22 PM [info] Initializing git provider using file system watchers...\n12:07:23 PM [info] Git repository found\n12:07:23 PM [info] Git provider initialized successfully\n12:07:23 PM [info] Initial git state: [object Object]\n",Log,tab
4
+ 3,5272,"TERMINAL",0,0,"",,terminal_command
5
+ 4,8400,"slurm/dev/franz/berlin/coinrun/sample/maskgit/sample_mila_submission_case_study_vanilla.sh",0,0,"",shellscript,tab
6
+ 5,8988,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
7
+ 6,10169,"slurm/dev/franz/berlin/coinrun/sample/maskgit/sample_mila_submission_case_study_vanilla.sh",0,0,"",shellscript,tab
8
+ 7,10171,"TERMINAL",0,0,"",,terminal_focus
9
+ 8,10727,"TERMINAL",0,0,"source /home/franz.srambical/jafar/.venv/bin/activate",,terminal_command
10
+ 9,10730,"TERMINAL",0,0,"]633;C]0;franz.srambical@hai-login1:~/jafar",,terminal_output
11
+ 10,12005,"TERMINAL",0,0,"",,terminal_command
12
+ 11,12327,"TERMINAL",0,0,"squeue",,terminal_command
13
+ 12,12349,"TERMINAL",0,0,"]633;C JOBID USER PARTITION NODES CPUS ST SUBMIT_TIME START_TIME TIME TIME_LIMIT NODELIST(REASON)\r\n 32259 xiao.liu interacti 1 128 R 2025-10-19T11:19:21 2025-10-19T11:19:21 48:14 23:59:00 hai005\r\n 32250 xiao.liu interacti 1 128 R 2025-10-19T01:29:31 2025-10-19T01:29:58 10:37:37 23:59:00 hai002\r\n 32248 xiao.liu interacti 1 128 R 2025-10-19T01:23:17 2025-10-19T01:23:28 10:44:07 23:59:00 hai007\r\n 32092 alfred.ngu standard 1 16 R 2025-10-19T11:53:27 2025-10-19T11:55:48 11:47 1-00:00:00 hai002\r\n 32216 alfred.ngu standard 1 16 R 2025-10-19T11:18:55 2025-10-19T11:21:10 46:25 1:00:00 hai004\r\n 32258 nishant.ku standard 3 96 R 2025-10-19T05:18:10 2025-10-19T05:18:40 6:48:55 1-00:00:00 hai[001,003,006]\r\n 32251 xiao.liu standard 1 128 R 2025-10-19T02:19:39 2025-10-19T02:19:56 9:47:39 23:59:00 hai008\r\n 32095 alfred.ngu standard 1 16 R 2025-10-18T12:11:12 2025-10-18T12:13:27 23:54:08 1-00:00:00 hai007\r\n]0;franz.srambical@hai-login1:~/jafar",,terminal_output
14
+ 13,120318,"TERMINAL",0,0,"",,terminal_command
15
+ 14,2210013,"slurm/dev/franz/berlin/coinrun/sample/maskgit/sample_mila_submission_case_study_vanilla.sh",340,0,"",shellscript,selection_mouse
16
+ 15,2210018,"slurm/dev/franz/berlin/coinrun/sample/maskgit/sample_mila_submission_case_study_vanilla.sh",339,0,"",shellscript,selection_command
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-50667a73-ae54-4bc8-b84f-f1f7ccbad60a1763324981508-2025_11_16-21.29.50.605/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-59e067fd-ed43-41e8-b51d-604e03ee2ed51758537565603-2025_09_22-12.39.52.921/source.csv ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,3,"input_pipeline/generate_coinrun_dataset.py",0,0,"""""""\nGenerates a dataset of random-action CoinRun episodes.\nEpisodes are saved individually as memory-mapped files for efficient loading.\n""""""\n\nfrom dataclasses import dataclass\n\nfrom gym3 import types_np\nimport numpy as np\nfrom procgen import ProcgenGym3Env\nimport tyro\nimport json\nimport os\nfrom utils import save_chunks\n\n\n@dataclass\nclass Args:\n num_episodes_train: int = 10000\n num_episodes_val: int = 500\n num_episodes_test: int = 500\n output_dir: str = ""data/coinrun_episodes""\n min_episode_length: int = 1000\n max_episode_length: int = 1000\n chunk_size: int = 160\n chunks_per_file: int = 100\n seed: int = 0\n\n\nargs = tyro.cli(Args)\nassert (\n args.max_episode_length >= args.min_episode_length\n), ""Maximum episode length must be greater than or equal to minimum episode length.""\n\nif args.min_episode_length < args.chunk_size:\n print(\n ""Warning: Minimum episode length is smaller than chunk size. Note that episodes shorter than the chunk size will be discarded.""\n )\n\n\n# --- Generate episodes ---\ndef generate_episodes(num_episodes, split):\n episode_idx = 0\n episode_metadata = []\n obs_chunks = []\n act_chunks = []\n file_idx = 0\n output_dir_split = os.path.join(args.output_dir, split)\n while episode_idx < num_episodes:\n seed = np.random.randint(0, 10000)\n env = ProcgenGym3Env(num=1, env_name=""coinrun"", start_level=seed)\n\n observations_seq = []\n actions_seq = []\n episode_obs_chunks = []\n episode_act_chunks = []\n\n # --- Run episode ---\n step_t = 0\n for step_t in range(args.max_episode_length):\n action = types_np.sample(env.ac_space, bshape=(env.num,))\n env.act(action)\n _, obs, first = env.observe()\n observations_seq.append(obs[""rgb""])\n actions_seq.append(action)\n if len(observations_seq) == args.chunk_size:\n episode_obs_chunks.append(observations_seq)\n episode_act_chunks.append(actions_seq)\n observations_seq = []\n actions_seq = []\n if first:\n break\n\n # --- Save episode ---\n if step_t + 1 >= args.min_episode_length:\n if observations_seq:\n if len(observations_seq) < args.chunk_size:\n print(\n f""Warning: Inconsistent chunk_sizes. Episode has {len(observations_seq)} frames, ""\n f""which is smaller than the requested chunk_size: {args.chunk_size}. ""\n ""This might lead to performance degradation during training.""\n )\n episode_obs_chunks.append(observations_seq)\n episode_act_chunks.append(actions_seq)\n\n obs_chunks_data = [\n np.concatenate(seq, axis=0).astype(np.uint8)\n for seq in episode_obs_chunks\n ]\n act_chunks_data = [\n np.concatenate(act, axis=0) for act in episode_act_chunks\n ]\n obs_chunks.extend(obs_chunks_data)\n act_chunks.extend(act_chunks_data)\n\n ep_metadata, obs_chunks, file_idx, act_chunks = save_chunks(\n obs_chunks, file_idx, args.chunks_per_file, output_dir_split, act_chunks\n )\n episode_metadata.extend(ep_metadata)\n\n print(f""Episode {episode_idx} completed, length: {step_t + 1}."")\n episode_idx += 1\n else:\n print(f""Episode too short ({step_t + 1}), resampling..."")\n\n if len(obs_chunks) > 0:\n print(\n f""Warning: Dropping {len(obs_chunks)} chunks for consistent number of chunks per file."",\n ""Consider changing the chunk_size and chunks_per_file parameters to prevent data-loss."",\n )\n\n print(f""Done generating {split} split"")\n return episode_metadata\n\n\ndef get_action_space():\n env = ProcgenGym3Env(num=1, env_name=""coinrun"", start_level=0)\n return env.ac_space.eltype.n\n\n\ndef main():\n # Set random seed and create dataset directories\n np.random.seed(args.seed)\n # --- Generate episodes ---\n train_episode_metadata = generate_episodes(args.num_episodes_train, ""train"")\n val_episode_metadata = generate_episodes(args.num_episodes_val, ""val"")\n test_episode_metadata = generate_episodes(args.num_episodes_test, ""test"")\n\n # --- Save metadata ---\n metadata = {\n ""env"": ""coinrun"",\n ""num_actions"": get_action_space(),\n ""num_episodes_train"": args.num_episodes_train,\n ""num_episodes_val"": args.num_episodes_val,\n ""num_episodes_test"": args.num_episodes_test,\n ""avg_episode_len_train"": np.mean(\n [ep[""avg_seq_len""] for ep in train_episode_metadata]\n ),\n ""avg_episode_len_val"": np.mean(\n [ep[""avg_seq_len""] for ep in val_episode_metadata]\n ),\n ""avg_episode_len_test"": np.mean(\n [ep[""avg_seq_len""] for ep in test_episode_metadata]\n ),\n ""episode_metadata_train"": train_episode_metadata,\n ""episode_metadata_val"": val_episode_metadata,\n ""episode_metadata_test"": test_episode_metadata,\n }\n with open(os.path.join(args.output_dir, ""metadata.json""), ""w"") as f:\n json.dump(metadata, f)\n\n print(f""Done generating dataset."")\n\n\nif __name__ == ""__main__"":\n main()\n",python,tab
3
+ 2,450,"input_pipeline/generate_coinrun_dataset.py",3908,0,"",python,selection_keyboard
4
+ 3,775,"input_pipeline/generate_coinrun_dataset.py",2256,0,"",python,selection_keyboard
5
+ 4,954,"input_pipeline/generate_coinrun_dataset.py",869,0,"",python,selection_keyboard
6
+ 5,1479,"input_pipeline/generate_coinrun_dataset.py",269,0,"",python,selection_keyboard
7
+ 6,1480,"input_pipeline/generate_coinrun_dataset.py",0,0,"",python,selection_keyboard
8
+ 7,3218,"input_pipeline/generate_coinrun_dataset.py",1013,0,"",python,selection_keyboard
9
+ 8,3225,"input_pipeline/generate_coinrun_dataset.py",2545,0,"",python,selection_keyboard
10
+ 9,3433,"input_pipeline/generate_coinrun_dataset.py",4010,0,"",python,selection_keyboard
11
+ 10,3649,"input_pipeline/generate_coinrun_dataset.py",5351,0,"",python,selection_keyboard
12
+ 11,6966,"TERMINAL",0,0,"",,terminal_command
13
+ 12,7445,"input_pipeline/generate_coinrun_dataset.py",3908,0,"",python,selection_keyboard
14
+ 13,10008,"input_pipeline/generate_coinrun_dataset.py",2256,0,"",python,selection_keyboard
15
+ 14,10481,"input_pipeline/generate_coinrun_dataset.py",869,0,"",python,selection_keyboard
16
+ 15,10721,"input_pipeline/generate_coinrun_dataset.py",0,0,"",python,selection_keyboard
17
+ 16,12886,"input_pipeline/generate_coinrun_dataset.py",1013,0,"",python,selection_keyboard
18
+ 17,13430,"input_pipeline/generate_coinrun_dataset.py",2545,0,"",python,selection_keyboard
19
+ 18,13883,"input_pipeline/generate_coinrun_dataset.py",4010,0,"",python,selection_keyboard
20
+ 19,14284,"input_pipeline/generate_coinrun_dataset.py",5351,0,"",python,selection_keyboard
21
+ 20,15222,"input_pipeline/generate_coinrun_dataset.py",3908,0,"",python,selection_keyboard
22
+ 21,15383,"input_pipeline/generate_coinrun_dataset.py",2256,0,"",python,selection_keyboard
23
+ 22,15533,"input_pipeline/generate_coinrun_dataset.py",869,0,"",python,selection_keyboard
24
+ 23,15695,"input_pipeline/generate_coinrun_dataset.py",0,0,"",python,selection_keyboard
25
+ 24,16382,"TERMINAL",0,0,"",,terminal_command
26
+ 25,21968,"input_pipeline/generate_atari_dataset.py",0,0,"# adapted from https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/rainbow_atari.py\nimport collections\nimport math\nimport os\nimport random\nimport time\nfrom collections import deque\nfrom dataclasses import dataclass\n\nimport gymnasium as gym\nimport numpy as np\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torch.optim as optim\nimport tyro\nfrom typing import Optional, Any\nfrom torch.utils.tensorboard.writer import SummaryWriter\n\nfrom cleanrl_utils.atari_wrappers import (\n ClipRewardEnv,\n EpisodicLifeEnv,\n FireResetEnv,\n MaxAndSkipEnv,\n NoopResetEnv,\n)\n\n# FIXME (f.srambical): remove the try-except block\ntry:\n from utils import save_chunks # type: ignore\nexcept Exception: # pragma: no cover\n from input_pipeline.utils import save_chunks # type: ignore\nimport json\n\n\n@dataclass\nclass Args:\n exp_name: str = os.path.basename(__file__)[: -len("".py"")]\n """"""the name of this experiment""""""\n seed: int = 1\n """"""seed of the experiment""""""\n torch_deterministic: bool = True\n """"""if toggled, `torch.backends.cudnn.deterministic=False`""""""\n cuda: bool = True\n """"""if toggled, cuda will be enabled by default""""""\n track: bool = False\n """"""if toggled, this experiment will be tracked with Weights and Biases""""""\n wandb_project_name: str = ""cleanRL""\n """"""the wandb's project name""""""\n wandb_entity: Optional[str] = None\n """"""the entity (team) of wandb's project""""""\n capture_video: bool = False\n """"""whether to capture videos of the agent performances (check out `videos` folder)""""""\n save_model: bool = False\n """"""whether to save model into the `runs/{run_name}` folder""""""\n upload_model: bool = False\n """"""whether to upload the saved model to huggingface""""""\n hf_entity: str = """"\n """"""the user or org name of the model repository from the Hugging Face Hub""""""\n\n env_id: str = ""ALE/Breakout-v5""\n """"""the id of the environment""""""\n total_timesteps: int = 10000000\n """"""total timesteps of the experiments""""""\n learning_rate: float = 0.0000625\n """"""the learning rate of the optimizer""""""\n num_envs: int = 1\n """"""the number of parallel game environments""""""\n buffer_size: int = 1000000\n """"""the replay memory buffer size""""""\n gamma: float = 0.99\n """"""the discount factor gamma""""""\n tau: float = 1.0\n """"""the target network update rate""""""\n target_network_frequency: int = 8000\n """"""the timesteps it takes to update the target network""""""\n batch_size: int = 32\n """"""the batch size of sample from the reply memory""""""\n start_e: float = 1\n """"""the starting epsilon for exploration""""""\n end_e: float = 0.01\n """"""the ending epsilon for exploration""""""\n exploration_fraction: float = 0.10\n """"""the fraction of `total-timesteps` it takes from start-e to go end-e""""""\n learning_starts: int = 80000\n """"""timestep to start learning""""""\n train_frequency: int = 4\n """"""the frequency of training""""""\n n_step: int = 3\n """"""the number of steps to look ahead for n-step Q learning""""""\n prioritized_replay_alpha: float = 0.5\n """"""alpha parameter for prioritized replay buffer""""""\n prioritized_replay_beta: float = 0.4\n """"""beta parameter for prioritized replay buffer""""""\n prioritized_replay_eps: float = 1e-6\n """"""epsilon parameter for prioritized replay buffer""""""\n n_atoms: int = 51\n """"""the number of atoms""""""\n v_min: float = -10\n """"""the return lower bound""""""\n v_max: float = 10\n """"""the return upper bound""""""\n\n # Dataset capture\n capture_dataset: bool = True\n num_episodes_train: int = 10000\n num_episodes_val: int = 500\n num_episodes_test: int = 500\n output_dir: str = ""data/atari_episodes""\n min_episode_length: int = 1\n chunk_size: int = 160\n chunks_per_file: int = 100\n stop_on_complete: bool = True\n\n\ndef make_env(env_id, seed, idx, capture_video, run_name):\n def thunk():\n if capture_video and idx == 0:\n env = gym.make(env_id, render_mode=""rgb_array"")\n env = gym.wrappers.RecordVideo(env, f""videos/{run_name}"")\n else:\n env = gym.make(env_id)\n env = gym.wrappers.RecordEpisodeStatistics(env)\n\n env = NoopResetEnv(env, noop_max=30)\n env = MaxAndSkipEnv(env, skip=4)\n env = EpisodicLifeEnv(env)\n if ""FIRE"" in env.unwrapped.get_action_meanings():\n env = FireResetEnv(env)\n env = ClipRewardEnv(env)\n env = gym.wrappers.ResizeObservation(env, (84, 84))\n env = gym.wrappers.GrayScaleObservation(env)\n env = gym.wrappers.FrameStack(env, 4)\n\n env.action_space.seed(seed)\n return env\n\n return thunk\n\n\nclass NoisyLinear(nn.Module):\n def __init__(self, in_features, out_features, std_init=0.5):\n super().__init__()\n self.in_features = in_features\n self.out_features = out_features\n self.std_init = std_init\n\n self.weight_mu = nn.Parameter(torch.FloatTensor(out_features, in_features))\n self.weight_sigma = nn.Parameter(torch.FloatTensor(out_features, in_features))\n self.register_buffer(\n ""weight_epsilon"", torch.FloatTensor(out_features, in_features)\n )\n self.bias_mu = nn.Parameter(torch.FloatTensor(out_features))\n self.bias_sigma = nn.Parameter(torch.FloatTensor(out_features))\n self.register_buffer(""bias_epsilon"", torch.FloatTensor(out_features))\n # factorized gaussian noise\n self.reset_parameters()\n self.reset_noise()\n\n def reset_parameters(self):\n mu_range = 1 / math.sqrt(self.in_features)\n self.weight_mu.data.uniform_(-mu_range, mu_range)\n self.weight_sigma.data.fill_(self.std_init / math.sqrt(self.in_features))\n self.bias_mu.data.uniform_(-mu_range, mu_range)\n self.bias_sigma.data.fill_(self.std_init / math.sqrt(self.out_features))\n\n def reset_noise(self):\n self.weight_epsilon.normal_()\n self.bias_epsilon.normal_()\n\n def forward(self, input):\n if self.training:\n weight = self.weight_mu + self.weight_sigma * self.weight_epsilon\n bias = self.bias_mu + self.bias_sigma * self.bias_epsilon\n else:\n weight = self.weight_mu\n bias = self.bias_mu\n return F.linear(input, weight, bias)\n\n\n# ALGO LOGIC: initialize agent here:\nclass NoisyDuelingDistributionalNetwork(nn.Module):\n def __init__(self, env, n_atoms, v_min, v_max):\n super().__init__()\n self.n_atoms = n_atoms\n self.v_min = v_min\n self.v_max = v_max\n self.delta_z = (v_max - v_min) / (n_atoms - 1)\n self.n_actions = env.single_action_space.n\n self.register_buffer(""support"", torch.linspace(v_min, v_max, n_atoms))\n\n self.network = nn.Sequential(\n nn.Conv2d(4, 32, 8, stride=4),\n nn.ReLU(),\n nn.Conv2d(32, 64, 4, stride=2),\n nn.ReLU(),\n nn.Conv2d(64, 64, 3, stride=1),\n nn.ReLU(),\n nn.Flatten(),\n )\n conv_output_size = 3136\n\n self.value_head = nn.Sequential(\n NoisyLinear(conv_output_size, 512), nn.ReLU(), NoisyLinear(512, n_atoms)\n )\n\n self.advantage_head = nn.Sequential(\n NoisyLinear(conv_output_size, 512),\n nn.ReLU(),\n NoisyLinear(512, n_atoms * self.n_actions),\n )\n\n def forward(self, x):\n h = self.network(x / 255.0)\n value = self.value_head(h).view(-1, 1, self.n_atoms)\n advantage = self.advantage_head(h).view(-1, self.n_actions, self.n_atoms)\n q_atoms = value + advantage - advantage.mean(dim=1, keepdim=True)\n q_dist = F.softmax(q_atoms, dim=2)\n return q_dist\n\n def reset_noise(self):\n for layer in self.value_head:\n if isinstance(layer, NoisyLinear):\n layer.reset_noise()\n for layer in self.advantage_head:\n if isinstance(layer, NoisyLinear):\n layer.reset_noise()\n\n\nPrioritizedBatch = collections.namedtuple(\n ""PrioritizedBatch"",\n [\n ""observations"",\n ""actions"",\n ""rewards"",\n ""next_observations"",\n ""dones"",\n ""indices"",\n ""weights"",\n ],\n)\n\n\n# adapted from: https://github.com/openai/baselines/blob/master/baselines/common/segment_tree.py\nclass SumSegmentTree:\n def __init__(self, capacity):\n self.capacity = capacity\n self.tree_size = 2 * capacity - 1\n self.tree = np.zeros(self.tree_size, dtype=np.float32)\n\n def _propagate(self, idx):\n parent = (idx - 1) // 2\n while parent >= 0:\n self.tree[parent] = self.tree[parent * 2 + 1] + self.tree[parent * 2 + 2]\n parent = (parent - 1) // 2\n\n def update(self, idx, value):\n tree_idx = idx + self.capacity - 1\n self.tree[tree_idx] = value\n self._propagate(tree_idx)\n\n def total(self):\n return self.tree[0]\n\n def retrieve(self, value):\n idx = 0\n while idx * 2 + 1 < self.tree_size:\n left = idx * 2 + 1\n right = left + 1\n if value <= self.tree[left]:\n idx = left\n else:\n value -= self.tree[left]\n idx = right\n return idx - (self.capacity - 1)\n\n\n# adapted from: https://github.com/openai/baselines/blob/master/baselines/common/segment_tree.py\nclass MinSegmentTree:\n def __init__(self, capacity):\n self.capacity = capacity\n self.tree_size = 2 * capacity - 1\n self.tree = np.full(self.tree_size, float(""inf""), dtype=np.float32)\n\n def _propagate(self, idx):\n parent = (idx - 1) // 2\n while parent >= 0:\n self.tree[parent] = np.minimum(\n self.tree[parent * 2 + 1], self.tree[parent * 2 + 2]\n )\n parent = (parent - 1) // 2\n\n def update(self, idx, value):\n tree_idx = idx + self.capacity - 1\n self.tree[tree_idx] = value\n self._propagate(tree_idx)\n\n def min(self):\n return self.tree[0]\n\n\nclass PrioritizedReplayBuffer:\n def __init__(\n self, capacity, obs_shape, device, n_step, gamma, alpha=0.6, beta=0.4, eps=1e-6\n ):\n self.capacity = capacity\n self.device = device\n self.n_step = n_step\n self.gamma = gamma\n self.alpha = alpha\n self.beta = beta\n self.eps = eps\n\n self.buffer_obs = np.zeros((capacity,) + obs_shape, dtype=np.uint8)\n self.buffer_next_obs = np.zeros((capacity,) + obs_shape, dtype=np.uint8)\n self.buffer_actions = np.zeros(capacity, dtype=np.int64)\n self.buffer_rewards = np.zeros(capacity, dtype=np.float32)\n self.buffer_dones = np.zeros(capacity, dtype=np.bool_)\n\n self.pos = 0\n self.size = 0\n self.max_priority = 1.0\n\n self.sum_tree = SumSegmentTree(capacity)\n self.min_tree = MinSegmentTree(capacity)\n\n # For n-step returns\n self.n_step_buffer = deque(maxlen=n_step)\n\n def _get_n_step_info(self):\n reward = 0.0\n next_obs = self.n_step_buffer[-1][3]\n done = self.n_step_buffer[-1][4]\n\n for i in range(len(self.n_step_buffer)):\n reward += self.gamma**i * self.n_step_buffer[i][2]\n if self.n_step_buffer[i][4]:\n next_obs = self.n_step_buffer[i][3]\n done = True\n break\n return reward, next_obs, done\n\n def add(self, obs, action, reward, next_obs, done):\n self.n_step_buffer.append((obs, action, reward, next_obs, done))\n\n if len(self.n_step_buffer) < self.n_step:\n return\n\n reward, next_obs, done = self._get_n_step_info()\n obs = self.n_step_buffer[0][0]\n action = self.n_step_buffer[0][1]\n\n idx = self.pos\n self.buffer_obs[idx] = obs\n self.buffer_next_obs[idx] = next_obs\n self.buffer_actions[idx] = action\n self.buffer_rewards[idx] = reward\n self.buffer_dones[idx] = done\n\n priority = self.max_priority**self.alpha\n self.sum_tree.update(idx, priority)\n self.min_tree.update(idx, priority)\n\n self.pos = (self.pos + 1) % self.capacity\n self.size = min(self.size + 1, self.capacity)\n\n if done:\n self.n_step_buffer.clear()\n\n def sample(self, batch_size):\n indices = []\n p_total = self.sum_tree.total()\n segment = p_total / batch_size\n\n for i in range(batch_size):\n a = segment * i\n b = segment * (i + 1)\n upperbound = np.random.uniform(a, b)\n idx = self.sum_tree.retrieve(upperbound)\n indices.append(idx)\n\n samples = {\n ""observations"": torch.from_numpy(self.buffer_obs[indices]).to(self.device),\n ""actions"": torch.from_numpy(self.buffer_actions[indices])\n .to(self.device)\n .unsqueeze(1),\n ""rewards"": torch.from_numpy(self.buffer_rewards[indices])\n .to(self.device)\n .unsqueeze(1),\n ""next_observations"": torch.from_numpy(self.buffer_next_obs[indices]).to(\n self.device\n ),\n ""dones"": torch.from_numpy(self.buffer_dones[indices])\n .to(self.device)\n .unsqueeze(1),\n }\n\n probs = np.array(\n [self.sum_tree.tree[idx + self.capacity - 1] for idx in indices]\n )\n weights = (self.size * probs / p_total) ** -self.beta\n weights = weights / weights.max()\n samples[""weights""] = torch.from_numpy(weights).to(self.device).unsqueeze(1)\n samples[""indices""] = indices\n\n return PrioritizedBatch(**samples)\n\n def update_priorities(self, indices, priorities):\n priorities = np.abs(priorities) + self.eps\n self.max_priority = max(self.max_priority, priorities.max())\n\n for idx, priority in zip(indices, priorities):\n priority = priority**self.alpha\n self.sum_tree.update(idx, priority)\n self.min_tree.update(idx, priority)\n\n\nif __name__ == ""__main__"":\n args = tyro.cli(Args)\n assert args.num_envs == 1, ""vectorized envs are not supported at the moment""\n run_name = f""{args.env_id}__{args.exp_name}__{args.seed}__{int(time.time())}""\n if args.track:\n import wandb\n\n wandb.init(\n project=args.wandb_project_name,\n entity=args.wandb_entity,\n sync_tensorboard=True,\n config=vars(args),\n name=run_name,\n monitor_gym=True,\n save_code=True,\n )\n writer = SummaryWriter(f""runs/{run_name}"")\n writer.add_text(\n ""hyperparameters"",\n ""|param|value|\n|-|-|\n%s""\n % (""\n"".join([f""|{key}|{value}|"" for key, value in vars(args).items()])),\n )\n\n # TRY NOT TO MODIFY: seeding\n random.seed(args.seed)\n np.random.seed(args.seed)\n torch.manual_seed(args.seed)\n torch.backends.cudnn.deterministic = args.torch_deterministic\n\n device = torch.device(""cuda"" if torch.cuda.is_available() and args.cuda else ""cpu"")\n\n # env setup\n envs = gym.vector.SyncVectorEnv(\n [\n make_env(args.env_id, args.seed + i, i, args.capture_video, run_name)\n for i in range(args.num_envs)\n ]\n )\n assert isinstance(\n envs.single_action_space, gym.spaces.Discrete\n ), ""only discrete action space is supported""\n\n q_network = NoisyDuelingDistributionalNetwork(\n envs, args.n_atoms, args.v_min, args.v_max\n ).to(device)\n optimizer = optim.Adam(q_network.parameters(), lr=args.learning_rate, eps=1.5e-4)\n target_network = NoisyDuelingDistributionalNetwork(\n envs, args.n_atoms, args.v_min, args.v_max\n ).to(device)\n target_network.load_state_dict(q_network.state_dict())\n\n rb = PrioritizedReplayBuffer(\n args.buffer_size,\n envs.single_observation_space.shape,\n device,\n args.n_step,\n args.gamma,\n args.prioritized_replay_alpha,\n args.prioritized_replay_beta,\n args.prioritized_replay_eps,\n )\n\n # dataset capture state\n split_targets = {\n ""train"": args.num_episodes_train,\n ""val"": args.num_episodes_val,\n ""test"": args.num_episodes_test,\n }\n # Determine splits to run (order: train -> val -> test)\n splits_in_order = [s for s in [""train"", ""val"", ""test""] if split_targets[s] > 0]\n\n episodes_captured_per_split: dict[str, int] = {\n s: 0 for s in [""train"", ""val"", ""test""]\n }\n file_idx_by_split: dict[str, int] = {s: 0 for s in [""train"", ""val"", ""test""]}\n episode_metadata_by_split: dict[str, list[dict]] = {\n s: [] for s in [""train"", ""val"", ""test""]\n }\n\n obs_chunks: list[np.ndarray] = []\n act_chunks: list[np.ndarray] = []\n\n current_split_idx = 0\n current_split = splits_in_order[0]\n split_dir = os.path.join(args.output_dir, current_split)\n if args.capture_dataset:\n os.makedirs(split_dir, exist_ok=True)\n\n start_time = time.time()\n\n # TRY NOT TO MODIFY: start the game\n obs, _ = envs.reset(seed=args.seed)\n observations_seq: list[np.ndarray] = []\n actions_seq: list[np.ndarray] = []\n for global_step in range(args.total_timesteps):\n # anneal PER beta to 1\n rb.beta = min(\n 1.0,\n args.prioritized_replay_beta\n + global_step * (1.0 - args.prioritized_replay_beta) / args.total_timesteps,\n )\n\n # ALGO LOGIC: put action logic here\n with torch.no_grad():\n q_dist = q_network(torch.Tensor(obs).to(device))\n q_values = torch.sum(q_dist * q_network.support, dim=2)\n actions = torch.argmax(q_values, dim=1).cpu().numpy()\n\n # TRY NOT TO MODIFY: execute the game and log data.\n next_obs, rewards, terminations, truncations, infos = envs.step(actions)\n\n if args.capture_dataset:\n observations_seq.append(next_obs.astype(np.uint8))\n actions_seq.append(actions.astype(np.int64))\n\n if ""final_info"" in infos:\n for info in infos[""final_info""]:\n if info and ""episode"" in info:\n print(\n f""global_step={global_step}, episodic_return={info['episode']['r']}""\n )\n writer.add_scalar(\n ""charts/episodic_return"", info[""episode""][""r""], global_step\n )\n writer.add_scalar(\n ""charts/episodic_length"", info[""episode""][""l""], global_step\n )\n\n continue_capturing_multi = any(\n episodes_captured_per_split[s] < split_targets[s]\n for s in splits_in_order\n )\n if args.capture_dataset and continue_capturing_multi:\n current_len = len(observations_seq)\n if current_len >= args.min_episode_length:\n frames = np.concatenate(observations_seq, axis=0).astype(\n np.uint8\n )\n acts = np.concatenate(actions_seq, axis=0).astype(np.int64)\n\n episode_obs_chunks = []\n episode_act_chunks = []\n start_idx = 0\n while start_idx < current_len:\n end_idx = min(start_idx + args.chunk_size, current_len)\n if end_idx - start_idx < args.chunk_size:\n print(\n f""Warning: Inconsistent chunk_sizes. Episode has {current_len} frames, ""\n f""which is smaller than the requested chunk_size: {args.chunk_size}. ""\n ""This might lead to performance degradation during training.""\n )\n episode_obs_chunks.append(frames[start_idx:end_idx])\n episode_act_chunks.append(acts[start_idx:end_idx])\n start_idx = end_idx\n\n obs_chunks_data = [\n seq.astype(np.uint8) for seq in episode_obs_chunks\n ]\n act_chunks_data = [act for act in episode_act_chunks]\n obs_chunks.extend(obs_chunks_data)\n act_chunks.extend(act_chunks_data)\n\n # Save to the active split\n ep_metadata, obs_chunks, next_file_idx, act_chunks = (\n save_chunks(\n obs_chunks,\n file_idx_by_split[current_split],\n args.chunks_per_file,\n split_dir,\n act_chunks,\n )\n )\n file_idx_by_split[current_split] = next_file_idx\n episode_metadata_by_split[current_split].extend(ep_metadata)\n\n episodes_captured_per_split[current_split] += 1\n\n if (\n episodes_captured_per_split[current_split]\n >= split_targets[current_split]\n ):\n if len(obs_chunks) > 0:\n print(\n f""Warning: Dropping {len(obs_chunks)} chunks before switching split '"",\n {current_split},\n ""' for consistent number of chunks per file."",\n ""Consider changing the chunk_size and chunks_per_file parameters to prevent data-loss."",\n )\n obs_chunks = []\n act_chunks = []\n if current_split_idx + 1 < len(splits_in_order):\n current_split_idx += 1\n current_split = splits_in_order[current_split_idx]\n split_dir = os.path.join(\n args.output_dir, current_split\n )\n os.makedirs(split_dir, exist_ok=True)\n else:\n print(\n f""Episode too short ({current_len}), skipping capture...""\n )\n\n observations_seq = []\n actions_seq = []\n\n # TRY NOT TO MODIFY: save data to reply buffer; handle `final_observation`\n real_next_obs = next_obs.copy()\n for idx, trunc in enumerate(truncations):\n if trunc:\n real_next_obs[idx] = infos[""final_observation""][idx]\n rb.add(obs, actions, rewards, real_next_obs, terminations)\n\n # TRY NOT TO MODIFY: CRUCIAL step easy to overlook\n obs = next_obs\n\n # ALGO LOGIC: training.\n if global_step > args.learning_starts:\n if global_step % args.train_frequency == 0:\n # reset the noise for both networks\n q_network.reset_noise()\n target_network.reset_noise()\n data = rb.sample(args.batch_size)\n\n with torch.no_grad():\n next_dist = target_network(\n data.next_observations\n ) # [B, num_actions, n_atoms]\n support = target_network.support # [n_atoms]\n next_q_values = torch.sum(\n next_dist * support, dim=2\n ) # [B, num_actions]\n\n # double q-learning\n next_dist_online = q_network(\n data.next_observations\n ) # [B, num_actions, n_atoms]\n next_q_online = torch.sum(\n next_dist_online * support, dim=2\n ) # [B, num_actions]\n best_actions = torch.argmax(next_q_online, dim=1) # [B]\n next_pmfs = next_dist[\n torch.arange(args.batch_size), best_actions\n ] # [B, n_atoms]\n\n # compute the n-step Bellman update.\n gamma_n = args.gamma**args.n_step\n next_atoms = data.rewards + gamma_n * support * (\n 1 - data.dones.float()\n )\n tz = next_atoms.clamp(q_network.v_min, q_network.v_max)\n\n # projection\n delta_z = q_network.delta_z\n b = (tz - q_network.v_min) / delta_z # shape: [B, n_atoms]\n l = b.floor().clamp(0, args.n_atoms - 1)\n u = b.ceil().clamp(0, args.n_atoms - 1)\n\n # (l == u).float() handles the case where bj is exactly an integer\n # example bj = 1, then the upper ceiling should be uj= 2, and lj= 1\n d_m_l = (\n u.float() + (l == b).float() - b\n ) * next_pmfs # [B, n_atoms]\n d_m_u = (b - l) * next_pmfs # [B, n_atoms]\n\n target_pmfs = torch.zeros_like(next_pmfs)\n for i in range(target_pmfs.size(0)):\n target_pmfs[i].index_add_(0, l[i].long(), d_m_l[i])\n target_pmfs[i].index_add_(0, u[i].long(), d_m_u[i])\n\n dist = q_network(data.observations) # [B, num_actions, n_atoms]\n pred_dist = dist.gather(\n 1, data.actions.unsqueeze(-1).expand(-1, -1, args.n_atoms)\n ).squeeze(1)\n log_pred = torch.log(pred_dist.clamp(min=1e-5, max=1 - 1e-5))\n\n loss_per_sample = -(target_pmfs * log_pred).sum(dim=1)\n loss = (loss_per_sample * data.weights.squeeze()).mean()\n\n # update priorities\n new_priorities = loss_per_sample.detach().cpu().numpy()\n rb.update_priorities(data.indices, new_priorities)\n\n if global_step % 100 == 0:\n writer.add_scalar(""losses/td_loss"", loss.item(), global_step)\n q_values = (pred_dist * q_network.support).sum(dim=1) # [B]\n writer.add_scalar(\n ""losses/q_values"", q_values.mean().item(), global_step\n )\n sps = int(global_step / (time.time() - start_time))\n print(""SPS:"", sps)\n writer.add_scalar(""charts/SPS"", sps, global_step)\n writer.add_scalar(""charts/beta"", rb.beta, global_step)\n\n # optimize the model\n optimizer.zero_grad()\n loss.backward()\n optimizer.step()\n\n # update target network\n if global_step % args.target_network_frequency == 0:\n for target_param, param in zip(\n target_network.parameters(), q_network.parameters()\n ):\n target_param.data.copy_(\n args.tau * param.data + (1.0 - args.tau) * target_param.data\n )\n\n # optional early stop on dataset completion\n if args.capture_dataset and args.stop_on_complete:\n all_done = (\n all(\n episodes_captured_per_split[s] >= split_targets[s]\n for s in splits_in_order\n )\n and len(splits_in_order) > 0\n )\n if all_done:\n break\n\n envs.close()\n writer.close()\n\n # write metadata for dataset\n if args.capture_dataset:\n if len(obs_chunks) > 0:\n print(\n f""Warning: Dropping {len(obs_chunks)} chunks for consistent number of chunks per file."",\n ""Consider changing the chunk_size and chunks_per_file parameters to prevent data-loss."",\n )\n\n os.makedirs(args.output_dir, exist_ok=True)\n metadata_path = os.path.join(args.output_dir, ""metadata.json"")\n if os.path.exists(metadata_path):\n try:\n with open(metadata_path, ""r"") as f:\n metadata = json.load(f)\n except Exception:\n metadata = {}\n else:\n metadata = {}\n\n metadata.setdefault(""env"", args.env_id)\n metadata.setdefault(""num_actions"", int(envs.single_action_space.n))\n for split in [""train"", ""val"", ""test""]:\n metadata.setdefault(f""num_episodes_{split}"", 0)\n metadata.setdefault(f""avg_episode_len_{split}"", 0.0)\n metadata.setdefault(f""episode_metadata_{split}"", [])\n\n for split_key in splits_in_order:\n ep_meta_list = episode_metadata_by_split[split_key]\n if ep_meta_list:\n metadata[f""episode_metadata_{split_key}""].extend(ep_meta_list)\n metadata[f""num_episodes_{split_key}""] = len(\n metadata[f""episode_metadata_{split_key}""]\n )\n metadata[f""avg_episode_len_{split_key}""] = float(\n np.mean(\n [\n ep[""avg_seq_len""]\n for ep in metadata[f""episode_metadata_{split_key}""]\n ]\n )\n )\n\n with open(metadata_path, ""w"") as f:\n json.dump(metadata, f)\n",python,tab
27
+ 26,35142,"input_pipeline/generate_atari_dataset.py",601,1287,"try:\n from utils import save_chunks # type: ignore\nexcept Exception: # pragma: no cover\n from input_pipeline.utils import save_chunks # type: ignore\nimport json\n\n\n@dataclass\nclass Args:\n exp_name: str = os.path.basename(__file__)[: -len("".py"")]\n """"""the name of this experiment""""""\n seed: int = 1\n """"""seed of the experiment""""""\n torch_deterministic: bool = True\n """"""if toggled, `torch.backends.cudnn.deterministic=False`""""""\n cuda: bool = True\n """"""if toggled, cuda will be enabled by default""""""\n track: bool = False\n """"""if toggled, this experiment will be tracked with Weights and Biases""""""\n wandb_project_name: str = ""cleanRL""\n """"""the wandb's project name""""""\n wandb_entity: Optional[str] = None\n """"""the entity (team) of wandb's project""""""\n capture_video: bool = False\n """"""whether to capture videos of the agent performances (check out `videos` folder)""""""\n save_model: bool = False\n """"""whether to save model into the `runs/{run_name}` folder""""""\n upload_model: bool = False\n """"""whether to upload the saved model to huggingface""""""\n hf_entity: str = """"\n """"""the user or org name of the model repository from the Hugging Face Hub""""""\n\n env_id: str = ""BreakoutNoFrameskip-v4""\n",python,content
28
+ 27,38419,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"12:39:52 PM [info] Activating crowd-code\n12:39:52 PM [info] Recording started\n12:39:52 PM [info] Initializing git provider using file system watchers...\n12:39:54 PM [info] Git repository found\n12:39:54 PM [info] Git provider initialized successfully\n12:39:54 PM [info] Initial git state: [object Object]\n",Log,tab
29
+ 28,40256,"input_pipeline/generate_atari_dataset.py",0,0,"",python,tab
30
+ 29,46941,"TERMINAL",0,0,"",,terminal_focus
31
+ 30,50332,"TERMINAL",0,0,"source /home/franz.srambical/cleanrl/.venv/bin/activate",,terminal_command
32
+ 31,58364,"TERMINAL",0,0,"git lo",,terminal_command
33
+ 32,58364,"TERMINAL",0,0,"]633;Cgit: 'lo' is not a git command. See 'git --help'.\r\n\r\nThe most similar commands are\r\n\tlog\r\n\tclone\r\n]0;franz.srambical@hai-login1:~/jafar",,terminal_output
34
+ 33,60701,"TERMINAL",0,0,"git log",,terminal_command
35
+ 34,60752,"TERMINAL",0,0,"]633;C",,terminal_output
36
+ 35,61023,"TERMINAL",0,0,"[?1h=\rcommit 26beff74368b99553cfa1b5d24762a9512dc56e0 (HEAD -> gt-actions)\r\nAuthor: emergenz <franz.srambical@gmail.com>\r\nDate: Sat Sep 20 17:07:07 2025 +0200\r\n\r\n feat: trajectory collection during rainbow training\r\n\r\ncommit 7c97398c3cc4db602122c0ab9d4b1f27d8d4604a\r\nAuthor: Mihir Mahajan <mihir.mahajan2002@gmail.com>\r\nDate: Fri Sep 19 12:14:46 2025 +0200\r\n\r\n bugfixes in train dynamics\r\n\r\ncommit 1b6b878e5be7afc70cac4249bc0c1a3c5a3e7528\r\nAuthor: mihir <78321484+maharajamihir@users.noreply.github.com>\r\n:",,terminal_output
37
+ 36,63089,"TERMINAL",0,0,"\r[?1l>]0;franz.srambical@hai-login1:~/jafar",,terminal_output
38
+ 37,67298,"TERMINAL",0,0,"git revert --hard",,terminal_command
39
+ 38,67299,"TERMINAL",0,0,"]633;Cusage: git revert [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] <commit>...\r\n or: git revert (--continue | --skip | --abort | --quit)\r\n\r\n --quit end revert or cherry-pick sequence\r\n --continue resume revert or cherry-pick sequence\r\n --abort cancel revert or cherry-pick sequence\r\n --skip skip current commit and continue\r\n --[no-]cleanup <mode> how to strip spaces and #comments from message\r\n -n, --no-commit don't automatically commit\r\n --commit opposite of --no-commit\r\n -e, --[no-]edit edit the commit message\r\n -s, --[no-]signoff add a Signed-off-by trailer\r\n -m, --[no-]mainline <parent-number>\r\n select mainline parent\r\n --[no-]rerere-autoupdate\r\n update the index with reused conflict resolution if possible\r\n --[no-]strategy <strategy>\r\n merge strategy\r\n -X, --[no-]strategy-option <option>\r\n option for merge strategy\r\n -S, --[no-]gpg-sign[=<key-id>]\r\n GPG sign commit\r\n --[no-]reference use the 'reference' format to refer to commits\r\n\r\n]0;franz.srambical@hai-login1:~/jafar",,terminal_output
40
+ 39,80945,"TERMINAL",0,0,"git reset --hard HEAD~1",,terminal_command
41
+ 40,80993,"TERMINAL",0,0,"]633;CHEAD is now at 7c97398 bugfixes in train dynamics\r\n",,terminal_output
42
+ 41,81057,"TERMINAL",0,0,"]0;franz.srambical@hai-login1:~/jafar",,terminal_output
43
+ 42,86896,"TERMINAL",0,0,"git log",,terminal_command
44
+ 43,86972,"TERMINAL",0,0,"]633;C[?1h=\rcommit 7c97398c3cc4db602122c0ab9d4b1f27d8d4604a (HEAD -> gt-actions)\r\nAuthor: Mihir Mahajan <mihir.mahajan2002@gmail.com>\r\nDate: Fri Sep 19 12:14:46 2025 +0200\r\n\r\n bugfixes in train dynamics\r\n\r\ncommit 1b6b878e5be7afc70cac4249bc0c1a3c5a3e7528\r\nAuthor: mihir <78321484+maharajamihir@users.noreply.github.com>\r\nDate: Thu Sep 18 16:14:11 2025 +0200\r\n\r\n Update input_pipeline/generate_coinrun_dataset.py\r\n \r\n Co-authored-by: Franz Srambical <79149449+emergenz@users.noreply.github.com>\r\n\r\n:",,terminal_output
45
+ 44,89059,"TERMINAL",0,0,"\r[?1l>]0;franz.srambical@hai-login1:~/jafar",,terminal_output
46
+ 45,102368,"TERMINAL",0,0,"git cherry-pick 35e26ae50d5ac2a837e0a9670b257ca956b0ad48",,terminal_command
47
+ 46,102405,"TERMINAL",0,0,"]633;C",,terminal_output
48
+ 47,102558,"TERMINAL",0,0,"[gt-actions f677f49] feat: trajectory collection during rainbow training\r\n Date: Sat Sep 20 17:07:07 2025 +0200\r\n 1 file changed, 782 insertions(+)\r\n create mode 100644 input_pipeline/generate_atari_dataset.py\r\n]0;franz.srambical@hai-login1:~/jafar",,terminal_output
49
+ 48,104618,"input_pipeline/generate_atari_dataset.py",0,0,"",python,selection_command
50
+ 49,109262,"input_pipeline/generate_atari_dataset.py",947,0,"",python,selection_keyboard
51
+ 50,109337,"input_pipeline/generate_atari_dataset.py",2588,0,"",python,selection_keyboard
52
+ 51,109539,"input_pipeline/generate_atari_dataset.py",4011,0,"",python,selection_keyboard
53
+ 52,109863,"input_pipeline/generate_atari_dataset.py",5506,0,"",python,selection_keyboard
54
+ 53,109863,"input_pipeline/generate_atari_dataset.py",6964,0,"",python,selection_keyboard
55
+ 54,110046,"input_pipeline/generate_atari_dataset.py",8133,0,"",python,selection_keyboard
56
+ 55,110407,"input_pipeline/generate_atari_dataset.py",9376,0,"",python,selection_keyboard
57
+ 56,110431,"input_pipeline/generate_atari_dataset.py",10683,0,"",python,selection_keyboard
58
+ 57,110753,"input_pipeline/generate_atari_dataset.py",0,0,"",python,selection_command
59
+ 58,113675,"genie.py",0,0,"from typing import Dict\n\nimport einops\nimport jax\nimport jax.numpy as jnp\nimport flax.nnx as nnx\nimport orbax.checkpoint as ocp\n\nfrom models.dynamics import DynamicsMaskGIT, DynamicsCausal\nfrom models.lam import LatentActionModel\nfrom models.tokenizer import TokenizerVQVAE\n\n\nclass Genie(nnx.Module):\n """"""Genie model""""""\n\n def __init__(\n self,\n in_dim: int,\n tokenizer_dim: int,\n tokenizer_ffn_dim: int,\n latent_patch_dim: int,\n num_patch_latents: int,\n patch_size: int,\n tokenizer_num_blocks: int,\n tokenizer_num_heads: int,\n lam_dim: int,\n lam_ffn_dim: int,\n latent_action_dim: int,\n num_latent_actions: int,\n lam_patch_size: int,\n lam_num_blocks: int,\n lam_num_heads: int,\n lam_co_train: bool,\n use_gt_actions: bool,\n dyna_type: str,\n dyna_dim: int,\n dyna_ffn_dim: int,\n dyna_num_blocks: int,\n dyna_num_heads: int,\n param_dtype: jnp.dtype,\n dtype: jnp.dtype,\n use_flash_attention: bool,\n decode: bool,\n rngs: nnx.Rngs,\n dropout: float = 0.0,\n mask_limit: float = 0.0,\n ):\n # --- Tokenizer ---\n self.in_dim = in_dim\n self.tokenizer_dim = tokenizer_dim\n self.tokenizer_ffn_dim = tokenizer_ffn_dim\n self.latent_patch_dim = latent_patch_dim\n self.num_patch_latents = num_patch_latents\n self.patch_size = patch_size\n self.tokenizer_num_blocks = tokenizer_num_blocks\n self.tokenizer_num_heads = tokenizer_num_heads\n # --- LAM ---\n self.lam_dim = lam_dim\n self.lam_ffn_dim = lam_ffn_dim\n self.latent_action_dim = latent_action_dim\n self.num_latent_actions = num_latent_actions\n self.lam_patch_size = lam_patch_size\n self.lam_num_blocks = lam_num_blocks\n self.lam_num_heads = lam_num_heads\n self.lam_co_train = lam_co_train\n self.use_gt_actions = use_gt_actions\n # --- Dynamics ---\n self.dyna_type = dyna_type\n self.dyna_dim = dyna_dim\n self.dyna_ffn_dim = dyna_ffn_dim\n self.dyna_num_blocks = dyna_num_blocks\n self.dyna_num_heads = dyna_num_heads\n self.param_dtype = param_dtype\n self.dtype = dtype\n self.use_flash_attention = use_flash_attention\n self.dropout = dropout\n self.mask_limit = mask_limit\n self.decode = decode\n\n self.tokenizer = TokenizerVQVAE(\n in_dim=self.in_dim,\n model_dim=self.tokenizer_dim,\n ffn_dim=self.tokenizer_ffn_dim,\n latent_dim=self.latent_patch_dim,\n num_latents=self.num_patch_latents,\n patch_size=self.patch_size,\n num_blocks=self.tokenizer_num_blocks,\n num_heads=self.tokenizer_num_heads,\n dropout=0.0,\n codebook_dropout=0.0,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=rngs,\n )\n if self.use_gt_actions:\n self.action_embed = nnx.Embed(\n self.num_latent_actions, self.latent_action_dim, rngs=rngs\n )\n self.lam = None\n else:\n self.lam = LatentActionModel(\n in_dim=self.in_dim,\n model_dim=self.lam_dim,\n ffn_dim=self.lam_ffn_dim,\n latent_dim=self.latent_patch_dim,\n num_latents=self.num_latent_actions,\n patch_size=self.lam_patch_size,\n num_blocks=self.lam_num_blocks,\n num_heads=self.lam_num_heads,\n dropout=0.0,\n codebook_dropout=0.0,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=rngs,\n )\n self.action_embed = None\n if self.dyna_type == ""maskgit"":\n self.dynamics = DynamicsMaskGIT(\n model_dim=self.dyna_dim,\n ffn_dim=self.dyna_ffn_dim,\n num_latents=self.num_patch_latents,\n latent_action_dim=self.latent_action_dim,\n num_blocks=self.dyna_num_blocks,\n num_heads=self.dyna_num_heads,\n dropout=self.dropout,\n mask_limit=self.mask_limit,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=rngs,\n )\n elif self.dyna_type == ""causal"":\n self.dynamics = DynamicsCausal(\n model_dim=self.dyna_dim,\n ffn_dim=self.dyna_ffn_dim,\n num_latents=self.num_patch_latents,\n latent_action_dim=self.latent_action_dim,\n num_blocks=self.dyna_num_blocks,\n num_heads=self.dyna_num_heads,\n dropout=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n decode=decode,\n rngs=rngs,\n )\n else:\n raise ValueError(f""Invalid dynamics type: {self.dyna_type}"")\n\n def __call__(\n self,\n batch: Dict[str, jax.Array],\n training: bool = True,\n ) -> Dict[str, jax.Array]:\n videos_BTHWC = batch[""videos""]\n tokenizer_outputs = self.tokenizer.vq_encode(videos_BTHWC, training=False)\n token_indices_BTN = tokenizer_outputs[""indices""]\n latent_actions_BTm11L = None\n action_embeddings_BTm11L = None\n if self.use_gt_actions:\n assert self.action_embed is not None\n action_indices_E = None\n action_embeddings_BT1L = self.action_embed(batch[""actions""]).reshape(\n *batch[""actions""].shape[:2], 1, self.latent_action_dim\n )\n action_embeddings_BTm11L = action_embeddings_BT1L[:, 1:]\n else:\n assert self.lam is not None\n lam_outputs = self.lam.vq_encode(videos_BTHWC, training=False)\n z_q_BTm11L = lam_outputs[""z_q""]\n action_indices_E = lam_outputs[""indices""]\n latent_actions_BTm11L = jax.lax.cond(\n self.lam_co_train,\n lambda: z_q_BTm11L,\n lambda: jax.lax.stop_gradient(z_q_BTm11L),\n )\n outputs = dict(\n video_tokens=jax.lax.stop_gradient(token_indices_BTN),\n latent_actions=(\n action_embeddings_BTm11L\n if self.use_gt_actions\n else latent_actions_BTm11L\n ),\n )\n outputs[""mask_rng""] = batch[""rng""]\n dyna_logits_BTNV, dyna_mask = self.dynamics(outputs, training)\n outputs[""token_logits""] = dyna_logits_BTNV\n outputs[""mask""] = dyna_mask\n mle_indices_BTN = jnp.argmax(outputs[""token_logits""], axis=-1)\n H, W = batch[""videos""].shape[2:4]\n outputs[""recon""] = self.tokenizer.decode(mle_indices_BTN, (H, W))\n if action_indices_E is not None:\n outputs[""lam_indices""] = action_indices_E\n return outputs\n\n def sample(\n self,\n batch: Dict[str, jax.Array],\n seq_len: int,\n temperature: float = 1,\n sample_argmax: bool = False,\n maskgit_steps: int = 25,\n ) -> tuple[jax.Array, jax.Array]:\n if self.dyna_type == ""maskgit"":\n return self.sample_maskgit(\n batch, seq_len, maskgit_steps, temperature, sample_argmax\n )\n elif self.dyna_type == ""causal"":\n return self.sample_causal(batch, seq_len, temperature, sample_argmax)\n else:\n raise ValueError(f""Dynamics model type unknown: {self.dyna_type}"")\n\n def sample_maskgit(\n self,\n batch: Dict[str, jax.Array],\n seq_len: int,\n steps: int = 25,\n temperature: float = 1,\n sample_argmax: bool = False,\n ) -> tuple[jax.Array, jax.Array]:\n """"""\n Autoregressively samples up to `seq_len` future frames, following Figure 8 of the paper.\n\n - Input frames are tokenized once.\n - Future frames are generated autoregressively in token space.\n - All frames are detokenized in a single pass.\n\n Note:\n - For interactive or step-wise sampling, detokenization should occur after each action.\n - To maintain consistent tensor shapes across timesteps, all current and future frames are decoded at every step.\n - Temporal causal structure is preserved by\n a) reapplying the mask before each decoding step.\n b) a temporal causal mask is applied within each ST-transformer block.\n\n Dimension keys:\n B: batch size\n T: number of input (conditioning) frames\n N: number of patches per frame\n M: model dimension\n S: sequence length\n H: height\n W: width\n E: B * (S - 1)\n P: S * N\n """"""\n assert isinstance(self.dynamics, DynamicsMaskGIT)\n # --- Encode videos and actions ---\n videos_BTHWC = batch[""videos""]\n tokenizer_out = self.tokenizer.vq_encode(videos_BTHWC, training=False)\n token_idxs_BTN = tokenizer_out[""indices""]\n B, T, N = token_idxs_BTN.shape\n pad_shape = (B, seq_len - T, N)\n pad = jnp.zeros(pad_shape, dtype=token_idxs_BTN.dtype)\n token_idxs_BSN = jnp.concatenate([token_idxs_BTN, pad], axis=1)\n init_logits_BSNV = jnp.zeros(\n shape=(*token_idxs_BSN.shape, self.num_patch_latents)\n )\n if self.use_gt_actions:\n assert self.action_embed is not None\n latent_actions_BT1L = self.action_embed(batch[""actions""]).reshape(\n *batch[""actions""].shape[:2], 1, self.latent_action_dim\n )\n latent_actions_BTm11L = latent_actions_BT1L[:, 1:]\n action_tokens_EL = latent_actions_BTm11L.reshape(-1, self.latent_action_dim)\n else:\n assert self.lam is not None\n latent_actions_E = batch[""latent_actions""]\n action_tokens_EL = self.lam.vq.get_codes(latent_actions_E)\n\n # --- Extract submodule state ---\n dynamics_state = nnx.state(self.dynamics)\n\n @nnx.scan(in_axes=(nnx.Carry, 0), out_axes=nnx.Carry)\n def maskgit_step_fn(\n carry: tuple[jax.Array, jax.Array, jax.Array, jax.Array, jax.Array],\n step: jax.Array,\n ) -> tuple[jax.Array, jax.Array, jax.Array, jax.Array, jax.Array]:\n rng, token_idxs_BSN, logits_BSNV, mask_BSN, action_tokens_EL = carry\n S, N = token_idxs_BSN.shape[1:]\n L = action_tokens_EL.shape[-1]\n\n # We need to reconstruct the submodule inside scan body to prevent trace context mismatches\n dynamics_maskgit = DynamicsMaskGIT(\n model_dim=self.dyna_dim,\n ffn_dim=self.dyna_ffn_dim,\n num_latents=self.num_patch_latents,\n latent_action_dim=self.latent_action_dim,\n num_blocks=self.dyna_num_blocks,\n num_heads=self.dyna_num_heads,\n dropout=self.dropout,\n mask_limit=self.mask_limit,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n rngs=nnx.Rngs(0),\n )\n nnx.update(dynamics_maskgit, dynamics_state)\n\n # --- Construct + encode video ---\n vid_embed_BSNM = dynamics_maskgit.patch_embed(token_idxs_BSN)\n mask_token_111M = dynamics_maskgit.mask_token.value\n mask_expanded_BSN1 = mask_BSN[..., None]\n vid_embed_BSNM = jnp.where(\n mask_expanded_BSN1, mask_token_111M, vid_embed_BSNM\n )\n\n # --- Predict transition ---\n action_tokens_BSm1L = jnp.reshape(action_tokens_EL, (B, S - 1, L))\n act_embed_BSm1M = dynamics_maskgit.action_up(action_tokens_BSm1L)\n act_embed_BSM = jnp.pad(act_embed_BSm1M, ((0, 0), (1, 0), (0, 0)))\n act_embed_BS1M = jnp.reshape(\n act_embed_BSM, (B, S, 1, act_embed_BSM.shape[-1])\n )\n vid_embed_BSNM += act_embed_BS1M\n unmasked_ratio = jnp.cos(jnp.pi * (step + 1) / (steps * 2))\n step_temp = temperature * (1.0 - unmasked_ratio)\n final_logits_BSNV = dynamics_maskgit.transformer(vid_embed_BSNM) / step_temp\n\n # --- Sample new tokens for final frame ---\n if sample_argmax:\n sampled_token_idxs_BSN = jnp.argmax(final_logits_BSNV, axis=-1)\n else:\n rng, _rng = jax.random.split(rng)\n sampled_token_idxs_BSN = jax.random.categorical(_rng, final_logits_BSNV)\n gather_fn = jax.vmap(jax.vmap(jax.vmap(lambda x, y: x[y])))\n final_token_probs_BSN = gather_fn(\n jax.nn.softmax(final_logits_BSNV), sampled_token_idxs_BSN\n )\n final_token_probs_BSN += ~mask_BSN\n # Update masked tokens and logits only\n token_idxs_BSN = jnp.where(mask_BSN, sampled_token_idxs_BSN, token_idxs_BSN)\n logits_BSNV = jnp.where(\n jnp.expand_dims(mask_BSN, -1), final_logits_BSNV, logits_BSNV\n )\n\n # --- Update mask ---\n num_unmasked_tokens = jnp.round(N * (1.0 - unmasked_ratio)).astype(int)\n final_token_probs_flat_BP = einops.rearrange(\n final_token_probs_BSN, ""b s n -> b (s n)""\n )\n idx_mask_P = (\n jnp.arange(final_token_probs_flat_BP.shape[-1])\n <= N - num_unmasked_tokens\n )\n sorted_idxs_BP = jnp.argsort(final_token_probs_flat_BP, axis=-1)\n mask_update_fn = jax.vmap(lambda msk, ids: msk.at[ids].set(idx_mask_P))\n mask_flat_BP = einops.rearrange(mask_BSN, ""b s n -> b (s n)"")\n new_mask_flat_BP = mask_update_fn(mask_flat_BP, sorted_idxs_BP)\n new_mask_BSN = einops.rearrange(new_mask_flat_BP, ""b (s n) -> b s n"", n=N)\n\n new_carry = (\n rng,\n token_idxs_BSN,\n logits_BSNV,\n new_mask_BSN,\n action_tokens_EL,\n )\n return new_carry\n\n @nnx.scan(in_axes=(nnx.Carry, 0), out_axes=nnx.Carry)\n def generation_step_fn(\n carry: tuple[jax.Array, jax.Array, jax.Array], step_t: jax.Array\n ) -> tuple[jax.Array, jax.Array, jax.Array]:\n rng, current_token_idxs_BSN, current_logits_BSNV = carry\n rng, step_rng = jax.random.split(rng)\n\n # Mask current frame (i.e., t == step_t)\n mask_S = jnp.arange(seq_len) == step_t\n mask_BSN = jnp.broadcast_to(mask_S[None, :, None], (B, seq_len, N)).astype(\n bool\n )\n masked_token_idxs_BSN = current_token_idxs_BSN * ~mask_BSN\n masked_logits_BSNV = current_logits_BSNV * jnp.expand_dims(~mask_BSN, -1)\n\n # --- Initialize and run MaskGIT loop ---\n init_carry_maskgit = (\n step_rng,\n masked_token_idxs_BSN,\n masked_logits_BSNV,\n mask_BSN,\n action_tokens_EL,\n )\n final_carry_maskgit = maskgit_step_fn(init_carry_maskgit, jnp.arange(steps))\n updated_token_idxs_BSN = final_carry_maskgit[1]\n updated_logits_BSNV = final_carry_maskgit[2]\n new_carry = (rng, updated_token_idxs_BSN, updated_logits_BSNV)\n return new_carry\n\n # --- Run the autoregressive generation using jax.lax.scan ---\n initial_carry = (batch[""rng""], token_idxs_BSN, init_logits_BSNV)\n timesteps_to_scan = jnp.arange(T, seq_len)\n final_carry = generation_step_fn(initial_carry, timesteps_to_scan)\n final_token_idxs_BSN = final_carry[1]\n final_logits_BSNV = final_carry[2]\n\n # --- Decode all tokens at once at the end ---\n H, W = batch[""videos""].shape[2:4]\n final_frames_BSHWC = self.tokenizer.decode(\n final_token_idxs_BSN,\n video_hw=(H, W),\n )\n return final_frames_BSHWC, final_logits_BSNV\n\n def sample_causal(\n self,\n batch: Dict[str, jax.Array],\n seq_len: int,\n temperature: float = 1,\n sample_argmax: bool = False,\n ) -> tuple[jax.Array, jax.Array]:\n """"""\n Autoregressively samples up to `seq_len` future frames, following Figure 8 of the paper.\n\n - Input frames are tokenized once.\n - Future frames are generated autoregressively in token space.\n - All frames are detokenized in a single pass.\n\n Note:\n - For interactive or step-wise sampling, detokenization should occur after each action.\n - To maintain consistent tensor shapes across timesteps, all current and future frames are decoded at every step.\n - Temporal causal structure is preserved by\n a) reapplying the mask before each decoding step.\n b) a temporal causal mask is applied within each ST-transformer block.\n\n Dimension keys:\n B: batch size\n T: number of input (conditioning) frames\n N: number of patches per frame\n M: model dimension\n S: sequence length\n H: height\n W: width\n E: B * (S - 1)\n """"""\n assert isinstance(self.dynamics, DynamicsCausal)\n # --- Encode videos and actions ---\n videos_BTHWC = batch[""videos""]\n tokenizer_out = self.tokenizer.vq_encode(videos_BTHWC, training=False)\n token_idxs_BTN = tokenizer_out[""indices""]\n B, T, N = token_idxs_BTN.shape\n pad_shape = (B, seq_len - T, N)\n pad = jnp.zeros(pad_shape, dtype=token_idxs_BTN.dtype)\n token_idxs_BSN = jnp.concatenate([token_idxs_BTN, pad], axis=1)\n logits_BSNV = jnp.zeros((*token_idxs_BSN.shape, self.num_patch_latents))\n dynamics_state = nnx.state(self.dynamics)\n\n if self.use_gt_actions:\n assert self.action_embed is not None\n latent_actions_BT1L = self.action_embed(batch[""actions""]).reshape(\n *batch[""actions""].shape[:2], 1, self.latent_action_dim\n )\n latent_actions_BTm11L = latent_actions_BT1L[:, 1:]\n action_tokens_EL = latent_actions_BTm11L.reshape(-1, self.latent_action_dim)\n else:\n assert self.lam is not None\n latent_actions_E = batch[""latent_actions""]\n action_tokens_EL = self.lam.vq.get_codes(latent_actions_E)\n\n @nnx.scan(in_axes=(nnx.Carry, 0), out_axes=nnx.Carry)\n def causal_step_fn(\n carry: tuple[jax.Array, jax.Array, jax.Array, jax.Array, jax.Array],\n step_n: jax.Array,\n ) -> tuple[jax.Array, jax.Array, jax.Array, jax.Array, jax.Array]:\n rng, token_idxs_BSN, logits_BSNV, action_tokens_EL, step_t = carry\n S, N = token_idxs_BSN.shape[1:]\n L = action_tokens_EL.shape[-1]\n\n # We need to reconstruct the submodule inside scan body to prevent trace context mismatches\n dynamics_causal = DynamicsCausal(\n model_dim=self.dyna_dim,\n ffn_dim=self.dyna_ffn_dim,\n num_latents=self.num_patch_latents,\n latent_action_dim=self.latent_action_dim,\n num_blocks=self.dyna_num_blocks,\n num_heads=self.dyna_num_heads,\n dropout=self.dropout,\n param_dtype=self.param_dtype,\n dtype=self.dtype,\n use_flash_attention=self.use_flash_attention,\n decode=self.decode,\n rngs=nnx.Rngs(0),\n )\n nnx.update(dynamics_causal, dynamics_state)\n\n # --- Construct + encode video ---\n vid_embed_BSNM = dynamics_causal.patch_embed(token_idxs_BSN)\n\n # --- Predict transition ---\n action_tokens_BSm1L = jnp.reshape(action_tokens_EL, (B, S - 1, L))\n act_embed_BSm1M = dynamics_causal.action_up(action_tokens_BSm1L)\n act_embed_BSM = jnp.pad(act_embed_BSm1M, ((0, 0), (1, 0), (0, 0)))\n act_embed_BS1M = jnp.reshape(\n act_embed_BSM, (B, S, 1, act_embed_BSM.shape[-1])\n )\n vid_embed_BSNp1M = jnp.concatenate([act_embed_BS1M, vid_embed_BSNM], axis=2)\n final_logits_BTNp1V = (\n dynamics_causal.transformer(vid_embed_BSNp1M, (step_t, step_n))\n / temperature\n )\n final_logits_BV = final_logits_BTNp1V[:, step_t, step_n, :]\n\n # --- Sample new tokens for final frame ---\n if sample_argmax:\n sampled_token_idxs_B = jnp.argmax(final_logits_BV, axis=-1)\n else:\n rng, _rng = jax.random.split(rng)\n sampled_token_idxs_B = jax.random.categorical(_rng, final_logits_BV)\n # Update next tokens only\n token_idxs_BSN = token_idxs_BSN.at[:, step_t, step_n].set(\n sampled_token_idxs_B\n )\n logits_BSNV = logits_BSNV.at[:, step_t, step_n].set(final_logits_BV)\n\n new_carry = (rng, token_idxs_BSN, logits_BSNV, action_tokens_EL, step_t)\n return new_carry\n\n @nnx.scan(in_axes=(nnx.Carry, 0), out_axes=nnx.Carry)\n def generation_step_fn(\n carry: tuple[jax.Array, jax.Array, jax.Array], step_t: jax.Array\n ) -> tuple[jax.Array, jax.Array, jax.Array]:\n rng, current_token_idxs_BSN, current_logits_BSNV = carry\n rng, step_rng = jax.random.split(rng)\n\n # --- Initialize and run causal loop ---\n init_carry_causal = (\n step_rng,\n current_token_idxs_BSN,\n current_logits_BSNV,\n action_tokens_EL,\n step_t,\n )\n final_carry_causal = causal_step_fn(init_carry_causal, jnp.arange(N))\n updated_token_idxs_BSN = final_carry_causal[1]\n updated_logits_BSNV = final_carry_causal[2]\n new_carry = (rng, updated_token_idxs_BSN, updated_logits_BSNV)\n return new_carry\n\n # --- Run the autoregressive generation using jax.lax.scan ---\n initial_carry = (batch[""rng""], token_idxs_BSN, logits_BSNV)\n timesteps_to_scan = jnp.arange(T, seq_len)\n final_carry = generation_step_fn(initial_carry, timesteps_to_scan)\n final_token_idxs_BSN = final_carry[1]\n final_logits_BSNV = final_carry[2]\n\n # --- Decode all tokens at once at the end ---\n H, W = batch[""videos""].shape[2:4]\n final_frames_BSHWC = self.tokenizer.decode(\n final_token_idxs_BSN,\n video_hw=(H, W),\n )\n return final_frames_BSHWC, final_logits_BSNV\n\n def vq_encode(self, batch: Dict[str, jax.Array], training: bool) -> jax.Array:\n # --- Preprocess videos ---\n assert self.lam is not None\n video_BTHWC = batch[""videos""]\n lam_output: Dict[str, jax.Array] = self.lam.vq_encode(\n video_BTHWC, training=training\n )\n lam_indices_E = lam_output[""indices""]\n return lam_indices_E\n\n\n# FIXME (f.srambical): add conversion script for old checkpoints\ndef restore_genie_components(\n optimizer: nnx.Optimizer,\n sharding: jax.sharding.NamedSharding,\n rng: jax.Array,\n args,\n) -> nnx.Optimizer:\n """"""Restore pre-trained Genie components""""""\n rng_tokenizer, rng_lam = jax.random.split(rng)\n rngs_tokenizer = nnx.Rngs(rng_tokenizer)\n rngs_lam = nnx.Rngs(rng_lam)\n\n tx = optimizer.tx\n model = optimizer.model\n handler_registry = ocp.handlers.DefaultCheckpointHandlerRegistry()\n handler_registry.add(\n ""model_state"", ocp.args.PyTreeRestore, ocp.handlers.PyTreeCheckpointHandler\n )\n\n checkpoint_options = ocp.CheckpointManagerOptions(\n step_format_fixed_length=6,\n )\n tokenizer_checkpoint_manager = ocp.CheckpointManager(\n directory=args.tokenizer_checkpoint,\n options=checkpoint_options,\n handler_registry=handler_registry,\n )\n dummy_tokenizer = TokenizerVQVAE(\n in_dim=args.image_channels,\n model_dim=args.tokenizer_dim,\n ffn_dim=args.tokenizer_ffn_dim,\n latent_dim=args.latent_patch_dim,\n num_latents=args.num_patch_latents,\n patch_size=args.patch_size,\n num_blocks=args.tokenizer_num_blocks,\n num_heads=args.tokenizer_num_heads,\n dropout=args.dropout,\n codebook_dropout=args.dropout,\n param_dtype=args.param_dtype,\n dtype=args.dtype,\n use_flash_attention=args.use_flash_attention,\n rngs=rngs_tokenizer,\n )\n dummy_tokenizer_optimizer = nnx.Optimizer(dummy_tokenizer, tx)\n dummy_tokenizer_optimizer_state = nnx.state(dummy_tokenizer_optimizer)\n abstract_sharded_tokenizer_optimizer_state = _create_abstract_sharded_pytree(\n dummy_tokenizer_optimizer_state, sharding\n )\n restored_tokenizer = tokenizer_checkpoint_manager.restore(\n step=tokenizer_checkpoint_manager.latest_step(),\n args=ocp.args.Composite(\n model_state=ocp.args.PyTreeRestore( # type: ignore\n abstract_sharded_tokenizer_optimizer_state # type: ignore\n ),\n ),\n )[""model_state""]\n nnx.update(dummy_tokenizer_optimizer.model, restored_tokenizer.model)\n model.tokenizer = dummy_tokenizer_optimizer.model\n tokenizer_checkpoint_manager.close()\n\n if args.lam_checkpoint:\n lam_checkpoint_manager = ocp.CheckpointManager(\n directory=args.lam_checkpoint,\n options=checkpoint_options,\n handler_registry=handler_registry,\n )\n dummy_lam = LatentActionModel(\n in_dim=args.image_channels,\n model_dim=args.lam_dim,\n ffn_dim=args.lam_ffn_dim,\n latent_dim=args.latent_patch_dim,\n num_latents=args.num_latent_actions,\n patch_size=args.lam_patch_size,\n num_blocks=args.lam_num_blocks,\n num_heads=args.lam_num_heads,\n dropout=args.dropout,\n codebook_dropout=args.dropout,\n param_dtype=args.param_dtype,\n dtype=args.dtype,\n use_flash_attention=args.use_flash_attention,\n rngs=rngs_lam,\n )\n dummy_lam_optimizer = nnx.Optimizer(dummy_lam, tx)\n dummy_lam_optimizer_state = nnx.state(dummy_lam_optimizer)\n abstract_sharded_lam_optimizer_state = _create_abstract_sharded_pytree(\n dummy_lam_optimizer_state, sharding\n )\n restored_lam_optimizer = lam_checkpoint_manager.restore(\n step=lam_checkpoint_manager.latest_step(),\n args=ocp.args.Composite(\n model_state=ocp.args.PyTreeRestore( # type: ignore\n abstract_sharded_lam_optimizer_state # type: ignore\n ),\n ),\n )[""model_state""]\n nnx.update(dummy_lam_optimizer.model, restored_lam_optimizer.model)\n model.lam = dummy_lam_optimizer.model\n # Remove the LAM decoder to save memory and avoid unnecessary computation.\n del model.lam.decoder\n lam_checkpoint_manager.close()\n\n # Reinitialize the optimizer states\n optimizer = nnx.Optimizer(model, tx)\n return optimizer\n\n\ndef _create_abstract_sharded_pytree(\n pytree_template: nnx.GraphState, sharding_spec: jax.sharding.NamedSharding\n) -> jax.Array:\n """"""Replaces arrays in a pytree with ShapeDtypeStructs having the given sharding.""""""\n\n def map_fn(leaf_template):\n if hasattr(leaf_template, ""shape"") and hasattr(leaf_template, ""dtype""):\n return jax.ShapeDtypeStruct(\n leaf_template.shape, leaf_template.dtype, sharding=sharding_spec\n )\n return leaf_template\n\n return jax.tree_util.tree_map(map_fn, pytree_template)\n",python,tab
60
+ 59,114957,"genie.py",6515,0,"",python,selection_command
61
+ 60,115115,"genie.py",6491,0,"",python,selection_command
62
+ 61,115260,"genie.py",6477,0,"",python,selection_command
63
+ 62,115408,"genie.py",6418,0,"",python,selection_command
64
+ 63,115541,"genie.py",6382,0,"",python,selection_command
65
+ 64,115707,"genie.py",6347,0,"",python,selection_command
66
+ 65,115869,"genie.py",6297,0,"",python,selection_command
67
+ 66,116082,"genie.py",6243,0,"",python,selection_command
68
+ 67,116355,"genie.py",6199,0,"",python,selection_command
69
+ 68,116377,"genie.py",6124,0,"",python,selection_command
70
+ 69,116437,"genie.py",6084,0,"",python,selection_command
71
+ 70,116437,"genie.py",6070,0,"",python,selection_command
72
+ 71,116522,"genie.py",6001,0,"",python,selection_command
73
+ 72,116523,"genie.py",5987,0,"",python,selection_command
74
+ 73,116550,"genie.py",5916,0,"",python,selection_command
75
+ 74,116880,"genie.py",5834,0,"",python,selection_command
76
+ 75,116880,"genie.py",5798,0,"",python,selection_command
77
+ 76,116880,"genie.py",5749,0,"",python,selection_command
78
+ 77,116880,"genie.py",5717,0,"",python,selection_command
79
+ 78,116930,"genie.py",5677,0,"",python,selection_command
80
+ 79,116931,"genie.py",5640,0,"",python,selection_command
81
+ 80,116932,"genie.py",5583,0,"",python,selection_command
82
+ 81,116946,"genie.py",5500,0,"",python,selection_command
83
+ 82,116946,"genie.py",5461,0,"",python,selection_command
84
+ 83,116947,"genie.py",5430,0,"",python,selection_command
85
+ 84,116949,"genie.py",5399,0,"",python,selection_command
86
+ 85,117025,"genie.py",5362,0,"",python,selection_command
87
+ 86,117026,"genie.py",5348,0,"",python,selection_command
88
+ 87,117042,"genie.py",5330,0,"",python,selection_command
89
+ 88,117081,"genie.py",5348,0,"",python,selection_command
90
+ 89,117331,"genie.py",5362,0,"",python,selection_command
91
+ 90,117362,"genie.py",5399,0,"",python,selection_command
92
+ 91,117392,"genie.py",5430,0,"",python,selection_command
93
+ 92,117432,"genie.py",5461,0,"",python,selection_command
94
+ 93,117469,"genie.py",5500,0,"",python,selection_command
95
+ 94,117498,"genie.py",5583,0,"",python,selection_command
96
+ 95,117537,"genie.py",5640,0,"",python,selection_command
97
+ 96,117576,"genie.py",5677,0,"",python,selection_command
98
+ 97,117595,"genie.py",5717,0,"",python,selection_command
99
+ 98,117624,"genie.py",5749,0,"",python,selection_command
100
+ 99,117683,"genie.py",5798,0,"",python,selection_command
101
+ 100,117784,"genie.py",5834,0,"",python,selection_command
102
+ 101,117945,"genie.py",5916,0,"",python,selection_command
103
+ 102,118090,"genie.py",5987,0,"",python,selection_command
104
+ 103,118254,"genie.py",6001,0,"",python,selection_command
105
+ 104,120169,"genie.py",6004,0,"",python,selection_command
106
+ 105,120429,"genie.py",6029,0,"",python,selection_command
107
+ 106,120442,"genie.py",6031,0,"",python,selection_command
108
+ 107,120491,"genie.py",6053,0,"",python,selection_command
109
+ 108,120599,"genie.py",6057,0,"",python,selection_command
110
+ 109,121234,"genie.py",6058,0,"",python,selection_command
111
+ 110,121234,"genie.py",6069,0,"",python,selection_command
112
+ 111,121235,"genie.py",6073,0,"",python,selection_command
113
+ 112,121236,"genie.py",6087,0,"",python,selection_command
114
+ 113,121237,"genie.py",6094,0,"",python,selection_command
115
+ 114,121237,"genie.py",6087,0,"",python,selection_command
116
+ 115,121251,"genie.py",6073,0,"",python,selection_command
117
+ 116,121396,"genie.py",6069,0,"",python,selection_command
118
+ 117,121561,"genie.py",6058,0,"",python,selection_command
119
+ 118,121690,"genie.py",6057,0,"",python,selection_command
120
+ 119,123571,"genie.py",6057,1,"",python,content
121
+ 120,124098,"genie.py",6058,0,"",python,selection_command
122
+ 121,125149,"genie.py",6058,0,"-1",python,content
123
+ 122,125340,"genie.py",6059,0,"",python,selection_command
124
+ 123,126410,"genie.py",6057,0,"",python,selection_command
125
+ 124,126664,"genie.py",6053,0,"",python,selection_command
126
+ 125,126682,"genie.py",6031,0,"",python,selection_command
127
+ 126,126710,"genie.py",6029,0,"",python,selection_command
128
+ 127,126750,"genie.py",6004,0,"",python,selection_command
129
+ 128,126790,"genie.py",5990,0,"",python,selection_command
130
+ 129,126840,"genie.py",5960,0,"",python,selection_command
131
+ 130,127219,"genie.py",5990,0,"",python,selection_command
132
+ 131,127361,"genie.py",6004,0,"",python,selection_command
133
+ 132,135940,"genie.py",5990,0,"",python,selection_command
134
+ 133,136197,"genie.py",5919,0,"",python,selection_command
135
+ 134,136197,"genie.py",5837,0,"",python,selection_command
136
+ 135,136218,"genie.py",5801,0,"",python,selection_command
137
+ 136,136276,"genie.py",5752,0,"",python,selection_command
138
+ 137,136437,"genie.py",5801,0,"",python,selection_command
139
+ 138,136588,"genie.py",5837,0,"",python,selection_command
140
+ 139,144029,"genie.py",5824,0,"\n ",python,content
141
+ 140,145007,"genie.py",5837,0,"#",python,content
142
+ 141,145007,"genie.py",5838,0,"",python,selection_keyboard
143
+ 142,145008,"genie.py",5838,0," ",python,content
144
+ 143,145009,"genie.py",5839,0,"",python,selection_keyboard
145
+ 144,145049,"genie.py",5839,0,"b",python,content
146
+ 145,145049,"genie.py",5840,0,"",python,selection_keyboard
147
+ 146,145334,"genie.py",5840,0,"a",python,content
148
+ 147,145334,"genie.py",5841,0,"",python,selection_keyboard
149
+ 148,145335,"genie.py",5841,0,"t",python,content
150
+ 149,145335,"genie.py",5842,0,"",python,selection_keyboard
151
+ 150,145529,"genie.py",5842,0,"c",python,content
152
+ 151,145529,"genie.py",5843,0,"",python,selection_keyboard
153
+ 152,145672,"genie.py",5843,0,"h",python,content
154
+ 153,145672,"genie.py",5844,0,"",python,selection_keyboard
155
+ 154,146706,"genie.py",5844,0,"[]",python,content
156
+ 155,146706,"genie.py",5845,0,"",python,selection_keyboard
157
+ 156,148047,"genie.py",5845,0,"""""",python,content
158
+ 157,148048,"genie.py",5846,0,"",python,selection_keyboard
159
+ 158,148719,"genie.py",5846,0,"a",python,content
160
+ 159,148719,"genie.py",5847,0,"",python,selection_keyboard
161
+ 160,148759,"genie.py",5847,0,"c",python,content
162
+ 161,148759,"genie.py",5848,0,"",python,selection_keyboard
163
+ 162,148913,"genie.py",5848,0,"t",python,content
164
+ 163,148913,"genie.py",5849,0,"",python,selection_keyboard
165
+ 164,149086,"genie.py",5849,0,"i",python,content
166
+ 165,149087,"genie.py",5850,0,"",python,selection_keyboard
167
+ 166,149127,"genie.py",5850,0,"o",python,content
168
+ 167,149127,"genie.py",5851,0,"",python,selection_keyboard
169
+ 168,149379,"genie.py",5851,0,"n",python,content
170
+ 169,149379,"genie.py",5852,0,"",python,selection_keyboard
171
+ 170,149610,"genie.py",5852,0,"s",python,content
172
+ 171,149611,"genie.py",5853,0,"",python,selection_keyboard
173
+ 172,149690,"genie.py",5853,0," ",python,content
174
+ 173,149690,"genie.py",5854,0,"",python,selection_keyboard
175
+ 174,150011,"genie.py",5853,1,"",python,content
176
+ 175,150849,"genie.py",5852,0,"",python,selection_command
177
+ 176,151228,"genie.py",5855,0,"",python,selection_command
178
+ 177,151448,"genie.py",5855,0," ",python,content
179
+ 178,151448,"genie.py",5856,0,"",python,selection_keyboard
180
+ 179,151474,"genie.py",5856,0,"i",python,content
181
+ 180,151474,"genie.py",5857,0,"",python,selection_keyboard
182
+ 181,151554,"genie.py",5857,0,"s",python,content
183
+ 182,151554,"genie.py",5858,0,"",python,selection_keyboard
184
+ 183,151675,"genie.py",5858,0," ",python,content
185
+ 184,151675,"genie.py",5859,0,"",python,selection_keyboard
186
+ 185,151738,"genie.py",5859,0,"t",python,content
187
+ 186,151738,"genie.py",5860,0,"",python,selection_keyboard
188
+ 187,151812,"genie.py",5860,0,"h",python,content
189
+ 188,151812,"genie.py",5861,0,"",python,selection_keyboard
190
+ 189,151968,"genie.py",5861,0,"e",python,content
191
+ 190,151968,"genie.py",5862,0,"",python,selection_keyboard
192
+ 191,152050,"genie.py",5862,0," ",python,content
193
+ 192,152050,"genie.py",5863,0,"",python,selection_keyboard
194
+ 193,152197,"genie.py",5863,0,"a",python,content
195
+ 194,152197,"genie.py",5864,0,"",python,selection_keyboard
196
+ 195,152284,"genie.py",5864,0,"c",python,content
197
+ 196,152284,"genie.py",5865,0,"",python,selection_keyboard
198
+ 197,152472,"genie.py",5865,0,"t",python,content
199
+ 198,152473,"genie.py",5866,0,"",python,selection_keyboard
200
+ 199,152565,"genie.py",5866,0,"i",python,content
201
+ 200,152566,"genie.py",5867,0,"",python,selection_keyboard
202
+ 201,152567,"genie.py",5867,0,"o",python,content
203
+ 202,152567,"genie.py",5868,0,"",python,selection_keyboard
204
+ 203,152734,"genie.py",5868,0,"n",python,content
205
+ 204,152734,"genie.py",5869,0,"",python,selection_keyboard
206
+ 205,152798,"genie.py",5869,0,"m",python,content
207
+ 206,152798,"genie.py",5870,0,"",python,selection_keyboard
208
+ 207,152958,"genie.py",5870,0," ",python,content
209
+ 208,152959,"genie.py",5871,0,"",python,selection_keyboard
210
+ 209,153428,"genie.py",5870,1,"",python,content
211
+ 210,153552,"genie.py",5869,1,"",python,content
212
+ 211,153720,"genie.py",5869,0," ",python,content
213
+ 212,153720,"genie.py",5870,0,"",python,selection_keyboard
214
+ 213,156737,"genie.py",5863,7,"",python,content
215
+ 214,156892,"genie.py",5859,4,"",python,content
216
+ 215,157027,"genie.py",5856,3,"",python,content
217
+ 216,157253,"genie.py",5856,0,"a",python,content
218
+ 217,157254,"genie.py",5857,0,"",python,selection_keyboard
219
+ 218,157273,"genie.py",5857,0,"r",python,content
220
+ 219,157273,"genie.py",5858,0,"",python,selection_keyboard
221
+ 220,157326,"genie.py",5858,0,"e",python,content
222
+ 221,157326,"genie.py",5859,0,"",python,selection_keyboard
223
+ 222,157492,"genie.py",5859,0," ",python,content
224
+ 223,157493,"genie.py",5860,0,"",python,selection_keyboard
225
+ 224,157543,"genie.py",5860,0,"t",python,content
226
+ 225,157544,"genie.py",5861,0,"",python,selection_keyboard
227
+ 226,158123,"genie.py",5860,1,"",python,content
228
+ 227,158294,"genie.py",5856,4,"",python,content
229
+ 228,159752,"genie.py",5855,1,"",python,content
230
+ 229,160153,"genie.py",5855,0,"_",python,content
231
+ 230,160154,"genie.py",5856,0,"",python,selection_keyboard
232
+ 231,160486,"genie.py",5856,0,"]",python,content
233
+ 232,160487,"genie.py",5857,0,"",python,selection_keyboard
234
+ 233,160881,"genie.py",5856,1,"",python,content
235
+ 234,160919,"genie.py",5856,0,"t",python,content
236
+ 235,160919,"genie.py",5857,0,"",python,selection_keyboard
237
+ 236,161054,"genie.py",5857,0," ",python,content
238
+ 237,161054,"genie.py",5858,0,"",python,selection_keyboard
239
+ 238,162015,"genie.py",5858,0,"i",python,content
240
+ 239,162016,"genie.py",5859,0,"",python,selection_keyboard
241
+ 240,162081,"genie.py",5859,0,"s",python,content
242
+ 241,162082,"genie.py",5860,0,"",python,selection_keyboard
243
+ 242,162251,"genie.py",5860,0," ",python,content
244
+ 243,162251,"genie.py",5861,0,"",python,selection_keyboard
245
+ 244,162252,"genie.py",5861,0,"t",python,content
246
+ 245,162252,"genie.py",5862,0,"",python,selection_keyboard
247
+ 246,162286,"genie.py",5862,0,"h",python,content
248
+ 247,162287,"genie.py",5863,0,"",python,selection_keyboard
249
+ 248,162359,"genie.py",5863,0,"e",python,content
250
+ 249,162359,"genie.py",5864,0,"",python,selection_keyboard
251
+ 250,162509,"genie.py",5864,0," ",python,content
252
+ 251,162510,"genie.py",5865,0,"",python,selection_keyboard
253
+ 252,163511,"genie.py",5865,0,"a",python,content
254
+ 253,163511,"genie.py",5866,0,"",python,selection_keyboard
255
+ 254,163512,"genie.py",5866,0,"c",python,content
256
+ 255,163512,"genie.py",5867,0,"",python,selection_keyboard
257
+ 256,163853,"genie.py",5867,0,"t",python,content
258
+ 257,163853,"genie.py",5868,0,"",python,selection_keyboard
259
+ 258,164100,"genie.py",5868,0,"o",python,content
260
+ 259,164100,"genie.py",5869,0,"",python,selection_keyboard
261
+ 260,164266,"genie.py",5869,0,"n",python,content
262
+ 261,164266,"genie.py",5870,0,"",python,selection_keyboard
263
+ 262,164801,"genie.py",5869,1,"",python,content
264
+ 263,164923,"genie.py",5868,1,"",python,content
265
+ 264,165399,"genie.py",5868,0,"i",python,content
266
+ 265,165399,"genie.py",5869,0,"",python,selection_keyboard
267
+ 266,165591,"genie.py",5869,0,"o",python,content
268
+ 267,165592,"genie.py",5870,0,"",python,selection_keyboard
269
+ 268,165677,"genie.py",5870,0,"n",python,content
270
+ 269,165677,"genie.py",5871,0,"",python,selection_keyboard
271
+ 270,165944,"genie.py",5871,0," ",python,content
272
+ 271,165944,"genie.py",5872,0,"",python,selection_keyboard
273
+ 272,166953,"genie.py",5872,0,"t",python,content
274
+ 273,166954,"genie.py",5873,0,"",python,selection_keyboard
275
+ 274,166991,"genie.py",5873,0,"a",python,content
276
+ 275,166991,"genie.py",5874,0,"",python,selection_keyboard
277
+ 276,167061,"genie.py",5874,0,"k",python,content
278
+ 277,167062,"genie.py",5875,0,"",python,selection_keyboard
279
+ 278,167181,"genie.py",5875,0,"e",python,content
280
+ 279,167182,"genie.py",5876,0,"",python,selection_keyboard
281
+ 280,167301,"genie.py",5876,0,"n",python,content
282
+ 281,167302,"genie.py",5877,0,"",python,selection_keyboard
283
+ 282,167523,"genie.py",5877,0," ",python,content
284
+ 283,167524,"genie.py",5878,0,"",python,selection_keyboard
285
+ 284,167949,"genie.py",5878,0,"a",python,content
286
+ 285,167949,"genie.py",5879,0,"",python,selection_keyboard
287
+ 286,167961,"genie.py",5879,0,"f",python,content
288
+ 287,167961,"genie.py",5880,0,"",python,selection_keyboard
289
+ 288,168121,"genie.py",5880,0,"t",python,content
290
+ 289,168121,"genie.py",5881,0,"",python,selection_keyboard
291
+ 290,168212,"genie.py",5881,0,"e",python,content
292
+ 291,168213,"genie.py",5882,0,"",python,selection_keyboard
293
+ 292,168312,"genie.py",5882,0,"r",python,content
294
+ 293,168312,"genie.py",5883,0,"",python,selection_keyboard
295
+ 294,168612,"genie.py",5883,0," ",python,content
296
+ 295,168613,"genie.py",5884,0,"",python,selection_keyboard
297
+ 296,169811,"genie.py",5884,0,"o",python,content
298
+ 297,169812,"genie.py",5885,0,"",python,selection_keyboard
299
+ 298,169879,"genie.py",5885,0,"b",python,content
300
+ 299,169880,"genie.py",5886,0,"",python,selection_keyboard
301
+ 300,169981,"genie.py",5886,0,"s",python,content
302
+ 301,169981,"genie.py",5887,0,"",python,selection_keyboard
303
+ 302,170511,"genie.py",5886,1,"",python,content
304
+ 303,170639,"genie.py",5885,1,"",python,content
305
+ 304,170881,"genie.py",5884,1,"",python,content
306
+ 305,176231,"genie.py",5884,0,"o",python,content
307
+ 306,176232,"genie.py",5885,0,"",python,selection_keyboard
308
+ 307,176455,"genie.py",5885,0,"s",python,content
309
+ 308,176456,"genie.py",5886,0,"",python,selection_keyboard
310
+ 309,176765,"genie.py",5885,1,"",python,content
311
+ 310,176807,"genie.py",5885,0,"b",python,content
312
+ 311,176808,"genie.py",5886,0,"",python,selection_keyboard
313
+ 312,176808,"genie.py",5886,0,"s",python,content
314
+ 313,176808,"genie.py",5887,0,"",python,selection_keyboard
315
+ 314,177200,"genie.py",5887,0,"_",python,content
316
+ 315,177200,"genie.py",5888,0,"",python,selection_keyboard
317
+ 316,177476,"genie.py",5888,0,"t",python,content
318
+ 317,177476,"genie.py",5889,0,"",python,selection_keyboard
319
+ 318,177716,"genie.py",5888,0,"",python,selection_command
320
+ 319,178904,"genie.py",5953,0,"",python,selection_command
321
+ 320,179166,"genie.py",6035,0,"",python,selection_command
322
+ 321,179220,"genie.py",6055,0,"",python,selection_command
323
+ 322,179247,"genie.py",6120,0,"",python,selection_command
324
+ 323,179255,"genie.py",6139,0,"",python,selection_command
325
+ 324,179391,"genie.py",6179,0,"",python,selection_command
326
+ 325,179571,"genie.py",6244,0,"",python,selection_command
327
+ 326,179703,"genie.py",6298,0,"",python,selection_command
328
+ 327,179885,"genie.py",6352,0,"",python,selection_command
329
+ 328,180017,"genie.py",6402,0,"",python,selection_command
330
+ 329,180183,"genie.py",6437,0,"",python,selection_command
331
+ 330,180334,"genie.py",6473,0,"",python,selection_command
332
+ 331,180593,"genie.py",6532,0,"",python,selection_command
333
+ 332,180718,"genie.py",6546,0,"",python,selection_command
334
+ 333,182488,"genie.py",6532,0,"",python,selection_command
335
+ 334,182603,"genie.py",6473,0,"",python,selection_command
336
+ 335,182752,"genie.py",6437,0,"",python,selection_command
337
+ 336,182903,"genie.py",6402,0,"",python,selection_command
338
+ 337,183273,"genie.py",6398,0,"",python,selection_command
339
+ 338,183427,"genie.py",6397,0,"",python,selection_command
340
+ 339,183629,"genie.py",6394,0,"",python,selection_command
341
+ 340,183747,"genie.py",6393,0,"",python,selection_command
342
+ 341,183895,"genie.py",6390,0,"",python,selection_command
343
+ 342,184078,"genie.py",6388,0,"",python,selection_command
344
+ 343,184268,"genie.py",6366,0,"",python,selection_command
345
+ 344,189814,"genie.py",6312,0,"",python,selection_command
346
+ 345,191380,"genie.py",6268,0,"",python,selection_command
347
+ 346,196191,"genie.py",6193,0,"",python,selection_command
348
+ 347,196449,"genie.py",6153,0,"",python,selection_command
349
+ 348,196475,"genie.py",6139,0,"",python,selection_command
350
+ 349,196500,"genie.py",6069,0,"",python,selection_command
351
+ 350,196541,"genie.py",6055,0,"",python,selection_command
352
+ 351,196660,"genie.py",5984,0,"",python,selection_command
353
+ 352,196819,"genie.py",5902,0,"",python,selection_command
354
+ 353,196996,"genie.py",5837,0,"",python,selection_command
355
+ 354,197407,"genie.py",5839,0,"",python,selection_command
356
+ 355,201357,"genie.py",5839,1,"b",python,selection_command
357
+ 356,201387,"genie.py",5839,5,"batch",python,selection_command
358
+ 357,201698,"genie.py",5839,7,"batch[""",python,selection_command
359
+ 358,201938,"genie.py",5839,14,"batch[""actions",python,selection_command
360
+ 359,202038,"genie.py",5839,16,"batch[""actions""]",python,selection_command
361
+ 360,213440,"genie.py",5839,16,"",python,content
362
+ 361,213854,"genie.py",5839,0,"c",python,content
363
+ 362,213854,"genie.py",5840,0,"",python,selection_keyboard
364
+ 363,213854,"genie.py",5840,0,"a",python,content
365
+ 364,213855,"genie.py",5841,0,"",python,selection_keyboard
366
+ 365,214678,"genie.py",5840,1,"",python,content
367
+ 366,214680,"genie.py",5839,1,"",python,content
368
+ 367,214682,"genie.py",5839,0,"a",python,content
369
+ 368,214682,"genie.py",5840,0,"",python,selection_keyboard
370
+ 369,214742,"genie.py",5840,0,"c",python,content
371
+ 370,214743,"genie.py",5841,0,"",python,selection_keyboard
372
+ 371,215009,"genie.py",5841,0,"t",python,content
373
+ 372,215010,"genie.py",5842,0,"",python,selection_keyboard
374
+ 373,215173,"genie.py",5842,0,"o",python,content
375
+ 374,215174,"genie.py",5843,0,"",python,selection_keyboard
376
+ 375,215257,"genie.py",5843,0,"i",python,content
377
+ 376,215257,"genie.py",5844,0,"",python,selection_keyboard
378
+ 377,215258,"genie.py",5844,0,"n",python,content
379
+ 378,215258,"genie.py",5845,0,"",python,selection_keyboard
380
+ 379,215923,"genie.py",5844,1,"",python,content
381
+ 380,216055,"genie.py",5843,1,"",python,content
382
+ 381,216200,"genie.py",5842,1,"",python,content
383
+ 382,216201,"genie.py",5842,0,"i",python,content
384
+ 383,216201,"genie.py",5843,0,"",python,selection_keyboard
385
+ 384,216282,"genie.py",5843,0,"o",python,content
386
+ 385,216282,"genie.py",5844,0,"",python,selection_keyboard
387
+ 386,216433,"genie.py",5844,0,"n",python,content
388
+ 387,216433,"genie.py",5845,0,"",python,selection_keyboard
389
+ 388,217001,"genie.py",5845,0,"_",python,content
390
+ 389,217001,"genie.py",5846,0,"",python,selection_keyboard
391
+ 390,217565,"genie.py",5846,0,"e",python,content
392
+ 391,217565,"genie.py",5847,0,"",python,selection_keyboard
393
+ 392,217645,"genie.py",5847,0,"m",python,content
394
+ 393,217646,"genie.py",5848,0,"",python,selection_keyboard
395
+ 394,217722,"genie.py",5848,0,"b",python,content
396
+ 395,217722,"genie.py",5849,0,"",python,selection_keyboard
397
+ 396,218003,"genie.py",5849,0,"e",python,content
398
+ 397,218003,"genie.py",5850,0,"",python,selection_keyboard
399
+ 398,218169,"genie.py",5850,0,"d",python,content
400
+ 399,218169,"genie.py",5851,0,"",python,selection_keyboard
401
+ 400,218253,"genie.py",5851,0,"d",python,content
402
+ 401,218253,"genie.py",5852,0,"",python,selection_keyboard
403
+ 402,218574,"genie.py",5852,0,"i",python,content
404
+ 403,218574,"genie.py",5853,0,"",python,selection_keyboard
405
+ 404,218615,"genie.py",5853,0,"n",python,content
406
+ 405,218616,"genie.py",5854,0,"",python,selection_keyboard
407
+ 406,218616,"genie.py",5854,0,"g",python,content
408
+ 407,218617,"genie.py",5855,0,"",python,selection_keyboard
409
+ 408,218617,"genie.py",5855,0,"s",python,content
410
+ 409,218618,"genie.py",5856,0,"",python,selection_keyboard
411
+ 410,219359,"genie.py",5855,0,"",python,selection_command
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-5a3b8659-d0db-42f5-b7dd-d3e2e64a98251765453543132-2025_12_11-12.45.54.617/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-6019fd0d-d2bb-47ee-aa7f-11a5c7ace2751762763426783-2025_11_10-09.30.33.347/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-611269b4-0e84-4c9e-bf1f-977615101d0f1757099205038-2025_09_05-21.06.50.975/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-6330439a-d206-4c7d-817f-c11b7dcf713d1765893327719-2025_12_16-14.55.41.665/source.csv ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,2,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"./target/release/crowd-pilot-serialize --csv-root= --output-dir=test_output_dir --tokenizer=""Qwen/Qwen3-8B""",shellscript,tab
3
+ 2,188,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"2:55:41 PM [info] Activating crowd-code\n2:55:41 PM [info] Recording started\n2:55:41 PM [info] Initializing git provider using file system watchers...\n",Log,tab
4
+ 3,278,"extension-output-pdoom-org.crowd-code-#1-crowd-code",150,0,"2:55:41 PM [info] Git repository found\n2:55:41 PM [info] Git provider initialized successfully\n2:55:41 PM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,900,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"",shellscript,tab
6
+ 5,1171,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
7
+ 6,3631,"TERMINAL",0,0,"",,terminal_focus
8
+ 7,3632,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"",shellscript,tab
9
+ 8,50770,"TERMINAL",0,0,"source .venv/bin/activate",,terminal_command
10
+ 9,55125,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,107,"./target/release/crowd-pilot-serialize --csv-root= --output-dir=test_output_dir --tokenizer=""Qwen/Qwen3-8B""",shellscript,selection_command
11
+ 10,55761,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",42,0,"",shellscript,selection_command
12
+ 11,91839,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",0,0,"#!/bin/bash\n\nset -uex\n\nOUTPUT_DIR=""/fast/project/HFMI_SynergyUnit/tab_model/data/nemo_hf_part_jsonl_4k_tokens/""\nCSV_ROOT=""/fast/project/HFMI_SynergyUnit/tab_model/data/hf_part_csv/""\n\nMAX_TOKENS_PER_CONVERSATION=4096\nTOKENIZER_MODEL=""Qwen/Qwen3-Coder-30B-A3B-Instruct""\n\nuv run crowd_pilot/serialize_dataset_nemo_json.py --csv_root=$CSV_ROOT --output_dir=$OUTPUT_DIR --max_tokens_per_conversation=$MAX_TOKENS_PER_CONVERSATION --tokenizer_model=$TOKENIZER_MODEL",shellscript,tab
13
+ 12,92928,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",12,0,"",shellscript,selection_command
14
+ 13,93159,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",13,0,"",shellscript,selection_command
15
+ 14,93216,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",22,0,"",shellscript,selection_command
16
+ 15,93229,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",23,0,"",shellscript,selection_command
17
+ 16,93258,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",112,0,"",shellscript,selection_command
18
+ 17,93290,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",182,0,"",shellscript,selection_command
19
+ 18,93326,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",183,0,"",shellscript,selection_command
20
+ 19,93356,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",216,0,"",shellscript,selection_command
21
+ 20,93393,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",268,0,"",shellscript,selection_command
22
+ 21,93757,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",216,0,"",shellscript,selection_command
23
+ 22,93918,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",183,0,"",shellscript,selection_command
24
+ 23,94010,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",182,0,"",shellscript,selection_command
25
+ 24,94260,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",112,0,"",shellscript,selection_command
26
+ 25,94496,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",120,0,"",shellscript,selection_command
27
+ 26,94653,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",123,0,"",shellscript,selection_command
28
+ 27,95015,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",122,0,"",shellscript,selection_command
29
+ 28,95253,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,0,"",shellscript,selection_command
30
+ 29,95385,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,1,"""",shellscript,selection_command
31
+ 30,95615,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,2,"""/",shellscript,selection_command
32
+ 31,95875,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,6,"""/fast",shellscript,selection_command
33
+ 32,95877,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,7,"""/fast/",shellscript,selection_command
34
+ 33,95918,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,14,"""/fast/project",shellscript,selection_command
35
+ 34,95935,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,15,"""/fast/project/",shellscript,selection_command
36
+ 35,95975,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,31,"""/fast/project/HFMI_SynergyUnit",shellscript,selection_command
37
+ 36,96004,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,32,"""/fast/project/HFMI_SynergyUnit/",shellscript,selection_command
38
+ 37,96042,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,41,"""/fast/project/HFMI_SynergyUnit/tab_model",shellscript,selection_command
39
+ 38,96074,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,42,"""/fast/project/HFMI_SynergyUnit/tab_model/",shellscript,selection_command
40
+ 39,96101,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,46,"""/fast/project/HFMI_SynergyUnit/tab_model/data",shellscript,selection_command
41
+ 40,96147,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,47,"""/fast/project/HFMI_SynergyUnit/tab_model/data/",shellscript,selection_command
42
+ 41,96922,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",121,60,"""/fast/project/HFMI_SynergyUnit/tab_model/data/hf_part_csv/""",shellscript,selection_command
43
+ 42,97396,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/nemo/dataset/hf_part/generate_jsonl_qwen_4k.sh",180,0,"",shellscript,selection_command
44
+ 43,98174,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"",shellscript,tab
45
+ 44,99093,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",43,0,"",shellscript,selection_command
46
+ 45,99214,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",44,0,"",shellscript,selection_command
47
+ 46,99419,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",48,0,"",shellscript,selection_command
48
+ 47,99673,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",49,0,"",shellscript,selection_command
49
+ 48,100021,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",50,0,"",shellscript,selection_command
50
+ 49,100269,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",50,0,"""/fast/project/HFMI_SynergyUnit/tab_model/data/hf_part_csv/""",shellscript,content
51
+ 50,100269,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",110,0,"",shellscript,selection_keyboard
52
+ 51,100623,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",109,0,"",shellscript,selection_command
53
+ 52,102256,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",111,0,"",shellscript,selection_command
54
+ 53,102405,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",113,0,"",shellscript,selection_command
55
+ 54,102656,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",119,0,"",shellscript,selection_command
56
+ 55,102706,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",120,0,"",shellscript,selection_command
57
+ 56,102706,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",123,0,"",shellscript,selection_command
58
+ 57,102748,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",124,0,"",shellscript,selection_command
59
+ 58,102770,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",140,0,"",shellscript,selection_command
60
+ 59,102807,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",142,0,"",shellscript,selection_command
61
+ 60,102841,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",151,0,"",shellscript,selection_command
62
+ 61,102873,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",153,0,"",shellscript,selection_command
63
+ 62,103378,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",157,0,"",shellscript,selection_command
64
+ 63,103620,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",158,0,"",shellscript,selection_command
65
+ 64,103661,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",163,0,"",shellscript,selection_command
66
+ 65,103937,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"",shellscript,selection_command
67
+ 66,105936,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,167,"./target/release/crowd-pilot-serialize --csv-root=""/fast/project/HFMI_SynergyUnit/tab_model/data/hf_part_csv/"" --output-dir=test_output_dir --tokenizer=""Qwen/Qwen3-8B""",shellscript,selection_command
68
+ 67,106299,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"",shellscript,selection_command
69
+ 68,108656,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,167,"./target/release/crowd-pilot-serialize --csv-root=""/fast/project/HFMI_SynergyUnit/tab_model/data/hf_part_csv/"" --output-dir=test_output_dir --tokenizer=""Qwen/Qwen3-8B""",shellscript,selection_command
70
+ 69,109026,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"",shellscript,selection_command
71
+ 70,111248,"TERMINAL",0,0,"./target/release/crowd-pilot-serialize --csv-root=""/fast/project/HFMI_SynergyUnit/tab_model/data/hf_part_csv/"" --output-dir=test_output_dir --tokenizer=""Qwen/Qwen3-8B""",,terminal_command
72
+ 71,111271,"TERMINAL",0,0,"]633;C./target/release/crowd-pilot-serialize: error while loading shared libraries: libpython3.12.so.1.0: cannot open shared object file: No such file or directory\r\n]0;franz.srambical@hai-login1:~/crowd-pilot-serializer",,terminal_output
73
+ 72,187595,"TERMINAL",0,0,"export LD_LIBRARY_PATH=$(python -c ""import sysconfig; print(sysconfig.get_config_var('LIBDIR'))""):$LD_LIBRARY_PATH",,terminal_command
74
+ 73,187603,"TERMINAL",0,0,"]633;C]0;franz.srambical@hai-login1:~/crowd-pilot-serializer",,terminal_output
75
+ 74,196113,"TERMINAL",0,0,"./target/release/crowd-pilot-serialize --csv-root=""/fast/project/HFMI_SynergyUnit/tab_model/data/hf_part_csv/"" --output-dir=test_output_dir --tokenizer=""Qwen/Qwen3-8B""",,terminal_command
76
+ 75,196175,"TERMINAL",0,0,"]633;CLoading tokenizer from Qwen/Qwen3-8B...\r\n",,terminal_output
77
+ 76,200648,"TERMINAL",0,0,"None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.\r\n",,terminal_output
78
+ 77,203228,"TERMINAL",0,0,"Processing CSV files from ""/fast/project/HFMI_SynergyUnit/tab_model/data/hf_part_csv/""...\r\n",,terminal_output
79
+ 78,203480,"TERMINAL",0,0,"\r\nthread 'main' (1304444) panicked at /fast/home/franz.srambical/crowd-pilot-serializer/crates/core/src/pipeline.rs:130:48:\r\ncontent event missing Text\r\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\r\n]0;franz.srambical@hai-login1:~/crowd-pilot-serializer",,terminal_output
80
+ 79,210640,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"\n",shellscript,content
81
+ 80,211143,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"export LD_LIBRARY_PATH=$(python -c ""import sysconfig; print(sysconfig.get_config_var('LIBDIR'))""):$LD_LIBRARY_PATH",shellscript,content
82
+ 81,211143,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",114,0,"",shellscript,selection_keyboard
83
+ 82,211592,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",113,0,"",shellscript,selection_command
84
+ 83,212981,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"",shellscript,selection_command
85
+ 84,218210,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"\n",shellscript,content
86
+ 85,218576,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",0,0,"s",shellscript,content
87
+ 86,218576,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",1,0,"",shellscript,selection_keyboard
88
+ 87,218622,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",1,0,"o",shellscript,content
89
+ 88,218622,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",2,0,"",shellscript,selection_keyboard
90
+ 89,218627,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",2,0,"u",shellscript,content
91
+ 90,218627,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",3,0,"",shellscript,selection_keyboard
92
+ 91,218676,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",3,0,"r",shellscript,content
93
+ 92,218676,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",4,0,"",shellscript,selection_keyboard
94
+ 93,219132,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",4,0,"c",shellscript,content
95
+ 94,219132,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",5,0,"",shellscript,selection_keyboard
96
+ 95,219342,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",5,0,"e",shellscript,content
97
+ 96,219342,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",6,0,"",shellscript,selection_keyboard
98
+ 97,219494,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",6,0," ",shellscript,content
99
+ 98,219494,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",7,0,"",shellscript,selection_keyboard
100
+ 99,219642,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",7,0,".",shellscript,content
101
+ 100,219642,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",8,0,"",shellscript,selection_keyboard
102
+ 101,219666,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",8,0,"v",shellscript,content
103
+ 102,219666,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",9,0,"",shellscript,selection_keyboard
104
+ 103,219879,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",9,0,"e",shellscript,content
105
+ 104,219879,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",10,0,"",shellscript,selection_keyboard
106
+ 105,220024,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",10,0,"n",shellscript,content
107
+ 106,220024,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",11,0,"",shellscript,selection_keyboard
108
+ 107,220386,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",11,0,"v",shellscript,content
109
+ 108,220386,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",12,0,"",shellscript,selection_keyboard
110
+ 109,220606,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",12,0,"/",shellscript,content
111
+ 110,220607,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",13,0,"",shellscript,selection_keyboard
112
+ 111,220733,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",13,0,"b",shellscript,content
113
+ 112,220733,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",14,0,"",shellscript,selection_keyboard
114
+ 113,220865,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",14,0,"i",shellscript,content
115
+ 114,220866,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",15,0,"",shellscript,selection_keyboard
116
+ 115,220961,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",15,0,"n",shellscript,content
117
+ 116,220961,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",16,0,"",shellscript,selection_keyboard
118
+ 117,221189,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",16,0,"a",shellscript,content
119
+ 118,221189,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",17,0,"",shellscript,selection_keyboard
120
+ 119,221227,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",17,0,"c",shellscript,content
121
+ 120,221227,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",18,0,"",shellscript,selection_keyboard
122
+ 121,221628,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",17,1,"",shellscript,content
123
+ 122,221826,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",17,0,"/",shellscript,content
124
+ 123,221826,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",18,0,"",shellscript,selection_keyboard
125
+ 124,221968,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",18,0,"a",shellscript,content
126
+ 125,221968,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",19,0,"",shellscript,selection_keyboard
127
+ 126,221983,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",19,0,"c",shellscript,content
128
+ 127,221983,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",20,0,"",shellscript,selection_keyboard
129
+ 128,222274,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",19,1,"",shellscript,content
130
+ 129,222403,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",18,1,"",shellscript,content
131
+ 130,222558,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",17,1,"",shellscript,content
132
+ 131,222733,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",16,1,"",shellscript,content
133
+ 132,222879,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",16,0,"/",shellscript,content
134
+ 133,222880,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",17,0,"",shellscript,selection_keyboard
135
+ 134,222957,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",17,0,"a",shellscript,content
136
+ 135,222958,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",18,0,"",shellscript,selection_keyboard
137
+ 136,222978,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",18,0,"c",shellscript,content
138
+ 137,222978,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",19,0,"",shellscript,selection_keyboard
139
+ 138,223208,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",19,0,"t",shellscript,content
140
+ 139,223209,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",20,0,"",shellscript,selection_keyboard
141
+ 140,223274,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",20,0,"i",shellscript,content
142
+ 141,223274,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",21,0,"",shellscript,selection_keyboard
143
+ 142,223391,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",21,0,"v",shellscript,content
144
+ 143,223391,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",22,0,"",shellscript,selection_keyboard
145
+ 144,223724,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",22,0,"a",shellscript,content
146
+ 145,223724,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",23,0,"",shellscript,selection_keyboard
147
+ 146,223727,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",23,0,"t",shellscript,content
148
+ 147,223727,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",24,0,"",shellscript,selection_keyboard
149
+ 148,223774,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",24,0,"e",shellscript,content
150
+ 149,223774,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",25,0,"",shellscript,selection_keyboard
151
+ 150,224044,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",24,0,"",shellscript,selection_command
152
+ 151,231289,"TERMINAL",0,0,"pwd",,terminal_command
153
+ 152,234493,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",17,0,"",shellscript,selection_command
154
+ 153,234626,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",16,0,"",shellscript,selection_command
155
+ 154,234788,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",13,0,"",shellscript,selection_command
156
+ 155,234908,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",12,0,"",shellscript,selection_command
157
+ 156,235148,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",8,0,"",shellscript,selection_command
158
+ 157,236518,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",7,1,"",shellscript,content
159
+ 158,237353,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",7,0,".",shellscript,content
160
+ 159,237353,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",8,0,"",shellscript,selection_keyboard
161
+ 160,237677,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",7,0,"",shellscript,selection_command
162
+ 161,238166,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",7,0,"/home/franz.srambical/crowd-pilot-serializer",shellscript,content
163
+ 162,238166,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",51,0,"",shellscript,selection_keyboard
164
+ 163,239047,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",50,0,"",shellscript,selection_command
165
+ 164,239559,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",51,0,"",shellscript,selection_command
166
+ 165,239631,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",51,0,"/",shellscript,content
167
+ 166,239632,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",52,0,"",shellscript,selection_keyboard
168
+ 167,240031,"/home/franz.srambical/slurm/dev/franz/berlin/crowd-pilot/crowd_pilot_serializer/serialize.sh",51,0,"",shellscript,selection_command
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-63ef9b25-3351-4174-890b-f49574ab1a3c1758993863516-2025_09_27-19.24.25.912/source.csv ADDED
@@ -0,0 +1,512 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,1,"index.html",0,0,"<html>\n<head>\n <style>\n body {\n margin: 20px;\n margin-left: 12%;\n margin-right:12%;\n a {\n color: green;\n text-decoration-style: dotted;\n }\n }\n </style>\n</head>\n<p>\n Franz Srambical\n <br>\n ============\n <br>\nHi! I'm Franz. I started and scaled <a href=""https://pdoom.org"">p(doom)</a>, a Discord-based research community, from zero >200 members. We work on addressing core blockers towards general intelligence that cannot be solved by scaling up compute. We work on everything from kernel-level optimizations to large-scale distributed systems for pre-training and reinforcement learning. A lot of our current work involves finding, investigating and exploiting novel data troves <a href=""https://pdoom.org/crowd_code.html"">[1]</a> <a href=""https://pdoom.org/jasmine.html"">[2]</a>, and building open infrastructure/codebases.\nI am ex-distributed systems software engineer at <a href=""https://celonis.com"">Celonis</a>, dropped out of uni (Informatics at <a href=""https://tum.de"">TUM</a>), minored in Computational Neuroscience (courses at <a href=""https://www.gsn.uni-muenchen.de"">LMU Graduate School of Systemic Neurosciences</a>), <a href=""https://www.youtube.com/watch?v=N5nVSXV9Hbk&t=21971s"">ex-linux kernel developer</a>, ex-<a href=""public/vwa.pdf"">'alignment researcher'</a> in my high school years, ex-RA at <a href=""https://aidos.group"">Bastian Rieck's lab</a>, ex-'BCI researcher' & founding member at neuroTUM.\n<br>\n<br>\nI want to create AGI (i.e. design architectures that push the pareto-frontier of intelligent systems).\n<br>\n<br>\nIf any of our research work interests you, check out the <a href=""https://pdoom.org/blog.html"">p(doom) blog</a>. I also have <a href=""https://www.linkedin.com/in/franz-srambical-418630178/"" >linkedin</a>, <a href=""https://twitter.com/lemergenz"" >twitter</a> and <a href=""https://scholar.google.com/citations?user=W26dT4EAAAAJ&hl=en&oi=ao"" >google scholar</a>.\n<br>\n<br>\nList of preprints accumulated throughout my education that are not worthy of publication (& thus not on arxiv), but valuable to some nonetheless:\n<ul>\n <li>\n <a href=""https://pdoom.org/jax_assert.html"">\n A blog post on performance-degradation free value assertions in JAX using a very recent and still private JAX API.\n </a>\n </li>\n <li>\n <a href=""https://pdoom.org/gae_rlax.html"">\n A blog post on how a lot of PPO implementations are technically wrong (including Deepmind's reference implementation in RLax).\n </a>\n </li>\n <li>\n <a href=""https://pdoom.org/ppo.html"">\n A blog post on how practically everyone in LLM post-training is currently implicitly using REINFORCE with baseline, clipping and a likelihood ratio, and not PPO (in the classical sense).\n </a>\n </li>\n <li>\n <a href=""https://pdoom.org/thesis.html"">\n A blog post on a simple mental model that permits straightforward contextualization of the current research frontier and extrapolation of what the most important future research directions are going to be.\n </a>\n </li>\n <li>\n <a href=""https://pdoom.org/causal_mask.html"">\n A blog post on why the Transformer's causal mask is its ultimate feature, not a bug\n </a>\n </li>\n <li>\n <a href=""public/vwa.pdf"">\n A 30-page paper on AGI alignment written in 2018/19 during my high school years (unfortunately in German)\n </a>\n </li>\n <li>\n <a href=""public/cfr.pdf"">\n A review paper on superhuman poker bots\n </a>\n </li>\n <li>\n <a href=""public/mup-lr-warmup.pdf"">\n A 2-page writeup on the necessity of learning rate warmup under muParametrization\n </a> (with <a href=""https://github.com/emergenz/mup-lr-warmup"">code</a>)\n </li>\n <li>\n <a href=""public/causal_mask_poster.pdf"">\n A poster on why the Transformer's causal mask is its ultimate feature, not a bug\n </a>\n </li>\n <li>\n <a href=""public/wenn_besitzen_unfair_ist.pdf"">\n A poster on the 99-year leasehold system in Singapore as a means to mitigate generational wealth (unfortunately in German)\n </a>\n </li>\n <li>\n <a href=""public/panoptic-3d-reconstruction.pdf"">\n A crappy 'it's just x but with y'-type computer vision paper on 2% better (and 3% worse) panoptic 3D reconstruction (which included one-shot finetuning a 1B parameter diffusion model hours before the deadline)\n </a>\n </li>\n <li>\n <a href=""https://docs.google.com/document/d/14xx883ywhbJeaPz13S2lu9NY5RBwUzbNnh6K-o-Y06I/edit?usp=sharing"">\n A 2-page doc outlining my thoughts on whether machines can think \n </a>\n </li>\n</ul>\n\nIncomplete list of talks I have given:\n<ul>\n <li>\n <a href=""https://docs.google.com/presentation/d/1fq_JiOP9zZS0w_fi9sZxMb-9TmKnleugl9ik3sJK_sc/edit?usp=sharing"">\n Talk on the necessity of learning rate warmup under muParametrization (and a real-time case study on the absurd speed of modern AI research)\n </a>\n </li>\n <li>\n <a href=""https://docs.google.com/presentation/d/1V-lfRj54czkQiZw9ziEnFPdByIuM6lkuSF5gKmHvbQQ/edit?usp=sharing"">\n Talk on AlphaFold 3, motivating its architectural design through the lens of the Transformer architecture and its modern variants\n </a> \n </li>\n <li>\n <a href=""https://docs.google.com/presentation/d/1jxDhbyrCtgme_ebzchh8qIIlr8vriu4H7FClAphuDpU/edit?usp=sharing"">\n Talk at MunichNLP on p(doom), adaptive compute at inference time and predicting text-based protein function descriptions directly from sequence, bypassing structure\n </a> \n </li>\n <li>\n <a href=""https://docs.google.com/presentation/d/1JVqy-0HdfE7POWw5LWiD02fYMa7VKgi2fFkYaxibJKI/edit?usp=sharing"">\n Talk on the 'translation gap' between core and applied machine learning research, scaling protein function prediction as neural machine translation, ESM-3, AlphaFold 3, the causal mask, muTransfer and ARC-AGI\n </a> \n </li>\n <li>\n <a href=""https://docs.google.com/presentation/d/1KXu-bkNRr_0VLh1KdZazt3u3IFlFPtfkAu4AeYFqnAw/edit?usp=sharing"">\n Talk on beating modern dynamic graph classification baselines using a 1-layer LSTM\n </a> \n </li>\n <li>\n <a href=""public/counting_neurons_and_ultrasonic_communication.pdf"">\n On neurons that count and ultrasonic communication in frogs (I have catastrophically forgotten the contents of this talk)\n </a>\n </li>\n</ul>\n</p>\n<br>\n<br>\nPS: no free lunch is a myth\n</html>",html,tab
3
+ 2,93,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"7:24:25 PM [info] Activating crowd-code\n7:24:25 PM [info] Recording started\n7:24:25 PM [info] Initializing git provider using file system watchers...\n7:24:25 PM [info] Git repository found\n7:24:25 PM [info] Git provider initialized successfully\n",Log,tab
4
+ 3,141,"extension-output-pdoom-org.crowd-code-#1-crowd-code",245,0,"7:24:25 PM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,1594,"index.html",0,0,"",html,tab
6
+ 5,20948,"index.html",251,0,"",html,selection_command
7
+ 6,22220,"index.html",257,0,"\n <br>",html,content
8
+ 7,22243,"index.html",260,0,"",html,selection_command
9
+ 8,22991,"index.html",257,0,"\n ",html,content
10
+ 9,23678,"index.html",258,2,"",html,content
11
+ 10,24194,"index.html",258,0,"Y",html,content
12
+ 11,24196,"index.html",259,0,"",html,selection_keyboard
13
+ 12,24361,"index.html",259,0,"o",html,content
14
+ 13,24364,"index.html",260,0,"",html,selection_keyboard
15
+ 14,24409,"index.html",260,0,"u",html,content
16
+ 15,24412,"index.html",261,0,"",html,selection_keyboard
17
+ 16,24540,"index.html",261,0," ",html,content
18
+ 17,24542,"index.html",262,0,"",html,selection_keyboard
19
+ 18,24678,"index.html",262,0,"c",html,content
20
+ 19,24682,"index.html",263,0,"",html,selection_keyboard
21
+ 20,24760,"index.html",263,0,"a",html,content
22
+ 21,24764,"index.html",264,0,"",html,selection_keyboard
23
+ 22,24876,"index.html",264,0,"n",html,content
24
+ 23,24880,"index.html",265,0,"",html,selection_keyboard
25
+ 24,24974,"index.html",265,0," ",html,content
26
+ 25,24978,"index.html",266,0,"",html,selection_keyboard
27
+ 26,25147,"index.html",266,0,"r",html,content
28
+ 27,25150,"index.html",267,0,"",html,selection_keyboard
29
+ 28,25232,"index.html",267,0,"e",html,content
30
+ 29,25234,"index.html",268,0,"",html,selection_keyboard
31
+ 30,25323,"index.html",268,0,"a",html,content
32
+ 31,25324,"index.html",269,0,"",html,selection_keyboard
33
+ 32,25489,"index.html",269,0,"c",html,content
34
+ 33,25491,"index.html",270,0,"",html,selection_keyboard
35
+ 34,25617,"index.html",270,0,"h",html,content
36
+ 35,25619,"index.html",271,0,"",html,selection_keyboard
37
+ 36,25729,"index.html",271,0," ",html,content
38
+ 37,25733,"index.html",272,0,"",html,selection_keyboard
39
+ 38,25981,"index.html",272,0,"m",html,content
40
+ 39,25985,"index.html",273,0,"",html,selection_keyboard
41
+ 40,26067,"index.html",273,0,"e",html,content
42
+ 41,26072,"index.html",274,0,"",html,selection_keyboard
43
+ 42,26140,"index.html",274,0," ",html,content
44
+ 43,26144,"index.html",275,0,"",html,selection_keyboard
45
+ 44,26315,"index.html",275,0,"a",html,content
46
+ 45,26319,"index.html",276,0,"",html,selection_keyboard
47
+ 46,26413,"index.html",276,0,"t",html,content
48
+ 47,26416,"index.html",277,0,"",html,selection_keyboard
49
+ 48,26509,"index.html",277,0," ",html,content
50
+ 49,26512,"index.html",278,0,"",html,selection_keyboard
51
+ 50,28201,"index.html",278,0,"<",html,content
52
+ 51,28205,"index.html",279,0,"",html,selection_keyboard
53
+ 52,28345,"index.html",279,0,">",html,content
54
+ 53,28347,"index.html",280,0,"",html,selection_keyboard
55
+ 54,29472,"index.html",279,1,"",html,content
56
+ 55,29713,"index.html",278,1,"",html,content
57
+ 56,31961,"index.html",278,0,"\",html,content
58
+ 57,31963,"index.html",279,0,"",html,selection_keyboard
59
+ 58,32519,"index.html",279,0,"<",html,content
60
+ 59,32522,"index.html",280,0,"",html,selection_keyboard
61
+ 60,33713,"index.html",279,1,"",html,content
62
+ 61,33846,"index.html",278,1,"",html,content
63
+ 62,37499,"index.html",278,0,"`",html,content
64
+ 63,37504,"index.html",279,0,"",html,selection_keyboard
65
+ 64,37712,"index.html",279,0,"`",html,content
66
+ 65,37714,"index.html",280,0,"",html,selection_keyboard
67
+ 66,38335,"index.html",279,1,"",html,content
68
+ 67,38477,"index.html",278,1,"",html,content
69
+ 68,53829,"index.html",278,0,"''",html,content
70
+ 69,53834,"index.html",279,0,"",html,selection_keyboard
71
+ 70,54138,"index.html",279,0,">",html,content
72
+ 71,54144,"index.html",280,0,"",html,selection_keyboard
73
+ 72,54489,"index.html",279,1,"",html,content
74
+ 73,54623,"index.html",278,2,"",html,content
75
+ 74,54799,"index.html",278,0,"\",html,content
76
+ 75,54801,"index.html",279,0,"",html,selection_keyboard
77
+ 76,55466,"index.html",279,0,">",html,content
78
+ 77,55470,"index.html",280,0,"",html,selection_keyboard
79
+ 78,56351,"index.html",280,0," ",html,content
80
+ 79,56355,"index.html",281,0,"",html,selection_keyboard
81
+ 80,56576,"index.html",281,0,"\",html,content
82
+ 81,56577,"index.html",282,0,"",html,selection_keyboard
83
+ 82,57061,"index.html",282,0,">",html,content
84
+ 83,57063,"index.html",283,0,"",html,selection_keyboard
85
+ 84,57638,"index.html",282,1,"",html,content
86
+ 85,59055,"index.html",282,0,">",html,content
87
+ 86,59062,"index.html",283,0,"",html,selection_keyboard
88
+ 87,59874,"index.html",282,0,"",html,selection_command
89
+ 88,59992,"index.html",281,0,"",html,selection_command
90
+ 89,60196,"index.html",280,0,"",html,selection_command
91
+ 90,60559,"index.html",279,0,"",html,selection_command
92
+ 91,60874,"index.html",280,0,"",html,selection_command
93
+ 92,61015,"index.html",279,1,"",html,content
94
+ 93,61448,"index.html",279,0,"<",html,content
95
+ 94,61450,"index.html",280,0,"",html,selection_keyboard
96
+ 95,61743,"index.html",279,0,"",html,selection_command
97
+ 96,62222,"index.html",280,0,"",html,selection_command
98
+ 97,64577,"index.html",279,0,"",html,selection_command
99
+ 98,64701,"index.html",280,0,"",html,selection_command
100
+ 99,64831,"index.html",281,0,"",html,selection_command
101
+ 100,65068,"index.html",280,1,"",html,content
102
+ 101,67202,"index.html",280,0,"m",html,content
103
+ 102,67208,"index.html",281,0,"",html,selection_keyboard
104
+ 103,67674,"index.html",281,0,"y",html,content
105
+ 104,67677,"index.html",282,0,"",html,selection_keyboard
106
+ 105,67889,"index.html",282,0,"_",html,content
107
+ 106,67890,"index.html",283,0,"",html,selection_keyboard
108
+ 107,68061,"index.html",283,0,"f",html,content
109
+ 108,68062,"index.html",284,0,"",html,selection_keyboard
110
+ 109,68174,"index.html",284,0,"i",html,content
111
+ 110,68175,"index.html",285,0,"",html,selection_keyboard
112
+ 111,68273,"index.html",285,0,"r",html,content
113
+ 112,68274,"index.html",286,0,"",html,selection_keyboard
114
+ 113,68321,"index.html",286,0,"s",html,content
115
+ 114,68322,"index.html",287,0,"",html,selection_keyboard
116
+ 115,68413,"index.html",287,0,"t",html,content
117
+ 116,68414,"index.html",288,0,"",html,selection_keyboard
118
+ 117,68640,"index.html",288,0,"_",html,content
119
+ 118,68642,"index.html",289,0,"",html,selection_keyboard
120
+ 119,68910,"index.html",289,0,"n",html,content
121
+ 120,68912,"index.html",290,0,"",html,selection_keyboard
122
+ 121,68973,"index.html",290,0,"a",html,content
123
+ 122,68974,"index.html",291,0,"",html,selection_keyboard
124
+ 123,69099,"index.html",291,0,"m",html,content
125
+ 124,69100,"index.html",292,0,"",html,selection_keyboard
126
+ 125,69171,"index.html",292,0,"e",html,content
127
+ 126,69173,"index.html",293,0,"",html,selection_keyboard
128
+ 127,71229,"index.html",295,0,"@<my_last_name\>.com",html,content
129
+ 128,71231,"index.html",315,0,"",html,selection_command
130
+ 129,71510,"index.html",314,0,"",html,selection_command
131
+ 130,71679,"index.html",312,0,"",html,selection_command
132
+ 131,71833,"index.html",309,0,"",html,selection_command
133
+ 132,71982,"index.html",297,0,"",html,selection_command
134
+ 133,72090,"index.html",293,0,"",html,selection_command
135
+ 134,72458,"index.html",294,0,"",html,selection_command
136
+ 135,72600,"index.html",295,0,"",html,selection_command
137
+ 136,72778,"index.html",296,0,"",html,selection_command
138
+ 137,72929,"index.html",297,0,"",html,selection_command
139
+ 138,73648,"index.html",210,6177,"",html,content
140
+ 139,75092,"index.html",209,0,"",html,selection_command
141
+ 140,75386,"index.html",211,0," Franz Srambical\n <br>\n ============\n <br>\nYou can reach me at \<my_first_name\>@<my_last_name\>.com\n <br>\nHi! I'm Franz. I started and scaled <a href=""https://pdoom.org"">p(doom)</a>, a Discord-based research community, from zero >200 members. We work on addressing core blockers towards general intelligence that cannot be solved by scaling up compute. We work on everything from kernel-level optimizations to large-scale distributed systems for pre-training and reinforcement learning. A lot of our current work involves finding, investigating and exploiting novel data troves <a href=""https://pdoom.org/crowd_code.html"">[1]</a> <a href=""https://pdoom.org/jasmine.html"">[2]</a>, and building open infrastructure/codebases.\nI am ex-distributed systems software engineer at <a href=""https://celonis.com"">Celonis</a>, dropped out of uni (Informatics at <a href=""https://tum.de"">TUM</a>), minored in Computational Neuroscience (courses at <a href=""https://www.gsn.uni-muenchen.de"">LMU Graduate School of Systemic Neurosciences</a>), <a href=""https://www.youtube.com/watch?v=N5nVSXV9Hbk&t=21971s"">ex-linux kernel developer</a>, ex-<a href=""public/vwa.pdf"">'alignment researcher'</a> in my high school years, ex-RA at <a href=""https://aidos.group"">Bastian Rieck's lab</a>, ex-'BCI researcher' & founding member at neuroTUM.\n<br>\n<br>\nI want to create AGI (i.e. design architectures that push the pareto-frontier of intelligent systems).\n<br>\n<br>\nIf any of our research work interests you, check out the <a href=""https://pdoom.org/blog.html"">p(doom) blog</a>. I also have <a href=""https://www.linkedin.com/in/franz-srambical-418630178/"" >linkedin</a>, <a href=""https://twitter.com/lemergenz"" >twitter</a> and <a href=""https://scholar.google.com/citations?user=W26dT4EAAAAJ&hl=en&oi=ao"" >google scholar</a>.\n<br>\n<br>\nList of preprints accumulated throughout my education that are not worthy of publication (& thus not on arxiv), but valuable to some nonetheless:\n<ul>\n <li>\n <a href=""https://pdoom.org/jax_assert.html"">\n A blog post on performance-degradation free value assertions in JAX using a very recent and still private JAX API.\n </a>\n </li>\n <li>\n <a href=""https://pdoom.org/gae_rlax.html"">\n A blog post on how a lot of PPO implementations are technically wrong (including Deepmind's reference implementation in RLax).\n </a>\n </li>\n <li>\n <a href=""https://pdoom.org/ppo.html"">\n A blog post on how practically everyone in LLM post-training is currently implicitly using REINFORCE with baseline, clipping and a likelihood ratio, and not PPO (in the classical sense).\n </a>\n </li>\n <li>\n <a href=""https://pdoom.org/thesis.html"">\n A blog post on a simple mental model that permits straightforward contextualization of the current research frontier and extrapolation of what the most important future research directions are going to be.\n </a>\n </li>\n <li>\n <a href=""https://pdoom.org/causal_mask.html"">\n A blog post on why the Transformer's causal mask is its ultimate feature, not a bug\n </a>\n </li>\n <li>\n <a href=""public/vwa.pdf"">\n A 30-page paper on AGI alignment written in 2018/19 during my high school years (unfortunately in German)\n </a>\n </li>\n <li>\n <a href=""public/cfr.pdf"">\n A review paper on superhuman poker bots\n </a>\n </li>\n <li>\n <a href=""public/mup-lr-warmup.pdf"">\n A 2-page writeup on the necessity of learning rate warmup under muParametrization\n </a> (with <a href=""https://github.com/emergenz/mup-lr-warmup"">code</a>)\n </li>\n <li>\n <a href=""public/causal_mask_poster.pdf"">\n A poster on why the Transformer's causal mask is its ultimate feature, not a bug\n </a>\n </li>\n <li>\n <a href=""public/wenn_besitzen_unfair_ist.pdf"">\n A poster on the 99-year leasehold system in Singapore as a means to mitigate generational wealth (unfortunately in German)\n </a>\n </li>\n <li>\n <a href=""public/panoptic-3d-reconstruction.pdf"">\n A crappy 'it's just x but with y'-type computer vision paper on 2% better (and 3% worse) panoptic 3D reconstruction (which included one-shot finetuning a 1B parameter diffusion model hours before the deadline)\n </a>\n </li>\n <li>\n <a href=""https://docs.google.com/document/d/14xx883ywhbJeaPz13S2lu9NY5RBwUzbNnh6K-o-Y06I/edit?usp=sharing"">\n A 2-page doc outlining my thoughts on whether machines can think \n </a>\n </li>\n</ul>\n\nIncomplete list of talks I have given:\n<ul>\n <li>\n <a href=""https://docs.google.com/presentation/d/1fq_JiOP9zZS0w_fi9sZxMb-9TmKnleugl9ik3sJK_sc/edit?usp=sharing"">\n Talk on the necessity of learning rate warmup under muParametrization (and a real-time case study on the absurd speed of modern AI research)\n </a>\n </li>\n <li>\n <a href=""https://docs.google.com/presentation/d/1V-lfRj54czkQiZw9ziEnFPdByIuM6lkuSF5gKmHvbQQ/edit?usp=sharing"">\n Talk on AlphaFold 3, motivating its architectural design through the lens of the Transformer architecture and its modern variants\n </a> \n </li>\n <li>\n <a href=""https://docs.google.com/presentation/d/1jxDhbyrCtgme_ebzchh8qIIlr8vriu4H7FClAphuDpU/edit?usp=sharing"">\n Talk at MunichNLP on p(doom), adaptive compute at inference time and predicting text-based protein function descriptions directly from sequence, bypassing structure\n </a> \n </li>\n <li>\n <a href=""https://docs.google.com/presentation/d/1JVqy-0HdfE7POWw5LWiD02fYMa7VKgi2fFkYaxibJKI/edit?usp=sharing"">\n Talk on the 'translation gap' between core and applied machine learning research, scaling protein function prediction as neural machine translation, ESM-3, AlphaFold 3, the causal mask, muTransfer and ARC-AGI\n </a> \n </li>\n <li>\n <a href=""https://docs.google.com/presentation/d/1KXu-bkNRr_0VLh1KdZazt3u3IFlFPtfkAu4AeYFqnAw/edit?usp=sharing"">\n Talk on beating modern dynamic graph classification baselines using a 1-layer LSTM\n </a> \n </li>\n <li>\n <a href=""public/counting_neurons_and_ultrasonic_communication.pdf"">\n On neurons that count and ultrasonic communication in frogs (I have catastrophically forgotten the contents of this talk)\n </a>\n </li>\n</ul>\n",html,content
142
+ 141,75391,"index.html",297,0,"",html,selection_command
143
+ 142,76267,"index.html",297,1,"m",html,selection_command
144
+ 143,76327,"index.html",297,12,"my_last_name",html,selection_command
145
+ 144,76569,"index.html",297,15,"my_last_name\>.",html,selection_command
146
+ 145,76803,"index.html",297,14,"my_last_name\>",html,selection_command
147
+ 146,76966,"index.html",297,13,"my_last_name\",html,selection_command
148
+ 147,77115,"index.html",297,12,"my_last_name",html,selection_command
149
+ 148,77737,"index.html",297,12,"",html,content
150
+ 149,79172,"index.html",296,0,"",html,selection_command
151
+ 150,79684,"index.html",297,0,"",html,selection_command
152
+ 151,82146,"index.html",296,0,"",html,selection_command
153
+ 152,82452,"index.html",296,0,"'",html,content
154
+ 153,82459,"index.html",297,0,"",html,selection_keyboard
155
+ 154,82642,"index.html",296,0,"",html,selection_command
156
+ 155,83706,"index.html",296,1,"\",html,content
157
+ 156,84461,"index.html",297,0,"",html,selection_command
158
+ 157,89934,"index.html",301,0,"",html,selection_command
159
+ 158,90100,"index.html",307,0,"",html,selection_command
160
+ 159,90560,"index.html",301,0,"",html,selection_command
161
+ 160,91966,"index.html",293,0,"",html,selection_command
162
+ 161,92083,"index.html",280,0,"",html,selection_command
163
+ 162,92378,"index.html",281,0,"",html,selection_command
164
+ 163,92533,"index.html",293,0,"",html,selection_command
165
+ 164,92928,"index.html",294,0,"",html,selection_command
166
+ 165,93147,"index.html",295,0,"",html,selection_command
167
+ 166,93394,"index.html",296,0,"",html,selection_command
168
+ 167,94818,"index.html",296,8,"",html,content
169
+ 168,97748,"index.html",296,0,"\",html,content
170
+ 169,97751,"index.html",297,0,"",html,selection_keyboard
171
+ 170,98436,"index.html",297,0,"<",html,content
172
+ 171,98441,"index.html",298,0,"",html,selection_keyboard
173
+ 172,98982,"index.html",298,0,"\",html,content
174
+ 173,98986,"index.html",299,0,"",html,selection_keyboard
175
+ 174,99296,"index.html",299,0,">",html,content
176
+ 175,99300,"index.html",300,0,"",html,selection_keyboard
177
+ 176,99607,"index.html",299,0,"",html,selection_command
178
+ 177,99750,"index.html",298,0,"",html,selection_command
179
+ 178,100306,"index.html",297,0,"",html,selection_command
180
+ 179,123509,"index.html",300,0,"",html,selection_command
181
+ 180,123840,"index.html",300,0,".",html,content
182
+ 181,123842,"index.html",301,0,"",html,selection_keyboard
183
+ 182,125585,"index.html",301,0,"o",html,content
184
+ 183,125591,"index.html",302,0,"",html,selection_keyboard
185
+ 184,125665,"index.html",302,0,"r",html,content
186
+ 185,125669,"index.html",303,0,"",html,selection_keyboard
187
+ 186,125698,"index.html",303,0,"g",html,content
188
+ 187,125700,"index.html",304,0,"",html,selection_keyboard
189
+ 188,125960,"index.html",303,0,"",html,selection_command
190
+ 189,126109,"index.html",302,0,"",html,selection_command
191
+ 190,126268,"index.html",301,0,"",html,selection_command
192
+ 191,126411,"index.html",300,0,"",html,selection_command
193
+ 192,126581,"index.html",299,0,"",html,selection_command
194
+ 193,126729,"index.html",298,0,"",html,selection_command
195
+ 194,136731,"index.html",298,0,"o",html,content
196
+ 195,136735,"index.html",299,0,"",html,selection_keyboard
197
+ 196,136761,"index.html",299,0,"u",html,content
198
+ 197,136762,"index.html",300,0,"",html,selection_keyboard
199
+ 198,137160,"index.html",299,1,"",html,content
200
+ 199,137410,"index.html",298,1,"",html,content
201
+ 200,137710,"index.html",298,0,"o",html,content
202
+ 201,137711,"index.html",299,0,"",html,selection_keyboard
203
+ 202,137780,"index.html",299,0,"u",html,content
204
+ 203,137781,"index.html",300,0,"",html,selection_keyboard
205
+ 204,137853,"index.html",300,0,"r",html,content
206
+ 205,137855,"index.html",301,0,"",html,selection_keyboard
207
+ 206,138094,"index.html",301,0,"_",html,content
208
+ 207,138097,"index.html",302,0,"",html,selection_keyboard
209
+ 208,138971,"index.html",302,0,"o",html,content
210
+ 209,138974,"index.html",303,0,"",html,selection_keyboard
211
+ 210,139034,"index.html",303,0,"r",html,content
212
+ 211,139036,"index.html",304,0,"",html,selection_keyboard
213
+ 212,139226,"index.html",304,0,"g",html,content
214
+ 213,139227,"index.html",305,0,"",html,selection_keyboard
215
+ 214,141457,"index.html",304,0,"",html,selection_command
216
+ 215,142619,"index.html",305,0,"",html,selection_command
217
+ 216,142829,"index.html",304,1,"",html,content
218
+ 217,142993,"index.html",303,1,"",html,content
219
+ 218,143157,"index.html",302,1,"",html,content
220
+ 219,143298,"index.html",302,0,"r",html,content
221
+ 220,143300,"index.html",303,0,"",html,selection_keyboard
222
+ 221,143404,"index.html",303,0,"e",html,content
223
+ 222,143406,"index.html",304,0,"",html,selection_keyboard
224
+ 223,143471,"index.html",304,0,"s",html,content
225
+ 224,143473,"index.html",305,0,"",html,selection_keyboard
226
+ 225,143607,"index.html",305,0,"e",html,content
227
+ 226,143608,"index.html",306,0,"",html,selection_keyboard
228
+ 227,143687,"index.html",306,0,"a",html,content
229
+ 228,143689,"index.html",307,0,"",html,selection_keyboard
230
+ 229,143771,"index.html",307,0,"r",html,content
231
+ 230,143772,"index.html",308,0,"",html,selection_keyboard
232
+ 231,143951,"index.html",308,0,"c",html,content
233
+ 232,143954,"index.html",309,0,"",html,selection_keyboard
234
+ 233,144061,"index.html",309,0,"h",html,content
235
+ 234,144063,"index.html",310,0,"",html,selection_keyboard
236
+ 235,144281,"index.html",310,0,"_",html,content
237
+ 236,144284,"index.html",311,0,"",html,selection_keyboard
238
+ 237,144494,"index.html",311,0,"o",html,content
239
+ 238,144495,"index.html",312,0,"",html,selection_keyboard
240
+ 239,144575,"index.html",312,0,"r",html,content
241
+ 240,144576,"index.html",313,0,"",html,selection_keyboard
242
+ 241,144749,"index.html",313,0,"g",html,content
243
+ 242,144751,"index.html",314,0,"",html,selection_keyboard
244
+ 243,144927,"index.html",313,0,"",html,selection_command
245
+ 244,146184,"index.html",314,0,"",html,selection_command
246
+ 245,146718,"index.html",313,0,"",html,selection_command
247
+ 246,162862,"index.html",298,0,"",html,selection_command
248
+ 247,163265,"index.html",298,16,"",html,content
249
+ 248,164085,"index.html",297,0,"",html,selection_command
250
+ 249,164433,"index.html",298,0,"",html,selection_command
251
+ 250,164591,"index.html",299,0,"",html,selection_command
252
+ 251,164761,"index.html",300,0,"",html,selection_command
253
+ 252,165148,"index.html",300,4,"",html,content
254
+ 253,165150,"index.html",299,0,"",html,selection_command
255
+ 254,165512,"index.html",298,0,"",html,selection_command
256
+ 255,166262,"index.html",298,0,"t",html,content
257
+ 256,166265,"index.html",299,0,"",html,selection_keyboard
258
+ 257,166421,"index.html",299,0,"h",html,content
259
+ 258,166423,"index.html",300,0,"",html,selection_keyboard
260
+ 259,167227,"index.html",300,0,"e",html,content
261
+ 260,167233,"index.html",301,0,"",html,selection_keyboard
262
+ 261,167822,"index.html",301,0,"_",html,content
263
+ 262,167826,"index.html",302,0,"",html,selection_keyboard
264
+ 263,168179,"index.html",302,0,"p",html,content
265
+ 264,168181,"index.html",303,0,"",html,selection_keyboard
266
+ 265,169027,"index.html",302,1,"",html,content
267
+ 266,170916,"index.html",302,0,"p",html,content
268
+ 267,170921,"index.html",303,0,"",html,selection_keyboard
269
+ 268,171109,"index.html",303,0,"d",html,content
270
+ 269,171112,"index.html",304,0,"",html,selection_keyboard
271
+ 270,171212,"index.html",304,0,"o",html,content
272
+ 271,171214,"index.html",305,0,"",html,selection_keyboard
273
+ 272,171531,"index.html",305,0,"o",html,content
274
+ 273,171533,"index.html",306,0,"",html,selection_keyboard
275
+ 274,171724,"index.html",306,0,"m",html,content
276
+ 275,171727,"index.html",307,0,"",html,selection_keyboard
277
+ 276,172230,"index.html",307,0,"_",html,content
278
+ 277,172232,"index.html",308,0,"",html,selection_keyboard
279
+ 278,173134,"index.html",308,0,"o",html,content
280
+ 279,173138,"index.html",309,0,"",html,selection_keyboard
281
+ 280,173213,"index.html",309,0,"r",html,content
282
+ 281,173217,"index.html",310,0,"",html,selection_keyboard
283
+ 282,173379,"index.html",310,0,"g",html,content
284
+ 283,173382,"index.html",311,0,"",html,selection_keyboard
285
+ 284,173598,"index.html",311,0,"_",html,content
286
+ 285,173600,"index.html",312,0,"",html,selection_keyboard
287
+ 286,173835,"index.html",312,0,"d",html,content
288
+ 287,173841,"index.html",313,0,"",html,selection_keyboard
289
+ 288,173889,"index.html",313,0,"o",html,content
290
+ 289,173891,"index.html",314,0,"",html,selection_keyboard
291
+ 290,173980,"index.html",314,0,"m",html,content
292
+ 291,173982,"index.html",315,0,"",html,selection_keyboard
293
+ 292,174087,"index.html",315,0,"a",html,content
294
+ 293,174090,"index.html",316,0,"",html,selection_keyboard
295
+ 294,174461,"index.html",315,1,"",html,content
296
+ 295,174610,"index.html",314,1,"",html,content
297
+ 296,174780,"index.html",313,1,"",html,content
298
+ 297,174921,"index.html",312,1,"",html,content
299
+ 298,175176,"index.html",312,0,"w",html,content
300
+ 299,175178,"index.html",313,0,"",html,selection_keyboard
301
+ 300,175295,"index.html",313,0,"e",html,content
302
+ 301,175296,"index.html",314,0,"",html,selection_keyboard
303
+ 302,175459,"index.html",314,0,"b",html,content
304
+ 303,175460,"index.html",315,0,"",html,selection_keyboard
305
+ 304,177144,"index.html",314,1,"",html,content
306
+ 305,177305,"index.html",313,1,"",html,content
307
+ 306,177453,"index.html",312,1,"",html,content
308
+ 307,177494,"index.html",312,0,"a",html,content
309
+ 308,177495,"index.html",313,0,"",html,selection_keyboard
310
+ 309,177581,"index.html",313,0,"d",html,content
311
+ 310,177583,"index.html",314,0,"",html,selection_keyboard
312
+ 311,178830,"index.html",313,1,"",html,content
313
+ 312,179427,"index.html",312,1,"",html,content
314
+ 313,179927,"index.html",311,1,"",html,content
315
+ 314,180171,"index.html",310,1,"",html,content
316
+ 315,180205,"index.html",309,1,"",html,content
317
+ 316,180238,"index.html",308,1,"",html,content
318
+ 317,180272,"index.html",307,1,"",html,content
319
+ 318,180306,"index.html",306,1,"",html,content
320
+ 319,180340,"index.html",305,1,"",html,content
321
+ 320,180374,"index.html",304,1,"",html,content
322
+ 321,180407,"index.html",303,1,"",html,content
323
+ 322,180511,"index.html",302,1,"",html,content
324
+ 323,180764,"index.html",301,1,"",html,content
325
+ 324,180796,"index.html",300,1,"",html,content
326
+ 325,180907,"index.html",299,1,"",html,content
327
+ 326,181099,"index.html",298,1,"",html,content
328
+ 327,181467,"index.html",297,0,"",html,selection_command
329
+ 328,181743,"index.html",298,0,"",html,selection_command
330
+ 329,181895,"index.html",299,0,"",html,selection_command
331
+ 330,182309,"index.html",300,0,"",html,selection_command
332
+ 331,182643,"index.html",300,0,".",html,content
333
+ 332,182645,"index.html",301,0,"",html,selection_keyboard
334
+ 333,182894,"index.html",301,0,"o",html,content
335
+ 334,182896,"index.html",302,0,"",html,selection_keyboard
336
+ 335,182954,"index.html",302,0,"r",html,content
337
+ 336,182957,"index.html",303,0,"",html,selection_keyboard
338
+ 337,183026,"index.html",303,0,"g",html,content
339
+ 338,183029,"index.html",304,0,"",html,selection_keyboard
340
+ 339,183231,"index.html",303,0,"",html,selection_command
341
+ 340,183477,"index.html",302,0,"",html,selection_command
342
+ 341,183610,"index.html",301,0,"",html,selection_command
343
+ 342,183765,"index.html",300,0,"",html,selection_command
344
+ 343,183894,"index.html",299,0,"",html,selection_command
345
+ 344,184033,"index.html",298,0,"",html,selection_command
346
+ 345,186117,"index.html",297,0,"",html,selection_command
347
+ 346,187736,"index.html",298,0,"",html,selection_command
348
+ 347,216666,"index.html",298,0,"o",html,content
349
+ 348,216669,"index.html",299,0,"",html,selection_keyboard
350
+ 349,216712,"index.html",299,0,"u",html,content
351
+ 350,216713,"index.html",300,0,"",html,selection_keyboard
352
+ 351,216787,"index.html",300,0,"r",html,content
353
+ 352,216790,"index.html",301,0,"",html,selection_keyboard
354
+ 353,217010,"index.html",301,0,"_",html,content
355
+ 354,217012,"index.html",302,0,"",html,selection_keyboard
356
+ 355,217240,"index.html",302,0,"d",html,content
357
+ 356,217243,"index.html",303,0,"",html,selection_keyboard
358
+ 357,217345,"index.html",303,0,"o",html,content
359
+ 358,217347,"index.html",304,0,"",html,selection_keyboard
360
+ 359,217425,"index.html",304,0,"m",html,content
361
+ 360,217427,"index.html",305,0,"",html,selection_keyboard
362
+ 361,217545,"index.html",305,0,"a",html,content
363
+ 362,217547,"index.html",306,0,"",html,selection_keyboard
364
+ 363,217616,"index.html",306,0,"i",html,content
365
+ 364,217618,"index.html",307,0,"",html,selection_keyboard
366
+ 365,217686,"index.html",307,0,"n",html,content
367
+ 366,217688,"index.html",308,0,"",html,selection_keyboard
368
+ 367,217843,"index.html",307,0,"",html,selection_command
369
+ 368,220954,"index.html",258,56,"You can reach me at \<my_first_name\>@\<our_domain\>.org",html,selection_command
370
+ 369,282815,"index.html",307,0,"",html,selection_command
371
+ 370,428719,"index.html",258,56,"You can reach me at <span style=""unicode-bidi:bidi-override; direction: rtl;"">gro.moodp@znarf</span>",html,content
372
+ 371,430826,"index.html",365,0,"",html,selection_mouse
373
+ 372,430835,"index.html",364,0,"",html,selection_command
374
+ 373,436409,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
375
+ 374,437731,"index.html",0,0,"",html,tab
376
+ 375,442872,"TERMINAL",0,0,"",,terminal_focus
377
+ 376,444165,"TERMINAL",0,0,"open .",,terminal_command
378
+ 377,444218,"TERMINAL",0,0,"]633;C",,terminal_output
379
+ 378,444275,"TERMINAL",0,0,"% \r \r",,terminal_output
380
+ 379,460114,"index.html",258,100,"You can reach me at \<my_first_name\>@\<our_domain\>.org",html,content
381
+ 380,461454,"index.html",263,0,"",html,selection_command
382
+ 381,461844,"index.html",258,0,"",html,selection_command
383
+ 382,471150,"index.html",262,0,"",html,selection_command
384
+ 383,471399,"index.html",266,0,"",html,selection_command
385
+ 384,471426,"index.html",272,0,"",html,selection_command
386
+ 385,471462,"index.html",275,0,"",html,selection_command
387
+ 386,471493,"index.html",278,0,"",html,selection_command
388
+ 387,472167,"index.html",279,0,"",html,selection_command
389
+ 388,478767,"index.html",291,0,"",html,selection_mouse
390
+ 389,479728,"index.html",258,56,"You can reach me at \<my_first_name\>@\<our_domain\>.org",html,selection_command
391
+ 390,492189,"index.html",291,0,"",html,selection_command
392
+ 391,496416,"index.html",320,0,"",html,selection_command
393
+ 392,497371,"index.html",321,0,"\n <br>",html,content
394
+ 393,497390,"index.html",324,0,"",html,selection_command
395
+ 394,525770,"index.html",279,0,"",html,selection_mouse
396
+ 395,527877,"index.html",280,0,"",html,selection_command
397
+ 396,528119,"index.html",279,1,"",html,content
398
+ 397,528344,"index.html",279,0,"@&lt;",html,content
399
+ 398,528346,"index.html",284,0,"",html,selection_keyboard
400
+ 399,528962,"index.html",283,0,"",html,selection_command
401
+ 400,529259,"index.html",282,0,"",html,selection_command
402
+ 401,529508,"index.html",281,0,"",html,selection_command
403
+ 402,529597,"index.html",280,0,"",html,selection_command
404
+ 403,529756,"index.html",279,0,"",html,selection_command
405
+ 404,530251,"index.html",278,1,"",html,content
406
+ 405,530373,"index.html",277,0,"",html,selection_command
407
+ 406,530590,"index.html",278,0,"",html,selection_command
408
+ 407,530848,"index.html",279,0,"",html,selection_command
409
+ 408,530873,"index.html",280,0,"",html,selection_command
410
+ 409,530907,"index.html",281,0,"",html,selection_command
411
+ 410,530939,"index.html",282,0,"",html,selection_command
412
+ 411,530973,"index.html",283,0,"",html,selection_command
413
+ 412,531006,"index.html",284,0,"",html,selection_command
414
+ 413,531040,"index.html",285,0,"",html,selection_command
415
+ 414,531073,"index.html",286,0,"",html,selection_command
416
+ 415,531107,"index.html",287,0,"",html,selection_command
417
+ 416,531139,"index.html",288,0,"",html,selection_command
418
+ 417,531173,"index.html",289,0,"",html,selection_command
419
+ 418,531206,"index.html",290,0,"",html,selection_command
420
+ 419,531245,"index.html",291,0,"",html,selection_command
421
+ 420,531273,"index.html",292,0,"",html,selection_command
422
+ 421,531306,"index.html",293,0,"",html,selection_command
423
+ 422,531338,"index.html",294,0,"",html,selection_command
424
+ 423,531372,"index.html",295,0,"",html,selection_command
425
+ 424,531405,"index.html",296,0,"",html,selection_command
426
+ 425,531439,"index.html",297,0,"",html,selection_command
427
+ 426,531913,"index.html",296,0,"",html,selection_command
428
+ 427,532781,"index.html",297,0,"",html,selection_command
429
+ 428,532943,"index.html",298,0,"",html,selection_command
430
+ 429,533179,"index.html",297,1,"",html,content
431
+ 430,534808,"index.html",296,1,"",html,content
432
+ 431,535324,"index.html",296,0,"@&lt;",html,content
433
+ 432,535328,"index.html",301,0,"",html,selection_keyboard
434
+ 433,540124,"index.html",300,0,"",html,selection_command
435
+ 434,540593,"index.html",299,0,"",html,selection_command
436
+ 435,541730,"index.html",299,1,"t",html,selection_command
437
+ 436,541826,"index.html",298,2,"lt",html,selection_command
438
+ 437,541938,"index.html",298,2,"",html,content
439
+ 438,542391,"index.html",298,0,"g",html,content
440
+ 439,542395,"index.html",299,0,"",html,selection_keyboard
441
+ 440,542612,"index.html",299,0,"t",html,content
442
+ 441,542621,"index.html",300,0,"",html,selection_keyboard
443
+ 442,542868,"index.html",299,0,"",html,selection_command
444
+ 443,543165,"index.html",298,0,"",html,selection_command
445
+ 444,544114,"index.html",299,0,"",html,selection_command
446
+ 445,544322,"index.html",300,0,"",html,selection_command
447
+ 446,544976,"index.html",299,0,"",html,selection_command
448
+ 447,545162,"index.html",298,0,"",html,selection_command
449
+ 448,545331,"index.html",297,0,"",html,selection_command
450
+ 449,545573,"index.html",296,0,"",html,selection_command
451
+ 450,552504,"index.html",296,1,"",html,content
452
+ 451,552628,"index.html",283,0,"",html,selection_command
453
+ 452,552769,"index.html",282,0,"",html,selection_command
454
+ 453,553049,"index.html",280,0,"",html,selection_command
455
+ 454,553236,"index.html",278,0,"",html,selection_command
456
+ 455,553593,"index.html",278,1,"",html,content
457
+ 456,554351,"index.html",279,0,"",html,selection_command
458
+ 457,554596,"index.html",280,0,"",html,selection_command
459
+ 458,554627,"index.html",281,0,"",html,selection_command
460
+ 459,554660,"index.html",282,0,"",html,selection_command
461
+ 460,554695,"index.html",283,0,"",html,selection_command
462
+ 461,554728,"index.html",284,0,"",html,selection_command
463
+ 462,554761,"index.html",285,0,"",html,selection_command
464
+ 463,554797,"index.html",286,0,"",html,selection_command
465
+ 464,554991,"index.html",287,0,"",html,selection_command
466
+ 465,556225,"index.html",314,0,"&gt;",html,content
467
+ 466,556225,"index.html",312,2,"",html,content
468
+ 467,556225,"index.html",302,0,"&lt;",html,content
469
+ 468,556225,"index.html",300,2,"",html,content
470
+ 469,581018,"index.html",282,0,"",html,selection_command
471
+ 470,581160,"index.html",281,0,"",html,selection_command
472
+ 471,581269,"index.html",279,0,"",html,selection_command
473
+ 472,581646,"index.html",278,0,"",html,selection_command
474
+ 473,583688,"index.html",278,0,"<",html,content
475
+ 474,583691,"index.html",279,0,"",html,selection_keyboard
476
+ 475,583759,"index.html",279,0,">",html,content
477
+ 476,583762,"index.html",280,0,"",html,selection_keyboard
478
+ 477,584253,"index.html",279,0,"",html,selection_command
479
+ 478,584486,"index.html",279,0,"c",html,content
480
+ 479,584488,"index.html",280,0,"",html,selection_keyboard
481
+ 480,584626,"index.html",280,0,"o",html,content
482
+ 481,584628,"index.html",281,0,"",html,selection_keyboard
483
+ 482,584701,"index.html",281,0,"d",html,content
484
+ 483,584703,"index.html",282,0,"",html,selection_keyboard
485
+ 484,584753,"index.html",282,0,"e",html,content
486
+ 485,584754,"index.html",283,0,"",html,selection_keyboard
487
+ 486,585006,"index.html",282,0,"",html,selection_command
488
+ 487,585695,"index.html",328,0,"",html,selection_command
489
+ 488,586173,"index.html",328,0,"<",html,content
490
+ 489,586175,"index.html",329,0,"",html,selection_keyboard
491
+ 490,586288,"index.html",329,0,">",html,content
492
+ 491,586290,"index.html",330,0,"",html,selection_keyboard
493
+ 492,586646,"index.html",329,0,"",html,selection_command
494
+ 493,586931,"index.html",329,0,"/",html,content
495
+ 494,586933,"index.html",330,0,"",html,selection_keyboard
496
+ 495,587039,"index.html",330,0,"code",html,content
497
+ 496,587241,"index.html",334,0,"c",html,content
498
+ 497,587243,"index.html",335,0,"",html,selection_keyboard
499
+ 498,587344,"index.html",335,0,"o",html,content
500
+ 499,587345,"index.html",336,0,"",html,selection_keyboard
501
+ 500,587457,"index.html",336,0,"d",html,content
502
+ 501,587458,"index.html",337,0,"",html,selection_keyboard
503
+ 502,587488,"index.html",337,0,"e",html,content
504
+ 503,587489,"index.html",338,0,"",html,selection_keyboard
505
+ 504,587754,"index.html",337,1,"",html,content
506
+ 505,587904,"index.html",336,1,"",html,content
507
+ 506,588044,"index.html",335,1,"",html,content
508
+ 507,588175,"index.html",334,1,"",html,content
509
+ 508,588257,"index.html",333,0,"",html,selection_command
510
+ 509,618072,"index.html",258,0,"",html,selection_command
511
+ 510,618922,"index.html",251,0,"",html,selection_command
512
+ 511,619267,"index.html",236,0,"",html,selection_command
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-67d7ccbe-baea-44be-8c55-3246f601694c1764925612614-2025_12_05-10.07.03.648/source.csv ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,2,"src/extension.ts",0,0,"import * as vscode from 'vscode';\nimport * as https from 'https';\nimport * as http from 'http';\nimport { Buffer } from 'buffer';\n\n\nconst SGLANG_HOSTNAME = 'hai007';\nconst SGLANG_PORT = 30000;\nconst SGLANG_BASE_PATH = '/v1/chat/completions';\nconst SGLANG_MODEL_NAME = 'qwen/qwen3-0.6b';\n\nconst GEMINI_HOSTNAME = 'generativelanguage.googleapis.com';\nconst GEMINI_PORT = 443;\nconst GEMINI_BASE_PATH = '/v1beta/openai/chat/completions';\nconst GEMINI_MODEL_NAME = 'gemini-2.5-flash';\n\nconst USE_GEMINI = false;\n\nexport function activate(context: vscode.ExtensionContext) {\n\n\tconsole.log('[crowd-pilot] Extension activated');\n\n\t// Configure terminal to allow tab keybinding to work\n\t(async () => {\n\t\tconst config = vscode.workspace.getConfiguration('terminal.integrated');\n\t\tconst commandsToSkipShell = config.get<string[]>('commandsToSkipShell', []);\n\t\tlet updated = false;\n\t\tif (!commandsToSkipShell.includes('crowd-pilot.modelRun')) {\n\t\t\tcommandsToSkipShell.push('crowd-pilot.modelRun');\n\t\t\tupdated = true;\n\t\t}\n\t\tif (!commandsToSkipShell.includes('crowd-pilot.hideUi')) {\n\t\t\tcommandsToSkipShell.push('crowd-pilot.hideUi');\n\t\t\tupdated = true;\n\t\t}\n\t\tif (updated) {\n\t\t\tawait config.update('commandsToSkipShell', commandsToSkipShell, vscode.ConfigurationTarget.Global);\n\t\t}\n\t})().catch((err) => console.error('[crowd-pilot] Startup initialization error:', err));\n\n\tconst hideUi = vscode.commands.registerCommand('crowd-pilot.hideUi', () => {\n\t\thidePreviewUI(true);\n\t});\n\n\tconst modelRun = vscode.commands.registerCommand('crowd-pilot.modelRun', async () => {\n\t\tconst editor = vscode.window.activeTextEditor;\n\t\tif (!editor) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\t// Confirm only when a suggestion is visible\n\t\t\tif (!previewVisible) { return; }\n\t\t\tlet action: PlannedAction | undefined = currentAction;\n\t\t\tif (!action) {\n\t\t\t\tconst single = await requestModelActions(editor);\n\t\t\t\tcurrentAction = single;\n\t\t\t\taction = single;\n\t\t\t}\n\t\t\tif (!action) {\n\t\t\t\thidePreviewUI();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thidePreviewUI(false);\n\t\t\tawait executeAction(action);\n\t\t\tautoShowNextAction();\n\t\t} catch (err) {\n\t\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\t\tvscode.window.showErrorMessage(`Model run failed: ${errorMessage}`);\n\t\t}\n\t});\n\n\tconst sglangTest = vscode.commands.registerCommand('crowd-pilot.sglangTest', async () => {\n\t\ttry {\n\t\t\tawait callSGLangChat();\n\t\t} catch (err) {\n\t\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\t\tvscode.window.showErrorMessage(`SGLang test failed: ${errorMessage}`);\n\t\t}\n\t});\n\n\t// Auto-preview listeners\n\tconst debouncedAutoPreview = debounce(() => {\n\t\tautoShowNextAction();\n\t}, 250);\n\tconst onSelChange = vscode.window.onDidChangeTextEditorSelection((e) => {\n\t\tif (e.textEditor === vscode.window.activeTextEditor) {\n\t\t\tsuppressAutoPreview = false;\n\t\t\tdebouncedAutoPreview();\n\t\t}\n\t});\n\tconst onActiveChange = vscode.window.onDidChangeActiveTextEditor(() => {\n\t\tsuppressAutoPreview = false;\n\t\tdebouncedAutoPreview();\n\t});\n\tconst onDocChange = vscode.workspace.onDidChangeTextDocument((e) => {\n\t\tif (vscode.window.activeTextEditor?.document === e.document) {\n\t\t\tsuppressAutoPreview = false;\n\t\t\tdebouncedAutoPreview();\n\t\t}\n\t});\n\n\tcontext.subscriptions.push(hideUi, sglangTest, modelRun, onSelChange, onActiveChange, onDocChange);\n}\n\nexport function deactivate() {}\n\n// -------------------- Plan Types & Execution --------------------\ntype PlannedAction =\n| { kind: 'showTextDocument' }\n| { kind: 'setSelections', selections: Array<{ start: [number, number], end: [number, number] }> }\n| { kind: 'editInsert', position: [number, number], text: string }\n| { kind: 'editDelete', range: { start: [number, number], end: [number, number] } }\n| { kind: 'editReplace', range: { start: [number, number], end: [number, number] }, text: string }\n| { kind: 'terminalShow' }\n| { kind: 'terminalSendText', text: string };\n\nlet currentAction: PlannedAction | undefined;\n\nasync function executeAction(action: PlannedAction): Promise<void> {\n\tconst editor = vscode.window.activeTextEditor;\n\tif (!editor) { return; }\n\tconst doc = editor.document;\n\tconst term = vscode.window.terminals[0] ?? vscode.window.createTerminal('Test');\n\tif (action.kind === 'showTextDocument') {\n\t\tawait vscode.window.showTextDocument(doc);\n\t\treturn;\n\t}\n\tif (action.kind === 'setSelections') {\n\t\teditor.selections = action.selections.map(s => new vscode.Selection(\n\t\t\tnew vscode.Position(s.start[0], s.start[1]),\n\t\t\tnew vscode.Position(s.end[0], s.end[1])\n\t\t));\n\t\tif (editor.selections.length > 0) {\n\t\t\teditor.revealRange(editor.selections[0], vscode.TextEditorRevealType.InCenterIfOutsideViewport);\n\t\t}\n\t\treturn;\n\t}\n\tif (action.kind === 'editInsert') {\n\t\tawait editor.edit((e: vscode.TextEditorEdit) => e.insert(new vscode.Position(action.position[0], action.position[1]), action.text));\n\t\treturn;\n\t}\n\tif (action.kind === 'editDelete') {\n\t\tconst range = new vscode.Range(\n\t\t\tnew vscode.Position(action.range.start[0], action.range.start[1]),\n\t\t\tnew vscode.Position(action.range.end[0], action.range.end[1])\n\t\t);\n\t\tawait editor.edit((e: vscode.TextEditorEdit) => e.delete(range));\n\t\treturn;\n\t}\n\tif (action.kind === 'editReplace') {\n\t\tconst range = new vscode.Range(\n\t\t\tnew vscode.Position(action.range.start[0], action.range.start[1]),\n\t\t\tnew vscode.Position(action.range.end[0], action.range.end[1])\n\t\t);\n\t\tawait editor.edit((e: vscode.TextEditorEdit) => e.replace(range, action.text));\n\t\treturn;\n\t}\n\tif (action.kind === 'terminalShow') {\n\t\tterm.show();\n\t\treturn;\n\t}\n\tif (action.kind === 'terminalSendText') {\n\t\tterm.sendText(action.text);\n\t\treturn;\n\t}\n}\n\n// -------------------- UI State & Helpers --------------------\nconst UI_CONTEXT_KEY = 'crowdPilot.uiVisible';\nlet previewVisible = false;\nlet decorationDeleteType: vscode.TextEditorDecorationType | undefined;\nlet decorationReplaceType: vscode.TextEditorDecorationType | undefined;\nlet decorationReplaceBlockType: vscode.TextEditorDecorationType | undefined;\nlet mockStep = 0;\nlet suppressAutoPreview = false;\nlet latestRequestId = 0;\nlet currentAbortController: AbortController | undefined;\n\nfunction disposePreviewDecorations() {\n\ttry { decorationDeleteType?.dispose(); } catch {}\n\ttry { decorationReplaceType?.dispose(); } catch {}\n\ttry { decorationReplaceBlockType?.dispose(); } catch {}\n\tdecorationDeleteType = undefined;\n\tdecorationReplaceType = undefined;\n\tdecorationReplaceBlockType = undefined;\n}\n\nfunction debounce<T extends (...args: any[]) => void>(fn: T, waitMs: number) {\n\tlet timer: NodeJS.Timeout | undefined;\n\treturn (...args: Parameters<T>) => {\n\t\tif (timer) { clearTimeout(timer); }\n\t\ttimer = setTimeout(() => fn(...args), waitMs);\n\t};\n}\n\nfunction getDynamicMargin(editor: vscode.TextEditor, anchorLine: number, text: string): string {\n\t// Count lines in the preview text\n\tconst lines = text.split(/\r?\n/);\n\tconst height = lines.length;\n\t\n\t// We need to check the document lines that will be covered by this panel.\n\t// The panel starts at 'anchorLine' and extends downwards by 'height' lines.\n\t// However, visually, since it's 'after', it sits to the right of 'anchorLine',\n\t// and then flows down.\n\t// So we check document lines from anchorLine to anchorLine + height - 1.\n\t\n\tconst doc = editor.document;\n\tlet maxLen = 0;\n\tconst startLine = anchorLine;\n\tconst endLine = Math.min(doc.lineCount - 1, anchorLine + height - 1);\n\t\n\tfor (let i = startLine; i <= endLine; i++) {\n\t\tconst lineText = doc.lineAt(i).text;\n\t\t// Simple approximation: assume tabs are 4 spaces if we can't get config easily, \n\t\t// or just treat them as 1 char (which might underestimate). \n\t\t// Better to overestimate: treat tab as 4 chars.\n\t\tconst len = lineText.replace(/\t/g, ' ').length;\n\t\tif (len > maxLen) {\n\t\t\tmaxLen = len;\n\t\t}\n\t}\n\t\n\t// Length of the anchor line itself\n\tconst anchorLineText = doc.lineAt(anchorLine).text;\n\tconst anchorLen = anchorLineText.replace(/\t/g, ' ').length;\n\t\n\t// The offset needed is maxLen - anchorLen.\n\t// If maxLen <= anchorLen, offset is 0 (margin is just base padding).\n\t// If maxLen > anchorLen, we need to push right by (maxLen - anchorLen).\n\t\n\tconst diff = Math.max(0, maxLen - anchorLen);\n\t// Base margin 2rem is roughly 4ch. Let's use ch units for everything to be consistent.\n\t// 1ch is width of '0'. In monospace, mostly consistent.\n\t// Add 3ch extra padding for safety/visual gap.\n\tconst margin = diff + 4; \n\treturn `${margin}ch`;\n}\n\nfunction showPreviewUI(action: PlannedAction): void {\n\tconst editor = vscode.window.activeTextEditor;\n\tif (!editor) { return; }\n\tdisposePreviewDecorations();\n\n\t// FIXME (f.srambical): add file switch \n\tconst next = (action.kind === 'editInsert' || action.kind === 'editDelete' || action.kind === 'editReplace' || action.kind === 'terminalSendText' || action.kind === 'setSelections') ? action : undefined;\n\tif (!next) {\n\t\tpreviewVisible = false;\n\t\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, false);\n\t\tcurrentAction = action;\n\t\treturn;\n\t}\n\n\tconst trimText = (t: string) => {\n\t\tconst oneLine = t.replace(/\r?\n/g, '\\n');\n\t\treturn oneLine.length > 80 ? oneLine.slice(0, 77) + '…' : oneLine;\n\t};\n\n\tif (next.kind === 'setSelections') {\n\t\t// For setSelections, we only preview the primary selection's start/active position\n\t\tconst selection = next.selections[0];\n\t\tconst targetPos = new vscode.Position(selection.start[0], selection.start[1]);\n\t\t// Check if the target position is visible\n\t\tconst isVisible = editor.visibleRanges.some(r => r.contains(targetPos));\n\t\t\n\t\tlet anchorPos = targetPos;\n\t\tlet label = ""↳ Move Cursor Here"";\n\n\t\tif (!isVisible && editor.visibleRanges.length > 0) {\n\t\t\tconst firstVisible = editor.visibleRanges[0].start;\n\t\t\tconst lastVisible = editor.visibleRanges[editor.visibleRanges.length - 1].end;\n\t\t\t\n\t\t\tif (targetPos.isBefore(firstVisible)) {\n\t\t\t\tanchorPos = editor.document.lineAt(firstVisible.line).range.end;\n\t\t\t} else {\n\t\t\t\tanchorPos = editor.document.lineAt(lastVisible.line).range.end;\n\t\t\t}\n\n\t\t\tif (targetPos.line < anchorPos.line) {\n\t\t\t\tlabel = `↑ Move Cursor to Line ${targetPos.line + 1}`;\n\t\t\t} else {\n\t\t\t\tlabel = `↓ Move Cursor to Line ${targetPos.line + 1}`;\n\t\t\t}\n\t\t}\n\n\t\tconst margin = getDynamicMargin(editor, anchorPos.line, label);\n\n\t\tdecorationReplaceBlockType = vscode.window.createTextEditorDecorationType({\n\t\t\tafter: {\n\t\t\t\tcontentText: '',\n\t\t\t\tcolor: new vscode.ThemeColor('charts.purple'),\n\t\t\t\tbackgroundColor: new vscode.ThemeColor('editor.background'),\n\t\t\t\tfontStyle: 'italic',\n\t\t\t\tfontWeight: '600',\n\t\t\t\tmargin: `0 0 0 ${margin}`,\n\t\t\t\ttextDecoration: `none; display: inline-block; white-space: pre; content: ""${label}""; border: 1px solid var(--vscode-charts-purple); padding: 4px; border-radius: 4px; box-shadow: 0 4px 8px rgba(0,0,0,0.25); pointer-events: none; position: relative; z-index: 100; vertical-align: top;`\n\t\t\t}\n\t\t});\n\t\teditor.setDecorations(decorationReplaceBlockType, [{ range: new vscode.Range(anchorPos, anchorPos) }]);\n\t} else if (next.kind === 'terminalSendText') {\n\t\tconst cursor = editor.selection.active;\n\t\tconst lineEnd = editor.document.lineAt(cursor.line).range.end;\n\t\tconst summary = trimText(next.text || '');\n\t\tconst label = `↳ Execute shell command in terminal: ${summary}`;\n\t\tconst margin = getDynamicMargin(editor, cursor.line, label);\n\n\t\tdecorationReplaceBlockType = vscode.window.createTextEditorDecorationType({\n\t\t\tafter: {\n\t\t\t\tcontentText: '',\n\t\t\t\tcolor: new vscode.ThemeColor('charts.purple'),\n\t\t\t\tbackgroundColor: new vscode.ThemeColor('editor.background'),\n\t\t\t\tfontStyle: 'italic',\n\t\t\t\tfontWeight: '600',\n\t\t\t\tmargin: `0 0 0 ${margin}`,\n\t\t\t\ttextDecoration: `none; display: inline-block; white-space: pre; content: ""${label.replace(/""/g, '\\""')}""; border: 1px solid var(--vscode-charts-purple); padding: 4px; border-radius: 4px; box-shadow: 0 4px 8px rgba(0,0,0,0.25); pointer-events: none; position: relative; z-index: 100; vertical-align: top;`\n\t\t\t}\n\t\t});\n\t\teditor.setDecorations(decorationReplaceBlockType, [{ range: new vscode.Range(lineEnd, lineEnd) }]);\n\t} else if (next.kind === 'editInsert') {\n\t\tconst posLine = next.position[0];\n\t\tconst fullBlock = next.text;\n\t\tconst cssContent = fullBlock\n\t\t\t.replace(/""/g, '\\""')\n\t\t\t.replace(/\r?\n/g, '\\A ');\n\n\t\tconst docLineCount = editor.document.lineCount;\n\t\t// If inserting at EOF (or beyond), attach to the last line.\n\t\t// Otherwise, attach to the line AT the insertion point and shift visually UP into the gap.\n\t\tlet anchorLine = posLine;\n\t\tlet shiftUp = true;\n\t\t\n\t\tif (anchorLine >= docLineCount) {\n\t\t\tanchorLine = docLineCount - 1;\n\t\t\tshiftUp = false; // At EOF, we just append below or to the right\n\t\t}\n\n\t\tconst anchorPos = new vscode.Position(anchorLine, Number.MAX_VALUE); \n\t\t\n\t\t// We attach to the line AT the insertion point.\n\t\t// The panel floats to the right of this line.\n\t\t// The dashed line connects the start of this line to the panel.\n\t\t// This indicates that the new text will be inserted at this line position (pushing the current line down).\n\t\tconst marginCheckLine = anchorLine;\n\t\tconst margin = getDynamicMargin(editor, marginCheckLine, fullBlock);\n\n\t\tconst topOffset = '0';\n\n\t\t// Dashed line style\n\t\t// We use 'before' decoration for the line.\n\t\t// It needs to be absolute, full width (or enough to reach left), \n\t\t// and aligned with the panel top.\n\t\tconst beforeDecoration = {\n\t\t\tcontentText: '',\n\t\t\ttextDecoration: `none; position: absolute; left: 0; width: 100vw; border-top: 1px dashed var(--vscode-charts-purple); top: 0; height: 0; z-index: 99; pointer-events: none;`\n\t\t};\n\n\t\tdecorationReplaceBlockType = vscode.window.createTextEditorDecorationType({\n\t\t\tbefore: beforeDecoration,\n\t\t\tafter: {\n\t\t\t\tcontentText: '',\n\t\t\t\tcolor: new vscode.ThemeColor('charts.purple'),\n\t\t\t\tbackgroundColor: new vscode.ThemeColor('editor.background'),\n\t\t\t\tfontStyle: 'italic',\n\t\t\t\tfontWeight: '600',\n\t\t\t\tmargin: `0 0 0 ${margin}`,\n\t\t\t\ttextDecoration: `none; display: inline-block; white-space: pre; content: ""${cssContent}""; border: 1px solid var(--vscode-charts-purple); padding: 4px; border-radius: 4px; box-shadow: 0 4px 8px rgba(0,0,0,0.25); pointer-events: none; position: relative; z-index: 100; vertical-align: top; top: ${topOffset};`\n\t\t\t}\n\t\t});\n\t\teditor.setDecorations(decorationReplaceBlockType, [{ range: new vscode.Range(anchorPos, anchorPos) }]);\n\t} else if (next.kind === 'editDelete') {\n\t\tconst range = new vscode.Range(\n\t\t\tnew vscode.Position(next.range.start[0], next.range.start[1]),\n\t\t\tnew vscode.Position(next.range.end[0], next.range.end[1])\n\t\t);\n\t\tdecorationDeleteType = vscode.window.createTextEditorDecorationType({\n\t\t\tbackgroundColor: 'rgba(255, 60, 60, 0.18)',\n\t\t\tborder: '1px solid rgba(255, 60, 60, 0.35)',\n\t\t\ttextDecoration: 'line-through'\n\t\t});\n\t\teditor.setDecorations(decorationDeleteType, [{ range }]);\n\t} else if (next.kind === 'editReplace') {\n\t\tconst range = new vscode.Range(\n\t\t\tnew vscode.Position(next.range.start[0], next.range.start[1]),\n\t\t\tnew vscode.Position(next.range.end[0], next.range.end[1])\n\t\t);\n\t\t// Highlight original range (to be replaced)\n\t\tdecorationReplaceType = vscode.window.createTextEditorDecorationType({\n\t\t\tbackgroundColor: 'rgba(255,165,0,0.15)',\n\t\t\tborder: '1px dashed rgba(255,165,0,0.45)',\n\t\t\tcolor: new vscode.ThemeColor('disabledForeground'),\n\t\t\ttextDecoration: 'line-through'\n\t\t});\n\t\teditor.setDecorations(decorationReplaceType, [{ range }]);\n\n\t\t// Show replacement block to the right of the first replaced line\n\t\tconst fullBlock = next.text;\n\t\t\n\t\t// CSS-escape the text for the 'content' property:\n\t\t// - Escape double quotes\n\t\t// - Replace newlines with \A (CSS newline)\n\t\tconst cssContent = fullBlock\n\t\t\t.replace(/""/g, '\\""')\n\t\t\t.replace(/\r?\n/g, '\\A '); \n\n\t\t// Attach 'after' decoration to the start of the replacement range\n\t\t// (Actually, attaching to the end of the first line is safer for 'after')\n\t\tconst anchorLine = range.start.line;\n\t\tconst anchorPos = new vscode.Position(anchorLine, Number.MAX_VALUE);\n\t\tconst margin = getDynamicMargin(editor, anchorLine, fullBlock);\n\n\t\tdecorationReplaceBlockType = vscode.window.createTextEditorDecorationType({\n\t\t\tafter: {\n\t\t\t\tcontentText: '', // Handled by CSS content\n\t\t\t\tcolor: new vscode.ThemeColor('charts.purple'),\n\t\t\t\tbackgroundColor: new vscode.ThemeColor('editor.background'),\n\t\t\t\tfontStyle: 'italic',\n\t\t\t\tfontWeight: '600',\n\t\t\t\tmargin: `0 0 0 ${margin}`,\n\t\t\t\ttextDecoration: `none; display: inline-block; white-space: pre; content: ""${cssContent}""; border: 1px solid var(--vscode-charts-purple); padding: 4px; border-radius: 4px; box-shadow: 0 4px 8px rgba(0,0,0,0.25); pointer-events: none; position: relative; z-index: 100; vertical-align: top;`\n\t\t\t}\n\t\t});\n\t\teditor.setDecorations(decorationReplaceBlockType, [{ range: new vscode.Range(anchorPos, anchorPos) }]);\n\t}\n\n\tpreviewVisible = true;\n\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, true);\n\tcurrentAction = action;\n}\n\nfunction hidePreviewUI(suppress?: boolean): void {\n\tdisposePreviewDecorations();\n\tpreviewVisible = false;\n\tvscode.commands.executeCommand('setContext', UI_CONTEXT_KEY, false);\n\tif (suppress) {\n\t\tsuppressAutoPreview = true;\n\t}\n}\n\n// -------------------- Hardcoded single-step actions --------------------\nfunction getHardcodedNextAction(editor: vscode.TextEditor): PlannedAction | undefined {\n\tconst cursor = editor.selection.active;\n\tconst doc = editor.document;\n\tconst lineCount = doc.lineCount;\n\tconst clamp = (n: number, min: number, max: number) => Math.max(min, Math.min(max, n));\n\n\t// Step 0: Insert multiline content two lines below the cursor (start of target line)\n\tif (mockStep === 0) {\n\t\tconst targetLine = clamp(cursor.line + 2, 0, Math.max(0, lineCount - 1));\n\t\treturn {\n\t\t\tkind: 'editInsert',\n\t\t\tposition: [targetLine, 0],\n\t\t\ttext: '/* crowd-pilot: insert start */\nline A\nline B\n/* crowd-pilot: insert end */\n'\n\t\t};\n\t}\n\t// Step 1: Replace a two-line range three and four lines below the cursor\n\tif (mockStep === 1) {\n\t\tconst startLine = clamp(cursor.line + 3, 0, Math.max(0, lineCount - 1));\n\t\tconst endLine = clamp(startLine + 1, 0, Math.max(0, lineCount - 1));\n\t\tconst endChar = doc.lineAt(endLine).range.end.character;\n\t\tconst range = {\n\t\t\tstart: [startLine, 0] as [number, number],\n\t\t\tend: [endLine, endChar] as [number, number]\n\t\t};\n\t\tconst replacement = [\n\t\t\t'/* crowd-pilot: replacement */',\n\t\t\t'REPLACED LINE 1',\n\t\t\t'REPLACED LINE 2'\n\t\t].join('\n');\n\t\treturn { kind: 'editReplace', range, text: replacement };\n\t}\n\t// Step 2: Delete a three-line range six to eight lines below the cursor\n\tif (mockStep === 2) {\n\t\tconst startLine = clamp(cursor.line + 6, 0, Math.max(0, lineCount - 1));\n\t\tconst endLine = clamp(startLine + 2, 0, Math.max(0, lineCount - 1));\n\t\t\n\t\t// To fully delete the lines including the newline, we target the start of the next line.\n\t\tlet endPosLine = endLine + 1;\n\t\tlet endPosChar = 0;\n\t\t\n\t\tif (endPosLine >= lineCount) {\n\t\t\t// If deleting the last line(s), just go to the end of the document\n\t\t\tendPosLine = lineCount - 1;\n\t\t\tendPosChar = doc.lineAt(endPosLine).range.end.character;\n\t\t}\n\n\t\tconst range = {\n\t\t\tstart: [startLine, 0] as [number, number],\n\t\t\tend: [endPosLine, endPosChar] as [number, number]\n\t\t};\n\t\treturn { kind: 'editDelete', range };\n\t}\n\t// Step 3: Execute in Terminal\n\tif (mockStep === 3) {\n\t\treturn { kind: 'terminalSendText', text: 'echo ""Hello World""' };\n\t}\n\t// Step 4: Move Cursor to End of File\n\tif (mockStep === 4) {\n\t\tconst lastLine = doc.lineCount - 1;\n\t\tconst lastChar = doc.lineAt(lastLine).range.end.character;\n\t\treturn {\n\t\t\tkind: 'setSelections',\n\t\t\tselections: [{ start: [lastLine, lastChar], end: [lastLine, lastChar] }]\n\t\t};\n\t}\n\treturn undefined;\n}\n\nfunction advanceMockStep(): void {\n\tmockStep = (mockStep + 1) % 5;\n}\n\nasync function autoShowNextAction(): Promise<void> {\n\tif (suppressAutoPreview) { return; }\n\tconst editor = vscode.window.activeTextEditor;\n\tif (!editor) { return; }\n\ttry {\n\t\tcurrentAbortController?.abort();\n\t\tconst controller = new AbortController();\n\t\tcurrentAbortController = controller;\n\t\tconst requestId = ++latestRequestId;\n\t\tconst next = await requestModelActions(editor, controller.signal);\n\t\tif (requestId !== latestRequestId) { return; }\n\t\tif (next) { showPreviewUI(next); } else { hidePreviewUI(); }\n\t} catch (err) {\n\t\tconst e = err as any;\n\t\tconst isAbort = e?.name === 'AbortError' || /aborted/i.test(String(e?.message ?? ''));\n\t\tif (isAbort) { return; }\n\t\thidePreviewUI();\n\t}\n}\n\n// -------------------- SGLang Client (simple test) --------------------\nasync function callSGLangChat(): Promise<void> {\n\tconst config = vscode.workspace.getConfiguration();\n\t\n\tlet hostname: string;\n\tlet port: number;\n\tlet path: string;\n\tlet useHttps = true;\n\tlet modelName: string;\n\tconst headers: any = {\n\t\t'Content-Type': 'application/json'\n\t};\n\n\tif (!USE_GEMINI) {\n\t\t// SGLang\n\t\thostname = SGLANG_HOSTNAME;\n\t\tport = SGLANG_PORT;\n\t\tpath = SGLANG_BASE_PATH;\n\t\tuseHttps = false; \n\t\tmodelName = SGLANG_MODEL_NAME;\n\t} else {\n\t\t// Gemini\n\t\tconst apiKey = config.get<string>('crowd-pilot.apiKey');\n\t\tif (!apiKey) {\n\t\t\tvscode.window.showErrorMessage('Crowd Pilot: Please set your API Key in settings (crowd-pilot.apiKey).');\n\t\t\treturn;\n\t\t}\n\t\thostname = GEMINI_HOSTNAME;\n\t\tport = GEMINI_PORT;\n\t\tpath = GEMINI_BASE_PATH;\n\t\theaders['Authorization'] = `Bearer ${apiKey}`;\n\t\tmodelName = GEMINI_MODEL_NAME;\n\t}\n\n\tconst requestBody: any = {\n\t\tmodel: modelName,\n\t\tmessages: [\n\t\t\t{ role: 'user', content: 'What is the capital of France?' }\n\t\t]\n\t};\n\tif (!USE_GEMINI) {\n\t\trequestBody.temperature = 0.7;\n\t\trequestBody.top_p = 0.8;\n\t\trequestBody.top_k = 20;\n\t\trequestBody.min_p = 0;\n\t\trequestBody.extra_body = {\n\t\t\tchat_template_kwargs: {\n\t\t\t\tenable_thinking: false\n\t\t\t}\n\t\t};\n\t}\n\tconst postData = JSON.stringify(requestBody);\n\theaders['Content-Length'] = Buffer.byteLength(postData);\n\n\tconst options = {\n\t\thostname,\n\t\tport,\n\t\tpath,\n\t\tmethod: 'POST',\n\t\theaders\n\t};\n\n\tconst requestModule = useHttps ? https : http;\n\n\ttry {\n\t\tconst json = await new Promise<any>((resolve, reject) => {\n\t\t\tconst req = requestModule.request(options, (res: http.IncomingMessage) => {\n\t\t\t\tlet data = '';\n\t\t\t\tres.on('data', (chunk: Buffer) => {\n\t\t\t\t\tdata += chunk.toString();\n\t\t\t\t});\n\t\t\t\tres.on('end', () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treq.on('error', (err: Error) => {\n\t\t\t\treject(err);\n\t\t\t});\n\n\t\t\treq.write(postData);\n\t\t\treq.end();\n\t\t});\n\n\t\tvscode.window.showInformationMessage(`Response: ${JSON.stringify(json, null, 2)}`);\n\t} catch (err) {\n\t\tconst errorMessage = err instanceof Error ? err.message : String(err);\n\t\tvscode.window.showErrorMessage(`Request failed: ${errorMessage}`);\n\t}\n}\n\n// -------------------- Prompt Serialization Helpers --------------------\nfunction formatStdoutBlock(content: string): string {\n\tconst normalized = content ?? '';\n\treturn `<stdout>\n${normalized}\n</stdout>`;\n}\n\nfunction formatLineNumberedOutput(content: string, startLine?: number, endLine?: number): string {\n\tconst lines = content.split(/\r?\n/);\n\tconst total = (lines.length === 1 && lines[0] === '') ? 0 : lines.length;\n\tif (total === 0) {\n\t\treturn '';\n\t}\n\tconst s = startLine !== undefined ? Math.max(1, Math.min(startLine, total)) : 1;\n\tconst e = endLine !== undefined ? Math.max(s, Math.min(endLine, total)) : total;\n\tconst buf: string[] = [];\n\tfor (let idx = s; idx <= e; idx++) {\n\t\tconst lineText = lines[idx - 1] ?? '';\n\t\tbuf.push(`${idx.toString().padStart(6, ' ')}\t${lineText}`);\n\t}\n\treturn buf.join('\n');\n}\n\nfunction computeViewport(totalLines: number, centerLine: number, radius: number): { start: number; end: number } {\n\tif (totalLines <= 0) {\n\t\treturn { start: 1, end: 0 };\n\t}\n\tconst start = Math.max(1, centerLine - radius);\n\tconst end = Math.min(totalLines, centerLine + radius);\n\treturn { start, end };\n}\n\nfunction fencedBashBlock(command: string): string {\n\tconst cleaned = command.replace(/\r/g, '').trim();\n\treturn `\`\`\`bash\n${cleaned}\n\`\`\``;\n}\n\n// -------------------- Model-planned Actions --------------------\nasync function requestModelActions(editor: vscode.TextEditor, signal?: AbortSignal): Promise<PlannedAction> {\n\tconst config = vscode.workspace.getConfiguration();\n\t\n\tlet hostname: string;\n\tlet port: number;\n\tlet path: string;\n\tlet useHttps = true;\n\tlet modelName: string;\n\tconst headers: any = {\n\t\t'Content-Type': 'application/json'\n\t};\n\n\tif (!USE_GEMINI) {\n\t\t// SGLang\n\t\thostname = SGLANG_HOSTNAME;\n\t\tport = SGLANG_PORT;\n\t\tpath = SGLANG_BASE_PATH;\n\t\tuseHttps = false;\n\t\tmodelName = SGLANG_MODEL_NAME;\n\t} else {\n\t\t// Gemini\n\t\tconst apiKey = config.get<string>('crowd-pilot.apiKey');\n\t\tif (!apiKey) {\n\t\t\tvscode.window.showErrorMessage('Crowd Pilot: Please set your API Key in settings (crowd-pilot.apiKey).');\n\t\t\tthrow new Error('API key not set');\n\t\t}\n\t\thostname = GEMINI_HOSTNAME;\n\t\tport = GEMINI_PORT;\n\t\tpath = GEMINI_BASE_PATH;\n\t\theaders['Authorization'] = `Bearer ${apiKey}`;\n\t\tmodelName = GEMINI_MODEL_NAME;\n\t}\n\n\tconst doc = editor.document;\n\tconst cursor = editor.selection.active;\n\tconst fullText = doc.getText();\n\tconst filePath = doc.uri.fsPath;\n\tconst workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath ?? '(unknown)';\n\tconst cursorLine = cursor.line + 1;\n\tconst cursorColumn = cursor.character + 1;\n\tconst totalLines = doc.lineCount;\n\tconst viewport = computeViewport(totalLines, cursorLine, 12);\n\tconst metadataSummary = [\n\t\t`Workspace root: ${workspaceRoot}`,\n\t\t`Active file: ${filePath}`,\n\t\t`Language: ${doc.languageId}`,\n\t\t`Cursor (1-based): line ${cursorLine}, column ${cursorColumn}`\n\t].join('\n');\n\tconst metadataCommand = [\n\t\t""cat <<'EOF'"",\n\t\tmetadataSummary,\n\t\t'EOF'\n\t].join('\n');\n\n\tconst systemPrompt = [\n\t\t'You are a helpful assistant that can interact multiple times with a computer shell to solve programming tasks.',\n\t\t'Your response must contain exactly ONE bash code block with ONE command (or commands connected with && or ||).',\n\t\t'',\n\t\t'Format your response as shown in <format_example>.',\n\t\t'',\n\t\t'<format_example>',\n\t\t'```bash',\n\t\t'your_command_here',\n\t\t'```',\n\t\t'</format_example>',\n\t\t'',\n\t\t'Failure to follow these rules will cause your response to be rejected.',\n\t\t'',\n\t\t'=== EDIT COMMAND FORMAT (IMPORTANT) ===',\n\t\t'When you want to EDIT a file, you MUST encode the edit using line-based sed commands in ONE of the following forms,',\n\t\t'and you MUST NOT use substitution commands like ""Ns/old/new/g"".',\n\t\t'',\n\t\t'Assume all line numbers are 1-based and paths are absolute.',\n\t\t'Allowed edit encodings (choose exactly one per response):',\n\t\t'',\n\t\t'1) Replace a contiguous block of lines:',\n\t\t"" sed -i 'START,ENDc\\"",\n\t\t'NEW_LINE_1',\n\t\t'NEW_LINE_2',\n\t\t""..."",\n\t\t""' /abs/path/to/file && cat -n /abs/path/to/file | sed -n 'VSTART,VENDp'"",\n\t\t'',\n\t\t'2) Delete a contiguous block of lines:',\n\t\t"" sed -i 'START,ENDd' /abs/path/to/file && cat -n /abs/path/to/file | sed -n 'VSTART,VENDp'"",\n\t\t'',\n\t\t'3) Insert new lines BEFORE a given line:',\n\t\t"" sed -i 'STARTi\\"",\n\t\t'NEW_LINE_1',\n\t\t'NEW_LINE_2',\n\t\t""..."",\n\t\t""' /abs/path/to/file && cat -n /abs/path/to/file | sed -n 'VSTART,VENDp'"",\n\t\t'',\n\t\t'4) Append new lines at the END of the file:',\n\t\t"" sed -i '$a\\"",\n\t\t'NEW_LINE_1',\n\t\t'NEW_LINE_2',\n\t\t""..."",\n\t\t""' /abs/path/to/file && cat -n /abs/path/to/file | sed -n 'VSTART,VENDp'"",\n\t\t'',\n\t\t'Where VSTART and VEND specify a small viewport around the edited region.',\n\t\t'',\n\t\t'Do NOT emit commands like ""3s/print/print()/g"" or any other ""s/old/new/"" style sed substitution; instead,',\n\t\t'always rewrite the affected lines using one of the line-based forms above.',\n\t\t'',\n\t\t'When you are NOT editing files (e.g., running tests, git commands, tools, etc.), you may emit arbitrary bash commands.'\n\t].join('\n');\n\n\tconst conversationMessages: Array<{ role: 'system' | 'user' | 'assistant'; content: string }> = [\n\t\t{ role: 'system', content: systemPrompt },\n\t\t{ role: 'assistant', content: fencedBashBlock(metadataCommand) },\n\t\t{ role: 'user', content: formatStdoutBlock(metadataSummary) },\n\t\t{ role: 'assistant', content: fencedBashBlock(`cat -n ${filePath}`) },\n\t\t{ role: 'user', content: formatStdoutBlock(formatLineNumberedOutput(fullText)) }\n\t];\n\n\tif (viewport.end >= viewport.start) {\n\t\tconst viewportOutput = formatLineNumberedOutput(fullText, viewport.start, viewport.end);\n\t\tconversationMessages.push(\n\t\t\t{ role: 'assistant', content: fencedBashBlock(`cat -n ${filePath} | sed -n '${viewport.start},${viewport.end}p'`) },\n\t\t\t{ role: 'user', content: formatStdoutBlock(viewportOutput) }\n\t\t);\n\t}\n\n\tconst requestBody: any = {\n\t\tmodel: modelName,\n\t\tmessages: conversationMessages\n\t};\n\tif (!USE_GEMINI) {\n\t\trequestBody.temperature = 0.7;\n\t\trequestBody.top_p = 0.8;\n\t\trequestBody.top_k = 20;\n\t\trequestBody.min_p = 0;\n\t\trequestBody.extra_body = {\n\t\t\tchat_template_kwargs: {\n\t\t\t\tenable_thinking: false\n\t\t\t}\n\t\t};\n\t}\n\n\tconst postData = JSON.stringify(requestBody);\n\theaders['Content-Length'] = Buffer.byteLength(postData);\n\n\tconst options: any = {\n\t\thostname,\n\t\tport,\n\t\tpath,\n\t\tmethod: 'POST',\n\t\theaders\n\t};\n\tif (signal) {\n\t\toptions.signal = signal;\n\t}\n\n\tconst requestModule = useHttps ? https : http;\n\n\tconst json = await new Promise<any>((resolve, reject) => {\n\t\tconst req = requestModule.request(options, (res: http.IncomingMessage) => {\n\t\t\tlet data = '';\n\t\t\tres.on('data', (chunk: Buffer) => { data += chunk.toString(); });\n\t\t\tres.on('end', () => {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(JSON.parse(data));\n\t\t\t\t} catch (err) {\n\t\t\t\t\treject(new Error(`Failed to parse response: ${err instanceof Error ? err.message : String(err)}`));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\treq.on('error', (err: Error) => reject(err));\n\t\treq.write(postData);\n\t\treq.end();\n\t});\n\n\tconst content = extractChatContent(json);\n\tif (typeof content !== 'string' || content.trim().length === 0) {\n\t\tthrow new Error('Empty model content');\n\t}\n\tconst action = parsePlannedAction(content, doc);\n\tif (!action) {\n\t\tthrow new Error('No valid action parsed from model output');\n\t}\n\treturn action;\n}\n\nfunction extractChatContent(json: any): string | undefined {\n\ttry {\n\t\tif (json && Array.isArray(json.choices) && json.choices[0]) {\n\t\t\tconst choice = json.choices[0];\n\t\t\tif (choice.message && typeof choice.message.content === 'string') {\n\t\t\t\treturn choice.message.content;\n\t\t\t}\n\t\t\tif (typeof choice.text === 'string') {\n\t\t\t\treturn choice.text;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction parsePlannedAction(raw: string, doc?: vscode.TextDocument): PlannedAction | undefined {\n\tconst command = extractBashCommand(raw);\n\tif (!command) {\n\t\treturn undefined;\n\t}\n\tconst normalized = command.replace(/<think>[\s\S]*?<\/think>/gi, '').trim();\n\tif (!normalized) {\n\t\treturn undefined;\n\t}\n\t// Try to interpret the command as a structured VS Code action derived from the bash transcript.\n\tif (doc) {\n\t\t// 1) Edits encoded as sed -i ... (insert/replace/delete)\n\t\tconst editAction = parseEditFromSedCommand(normalized, doc);\n\t\tif (editAction) {\n\t\t\treturn editAction;\n\t\t}\n\t\t// 2) Viewport / selection moves encoded as cat -n ... | sed -n 'vstart,vendp'\n\t\tconst viewportAction = parseViewportFromCatCommand(normalized, doc);\n\t\tif (viewportAction) {\n\t\t\treturn viewportAction;\n\t\t}\n\t}\n\t// Fallback: execute the raw command in the integrated terminal.\n\treturn { kind: 'terminalSendText', text: normalized };\n}\n\n/**\n * Parse a sed-based edit command of the form emitted by the NeMo serializer into a VS Code edit action.\n *\n * Supported patterns (1-based line numbers, mirroring serialization_utils.py):\n * sed -i 'START,ENDc\n<replacement...>' <file> -> editReplace\n * sed -i 'START,ENDd' <file> -> editDelete\n * sed -i 'STARTi\n<insert...>' <file> -> editInsert (before START)\n * sed -i '$a\n<append...>' <file> -> editInsert (append at EOF)\n *\n * If the command does not match these patterns, returns undefined.\n */\nfunction parseEditFromSedCommand(command: string, doc: vscode.TextDocument): PlannedAction | undefined {\n\t// Only consider the first command before && / ||, since cat -n etc. are for viewport only.\n\tconst main = command.split(/&&|\|\|/)[0]?.trim() ?? '';\n\tif (!main) {\n\t\treturn undefined;\n\t}\n\n\t// Match: sed -i '<script>' <file>\n\tconst sedMatch = main.match(/sed\s+-i\s+'([\s\S]*?)'\s+([^\s&|]+)\s*$/);\n\tif (!sedMatch) {\n\t\treturn undefined;\n\t}\n\tconst script = sedMatch[1] ?? '';\n\tconst targetFile = sedMatch[2] ?? '';\n\tconst activePath = doc.uri.fsPath;\n\t// Be conservative: only apply edits when the sed target matches the active document path.\n\tif (targetFile !== activePath) {\n\t\treturn undefined;\n\t}\n\n\t// Delete: ""START,ENDd""\n\tconst deleteMatch = script.match(/^(\d+),(\d+)d$/);\n\tif (deleteMatch) {\n\t\tconst startLine1 = Number(deleteMatch[1]);\n\t\tconst endLine1 = Number(deleteMatch[2]);\n\t\tif (!Number.isFinite(startLine1) || !Number.isFinite(endLine1)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst startLine0 = Math.max(0, startLine1 - 1);\n\t\tconst endLine0 = Math.max(0, endLine1 - 1);\n\n\t\tlet endPosLine = endLine0 + 1;\n\t\tlet endPosChar = 0;\n\t\tif (endPosLine >= doc.lineCount) {\n\t\t\tendPosLine = doc.lineCount - 1;\n\t\t\tendPosChar = doc.lineAt(endPosLine).range.end.character;\n\t\t}\n\t\treturn {\n\t\t\tkind: 'editDelete',\n\t\t\trange: {\n\t\t\t\tstart: [startLine0, 0],\n\t\t\t\tend: [endPosLine, endPosChar],\n\t\t\t},\n\t\t};\n\t}\n\n\t// Replace: ""START,ENDc\newline<payload...>""\n\tconst replaceMatch = script.match(/^(\d+),(\d+)c\\\n([\s\S]*)$/);\n\tif (replaceMatch) {\n\t\tconst startLine1 = Number(replaceMatch[1]);\n\t\tconst endLine1 = Number(replaceMatch[2]);\n\t\tlet payload = replaceMatch[3] ?? '';\n\t\tif (!Number.isFinite(startLine1) || !Number.isFinite(endLine1)) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// Unescape single quotes as done in _escape_single_quotes_for_sed.\n\t\tpayload = payload.replace(/'\""'\""'/g, ""'"");\n\t\tconst startLine0 = Math.max(0, startLine1 - 1);\n\t\tconst endLine0 = Math.max(0, endLine1 - 1);\n\t\tconst startPos: [number, number] = [startLine0, 0];\n\n\t\t// Replace up to the start of the line after endLine, or end-of-document.\n\t\tlet endPosLine = endLine0 + 1;\n\t\tlet endPosChar = 0;\n\t\tif (endPosLine >= doc.lineCount) {\n\t\t\tendPosLine = doc.lineCount - 1;\n\t\t\tendPosChar = doc.lineAt(endPosLine).range.end.character;\n\t\t}\n\n\t\t// Preserve multi-line payload as-is; append a trailing newline so sed-style replacements map naturally.\n\t\tconst text = payload.endsWith('\n') ? payload : payload + '\n';\n\t\treturn {\n\t\t\tkind: 'editReplace',\n\t\t\trange: { start: startPos, end: [endPosLine, endPosChar] },\n\t\t\ttext,\n\t\t};\n\t}\n\n\t// Insert before a given line: ""STARTi\newline<payload...>""\n\tconst insertMatch = script.match(/^(\d+)i\\\n([\s\S]*)$/);\n\tif (insertMatch) {\n\t\tconst line1 = Number(insertMatch[1]);\n\t\tlet payload = insertMatch[2] ?? '';\n\t\tif (!Number.isFinite(line1)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tpayload = payload.replace(/'\""'\""'/g, ""'"");\n\t\tconst insertLine0 = Math.max(0, line1 - 1);\n\t\tconst position: [number, number] = [insertLine0, 0];\n\t\tconst text = payload.endsWith('\n') ? payload : payload + '\n';\n\t\treturn {\n\t\t\tkind: 'editInsert',\n\t\t\tposition,\n\t\t\ttext,\n\t\t};\n\t}\n\n\t// Append at end of file: ""$a\newline<payload...>""\n\tconst appendMatch = script.match(/^\$a\\\n([\s\S]*)$/);\n\tif (appendMatch) {\n\t\tlet payload = appendMatch[1] ?? '';\n\t\tpayload = payload.replace(/'\""'\""'/g, ""'"");\n\t\tconst insertLine0 = doc.lineCount;\n\t\tconst position: [number, number] = [insertLine0, 0];\n\t\tconst needsLeadingNewline = doc.lineCount > 0;\n\t\tconst base = payload.endsWith('\n') ? payload : payload + '\n';\n\t\tconst text = needsLeadingNewline ? '\n' + base : base;\n\t\treturn {\n\t\t\tkind: 'editInsert',\n\t\t\tposition,\n\t\t\ttext,\n\t\t};\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Parse viewport / selection commands of the form:\n * cat -n <file> | sed -n 'START,ENDp'\n *\n * into a lightweight VS Code selection move (setSelections). This mirrors how\n * selection and viewport events are serialized in serialization_utils.py.\n */\nfunction parseViewportFromCatCommand(command: string, doc: vscode.TextDocument): PlannedAction | undefined {\n\tconst main = command.split(/&&|\|\|/)[0]?.trim() ?? '';\n\tif (!main) {\n\t\treturn undefined;\n\t}\n\n\t// Simple file-open: cat -n <file>\n\tconst simpleCatMatch = main.match(/^cat\s+-n\s+([^\s|]+)\s*$/);\n\tif (simpleCatMatch) {\n\t\tconst targetFile = simpleCatMatch[1] ?? '';\n\t\tif (targetFile !== doc.uri.fsPath) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// Ensure the active document is visible; rely on existing editor to handle this.\n\t\treturn { kind: 'showTextDocument' };\n\t}\n\n\t// Viewport slice: cat -n <file> | sed -n 'START,ENDp'\n\tconst viewportMatch = main.match(/^cat\s+-n\s+([^\s|]+)\s*\|\s*sed\s+-n\s+'(\d+),(\d+)p'\s*$/);\n\tif (!viewportMatch) {\n\t\treturn undefined;\n\t}\n\n\tconst targetFile = viewportMatch[1] ?? '';\n\tconst startStr = viewportMatch[2] ?? '';\n\tconst endStr = viewportMatch[3] ?? '';\n\n\tif (targetFile !== doc.uri.fsPath) {\n\t\treturn undefined;\n\t}\n\n\tconst startLine1 = Number(startStr);\n\tconst endLine1 = Number(endStr);\n\tif (!Number.isFinite(startLine1) || !Number.isFinite(endLine1)) {\n\t\treturn undefined;\n\t}\n\n\t// Place the cursor in the middle of the viewport (1-based to 0-based).\n\tconst center1 = Math.floor((startLine1 + endLine1) / 2);\n\tconst center0 = Math.max(0, center1 - 1);\n\tconst lastLine = Math.max(0, doc.lineCount - 1);\n\tconst line = Math.min(center0, lastLine);\n\tconst endChar = doc.lineAt(line).range.end.character;\n\n\treturn {\n\t\tkind: 'setSelections',\n\t\tselections: [\n\t\t\t{\n\t\t\t\tstart: [line, endChar],\n\t\t\t\tend: [line, endChar],\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction extractBashCommand(raw: string): string | undefined {\n\tif (!raw) {\n\t\treturn undefined;\n\t}\n\tconst trimmed = raw.trim();\n\tconst fenceMatch = trimmed.match(/```(?:bash)?\s*([\s\S]*?)```/i);\n\tif (fenceMatch && fenceMatch[1]) {\n\t\treturn fenceMatch[1];\n\t}\n\t// Fallback: treat entire response as the command\n\treturn trimmed.length > 0 ? trimmed : undefined;\n}",typescript,tab
3
+ 2,275,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"10:07:03 AM [info] Activating crowd-code\n10:07:03 AM [info] Recording started\n10:07:03 AM [info] Initializing git provider using file system watchers...\n10:07:03 AM [info] Git repository found\n10:07:03 AM [info] Git provider initialized successfully\n10:07:03 AM [info] Initial git state: [object Object]\n",Log,tab
4
+ 3,185200,"src/extension.ts",0,0,"",typescript,tab
5
+ 4,235871,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
6
+ 5,444488,"src/extension.ts",0,0,"",typescript,tab
7
+ 6,448019,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"",Log,tab
8
+ 7,449563,"TERMINAL",0,0,"",,terminal_focus
9
+ 8,449564,"src/extension.ts",0,0,"",typescript,tab
10
+ 9,451879,"TERMINAL",0,0,"cd ..",,terminal_command
11
+ 10,452829,"TERMINAL",0,0,"ls",,terminal_command
12
+ 11,452830,"TERMINAL",0,0,"]633;Ccleanrl crowd-pilot jafar maxtext oai-compatible-copilot slurm tab_model_eval vscode-crowd-pilot-chat\r\ncrowd-code-player crowd-pilot-extension jax_cache npm-global sbatch-runner Stoix test_output\r\n]0;franz.srambical@hai-login1:~",,terminal_output
13
+ 12,467057,"TERMINAL",0,0,"git clone https://github.com/zed-industries/zed",,terminal_command
14
+ 13,467113,"TERMINAL",0,0,"]633;CCloning into 'zed'...\r\n",,terminal_output
15
+ 14,469246,"TERMINAL",0,0,"remote: Enumerating objects: 467931, done.\r\nremote: Counting objects: 0% (1/607)\rremote: Counting objects: 1% (7/607)\rremote: Counting objects: 2% (13/607)\rremote: Counting objects: 3% (19/607)\rremote: Counting objects: 4% (25/607)\rremote: Counting objects: 5% (31/607)\rremote: Counting objects: 6% (37/607)\rremote: Counting objects: 7% (43/607)\rremote: Counting objects: 8% (49/607)\rremote: Counting objects: 9% (55/607)\rremote: Counting objects: 10% (61/607)\rremote: Counting objects: 11% (67/607)\rremote: Counting objects: 12% (73/607)\rremote: Counting objects: 13% (79/607)\rremote: Counting objects: 14% (85/607)\rremote: Counting objects: 15% (92/607)\rremote: Counting objects: 16% (98/607)\rremote: Counting objects: 17% (104/607)\rremote: Counting objects: 18% (110/607)\rremote: Counting objects: 19% (116/607)\rremote: Counting objects: 20% (122/607)\rremote: Counting objects: 21% (128/607)\rremote: Counting objects: 22% (134/607)\rremote: Counting objects: 23% (140/607)\rremote: Counting objects: 24% (146/607)\rremote: Counting objects: 25% (152/607)\rremote: Counting objects: 26% (158/607)\rremote: Counting objects: 27% (164/607)\rremote: Counting objects: 28% (170/607)\rremote: Counting objects: 29% (177/607)\rremote: Counting objects: 30% (183/607)\rremote: Counting objects: 31% (189/607)\rremote: Counting objects: 32% (195/607)\rremote: Counting objects: 33% (201/607)\rremote: Counting objects: 34% (207/607)\rremote: Counting objects: 35% (213/607)\rremote: Counting objects: 36% (219/607)\rremote: Counting objects: 37% (225/607)\rremote: Counting objects: 38% (231/607)\rremote: Counting objects: 39% (237/607)\rremote: Counting objects: 40% (243/607)\rremote: Counting objects: 41% (249/607)\rremote: Counting objects: 42% (255/607)\rremote: Counting objects: 43% (262/607)\rremote: Counting objects: 44% (268/607)\rremote: Counting objects: 45% (274/607)\rremote: Counting objects: 46% (280/607)\rremote: Counting objects: 47% (286/607)\rremote: Counting objects: 48% (292/607)\rremote: Counting objects: 49% (298/607)\rremote: Counting objects: 50% (304/607)\rremote: Counting objects: 51% (310/607)\rremote: Counting objects: 52% (316/607)\rremote: Counting objects: 53% (322/607)\rremote: Counting objects: 54% (328/607)\rremote: Counting objects: 55% (334/607)\rremote: Counting objects: 56% (340/607)\rremote: Counting objects: 57% (346/607)\rremote: Counting objects: 58% (353/607)\rremote: Counting objects: 59% (359/607)\rremote: Counting objects: 60% (365/607)\rremote: Counting objects: 61% (371/607)\rremote: Counting objects: 62% (377/607)\rremote: Counting objects: 63% (383/607)\rremote: Counting objects: 64% (389/607)\rremote: Counting objects: 65% (395/607)\rremote: Counting objects: 66% (401/607)\rremote: Counting objects: 67% (407/607)\rremote: Counting objects: 68% (413/607)\rremote: Counting objects: 69% (419/607)\rremote: Counting objects: 70% (425/607)\rremote: Counting objects: 71% (431/607)\rremote: Counting objects: 72% (438/607)\rremote: Counting objects: 73% (444/607)\rremote: Counting objects: 74% (450/607)\rremote: Counting objects: 75% (456/607)\rremote: Counting objects: 76% (462/607)\rremote: Counting objects: 77% (468/607)\rremote: Counting objects: 78% (474/607)\rremote: Counting objects: 79% (480/607)\rremote: Counting objects: 80% (486/607)\rremote: Counting objects: 81% (492/607)\rremote: Counting objects: 82% (498/607)\rremote: Counting objects: 83% (504/607)\rremote: Counting objects: 84% (510/607)\rremote: Counting objects: 85% (516/607)\rremote: Counting objects: 86% (523/607)\rremote: Counting objects: 87% (529/607)\rremote: Counting objects: 88% (535/607)\rremote: Counting objects: 89% (541/607)\rremote: Counting objects: 90% (547/607)\rremote: Counting objects: 91% (553/607)\rremote: Counting objects: 92% (559/607)\rremote: Counting objects: 93% (565/607)\rremote: Counting objects: 94% (571/607)\rremote: Counting objects: 95% (577/607)\rremote: Counting objects: 96% (583/607)\rremote: Counting objects: 97% (589/607)\rremote: Counting objects: 98% (595/607)\r",,terminal_output
16
+ 15,469349,"TERMINAL",0,0,"remote: Counting objects: 99% (601/607)\rremote: Counting objects: 100% (607/607)\rremote: Counting objects: 100% (607/607), done.\r\nremote: Compressing objects: 0% (1/314)\rremote: Compressing objects: 1% (4/314)\rremote: Compressing objects: 2% (7/314)\rremote: Compressing objects: 3% (10/314)\rremote: Compressing objects: 4% (13/314)\rremote: Compressing objects: 5% (16/314)\rremote: Compressing objects: 6% (19/314)\r",,terminal_output
17
+ 16,469413,"TERMINAL",0,0,"remote: Compressing objects: 7% (22/314)\rremote: Compressing objects: 8% (26/314)\rremote: Compressing objects: 9% (29/314)\r",,terminal_output
18
+ 17,469538,"TERMINAL",0,0,"remote: Compressing objects: 10% (32/314)\rremote: Compressing objects: 11% (35/314)\r",,terminal_output
19
+ 18,469588,"TERMINAL",0,0,"remote: Compressing objects: 12% (38/314)\rremote: Compressing objects: 13% (41/314)\r",,terminal_output
20
+ 19,469682,"TERMINAL",0,0,"remote: Compressing objects: 14% (44/314)\r",,terminal_output
21
+ 20,469755,"TERMINAL",0,0,"remote: Compressing objects: 15% (48/314)\rremote: Compressing objects: 16% (51/314)\r",,terminal_output
22
+ 21,469847,"TERMINAL",0,0,"remote: Compressing objects: 17% (54/314)\rremote: Compressing objects: 18% (57/314)\rremote: Compressing objects: 19% (60/314)\rremote: Compressing objects: 20% (63/314)\rremote: Compressing objects: 21% (66/314)\rremote: Compressing objects: 22% (70/314)\rremote: Compressing objects: 23% (73/314)\rremote: Compressing objects: 24% (76/314)\rremote: Compressing objects: 25% (79/314)\rremote: Compressing objects: 26% (82/314)\rremote: Compressing objects: 27% (85/314)\rremote: Compressing objects: 28% (88/314)\rremote: Compressing objects: 29% (92/314)\rremote: Compressing objects: 30% (95/314)\rremote: Compressing objects: 31% (98/314)\rremote: Compressing objects: 32% (101/314)\rremote: Compressing objects: 33% (104/314)\rremote: Compressing objects: 34% (107/314)\rremote: Compressing objects: 35% (110/314)\rremote: Compressing objects: 36% (114/314)\rremote: Compressing objects: 37% (117/314)\rremote: Compressing objects: 38% (120/314)\rremote: Compressing objects: 39% (123/314)\rremote: Compressing objects: 40% (126/314)\rremote: Compressing objects: 41% (129/314)\rremote: Compressing objects: 42% (132/314)\rremote: Compressing objects: 43% (136/314)\rremote: Compressing objects: 44% (139/314)\rremote: Compressing objects: 45% (142/314)\rremote: Compressing objects: 46% (145/314)\rremote: Compressing objects: 47% (148/314)\rremote: Compressing objects: 48% (151/314)\rremote: Compressing objects: 49% (154/314)\rremote: Compressing objects: 50% (157/314)\rremote: Compressing objects: 51% (161/314)\rremote: Compressing objects: 52% (164/314)\rremote: Compressing objects: 53% (167/314)\rremote: Compressing objects: 54% (170/314)\rremote: Compressing objects: 55% (173/314)\rremote: Compressing objects: 56% (176/314)\rremote: Compressing objects: 57% (179/314)\rremote: Compressing objects: 58% (183/314)\rremote: Compressing objects: 59% (186/314)\rremote: Compressing objects: 60% (189/314)\rremote: Compressing objects: 61% (192/314)\rremote: Compressing objects: 62% (195/314)\rremote: Compressing objects: 63% (198/314)\rremote: Compressing objects: 64% (201/314)\rremote: Compressing objects: 65% (205/314)\rremote: Compressing objects: 66% (208/314)\rremote: Compressing objects: 67% (211/314)\rremote: Compressing objects: 68% (214/314)\rremote: Compressing objects: 69% (217/314)\rremote: Compressing objects: 70% (220/314)\rremote: Compressing objects: 71% (223/314)\rremote: Compressing objects: 72% (227/314)\rremote: Compressing objects: 73% (230/314)\rremote: Compressing objects: 74% (233/314)\rremote: Compressing objects: 75% (236/314)\rremote: Compressing objects: 76% (239/314)\rremote: Compressing objects: 77% (242/314)\rremote: Compressing objects: 78% (245/314)\rremote: Compressing objects: 79% (249/314)\rremote: Compressing objects: 80% (252/314)\rremote: Compressing objects: 81% (255/314)\rremote: Compressing objects: 82% (258/314)\rremote: Compressing objects: 83% (261/314)\rremote: Compressing objects: 84% (264/314)\rremote: Compressing objects: 85% (267/314)\rremote: Compressing objects: 86% (271/314)\rremote: Compressing objects: 87% (274/314)\rremote: Compressing objects: 88% (277/314)\rremote: Compressing objects: 89% (280/314)\rremote: Compressing objects: 90% (283/314)\rremote: Compressing objects: 91% (286/314)\rremote: Compressing objects: 92% (289/314)\rremote: Compressing objects: 93% (293/314)\rremote: Compressing objects: 94% (296/314)\rremote: Compressing objects: 95% (299/314)\rremote: Compressing objects: 96% (302/314)\rremote: Compressing objects: 97% (305/314)\rremote: Compressing objects: 98% (308/314)\rremote: Compressing objects: 99% (311/314)\rremote: Compressing objects: 100% (314/314)\rremote: Compressing objects: 100% (314/314), done.\r\nReceiving objects: 0% (1/467931)\r",,terminal_output
23
+ 22,470852,"TERMINAL",0,0,"Receiving objects: 0% (3909/467931), 1.40 MiB | 2.78 MiB/s\r",,terminal_output
24
+ 23,471029,"TERMINAL",0,0,"Receiving objects: 1% (4680/467931), 2.85 MiB | 2.84 MiB/s\r",,terminal_output
25
+ 24,471870,"TERMINAL",0,0,"Receiving objects: 1% (8620/467931), 4.45 MiB | 2.95 MiB/s\r",,terminal_output
26
+ 25,472057,"TERMINAL",0,0,"Receiving objects: 2% (9359/467931), 6.07 MiB | 3.03 MiB/s\r",,terminal_output
27
+ 26,472902,"TERMINAL",0,0,"Receiving objects: 2% (13246/467931), 7.59 MiB | 3.03 MiB/s\r",,terminal_output
28
+ 27,473069,"TERMINAL",0,0,"Receiving objects: 3% (14038/467931), 9.22 MiB | 3.07 MiB/s\r",,terminal_output
29
+ 28,473852,"TERMINAL",0,0,"Receiving objects: 3% (18051/467931), 10.95 MiB | 3.12 MiB/s\r",,terminal_output
30
+ 29,473992,"TERMINAL",0,0,"Receiving objects: 4% (18718/467931), 12.88 MiB | 3.21 MiB/s\r",,terminal_output
31
+ 30,474854,"TERMINAL",0,0,"Receiving objects: 4% (22881/467931), 14.60 MiB | 3.24 MiB/s\r",,terminal_output
32
+ 31,475057,"TERMINAL",0,0,"Receiving objects: 5% (23397/467931), 16.21 MiB | 3.29 MiB/s\r",,terminal_output
33
+ 32,475870,"TERMINAL",0,0,"Receiving objects: 5% (27914/467931), 17.82 MiB | 3.33 MiB/s\rReceiving objects: 6% (28076/467931), 19.55 MiB | 3.35 MiB/s\r",,terminal_output
34
+ 33,476242,"TERMINAL",0,0,"Receiving objects: 7% (32756/467931), 19.55 MiB | 3.35 MiB/s\r",,terminal_output
35
+ 34,476613,"TERMINAL",0,0,"Receiving objects: 8% (37435/467931), 21.38 MiB | 3.40 MiB/s\r",,terminal_output
36
+ 35,476848,"TERMINAL",0,0,"Receiving objects: 8% (40347/467931), 21.38 MiB | 3.40 MiB/s\r",,terminal_output
37
+ 36,477043,"TERMINAL",0,0,"Receiving objects: 9% (42114/467931), 22.93 MiB | 3.41 MiB/s\r",,terminal_output
38
+ 37,477911,"TERMINAL",0,0,"Receiving objects: 9% (45224/467931), 24.50 MiB | 3.39 MiB/s\r",,terminal_output
39
+ 38,478881,"TERMINAL",0,0,"Receiving objects: 9% (46343/467931), 29.69 MiB | 3.35 MiB/s\r",,terminal_output
40
+ 39,479777,"TERMINAL",0,0,"Receiving objects: 10% (46794/467931), 31.45 MiB | 3.38 MiB/s\r",,terminal_output
41
+ 40,479853,"TERMINAL",0,0,"Receiving objects: 10% (46958/467931), 31.45 MiB | 3.38 MiB/s\r",,terminal_output
42
+ 41,480878,"TERMINAL",0,0,"Receiving objects: 10% (47025/467931), 36.45 MiB | 3.35 MiB/s\r",,terminal_output
43
+ 42,481861,"TERMINAL",0,0,"Receiving objects: 10% (48389/467931), 38.10 MiB | 3.37 MiB/s\r",,terminal_output
44
+ 43,482879,"TERMINAL",0,0,"Receiving objects: 10% (50050/467931), 43.22 MiB | 3.43 MiB/s\r",,terminal_output
45
+ 44,483859,"TERMINAL",0,0,"Receiving objects: 10% (50075/467931), 44.95 MiB | 3.39 MiB/s\r",,terminal_output
46
+ 45,484502,"TERMINAL",0,0,"Receiving objects: 11% (51473/467931), 48.33 MiB | 3.39 MiB/s\r",,terminal_output
47
+ 46,484853,"TERMINAL",0,0,"Receiving objects: 11% (52250/467931), 48.33 MiB | 3.39 MiB/s\r",,terminal_output
48
+ 47,485863,"TERMINAL",0,0,"Receiving objects: 11% (54472/467931), 51.68 MiB | 3.38 MiB/s\r",,terminal_output
49
+ 48,486761,"TERMINAL",0,0,"Receiving objects: 12% (56152/467931), 55.04 MiB | 3.39 MiB/s\r",,terminal_output
50
+ 49,486863,"TERMINAL",0,0,"Receiving objects: 12% (56315/467931), 55.04 MiB | 3.39 MiB/s\r",,terminal_output
51
+ 50,620240,"TERMINAL",0,0,"Receiving objects: 12% (58164/467931), 58.70 MiB | 3.44 MiB/s\r",,terminal_output
52
+ 51,620489,"TERMINAL",0,0,"Receiving objects: 12% (59796/467931), 62.09 MiB | 3.45 MiB/s\rReceiving objects: 13% (60832/467931), 63.76 MiB | 3.43 MiB/s\rReceiving objects: 13% (61793/467931), 65.38 MiB | 3.41 MiB/s\rReceiving objects: 13% (63875/467931), 68.46 MiB | 3.38 MiB/s\rReceiving objects: 14% (65511/467931), 71.45 MiB | 3.21 MiB/s\rReceiving objects: 14% (66227/467931), 71.45 MiB | 3.21 MiB/s\rReceiving objects: 14% (68436/467931), 74.89 MiB | 3.21 MiB/s\rReceiving objects: 15% (70190/467931), 78.47 MiB | 3.27 MiB/s\rReceiving objects: 15% (71031/467931), 78.47 MiB | 3.27 MiB/s\rReceiving objects: 15% (73352/467931), 81.85 MiB | 3.34 MiB/s\rReceiving objects: 16% (74869/467931), 85.36 MiB | 3.45 MiB/s\rReceiving objects: 16% (75648/467931), 87.10 MiB | 3.48 MiB/s\rReceiving objects: 16% (77048/467931), 88.74 MiB | 3.45 MiB/s\rReceiving objects: 16% (78971/467931), 92.18 MiB | 3.43 MiB/s\rReceiving objects: 17% (79549/467931), 93.82 MiB | 3.41 MiB/s\rReceiving objects: 17% (81377/467931), 95.46 MiB | 3.39 MiB/s\rReceiving objects: 18% (84228/467931), 98.82 MiB | 3.38 MiB/s\rReceiving objects: 18% (84915/467931), 98.82 MiB | 3.38 MiB/s\rReceiving objects: 18% (87010/467931), 103.63 MiB | 3.30 MiB/s\rReceiving objects: 18% (87010/467931), 106.87 MiB | 3.26 MiB/s\rReceiving objects: 18% (87011/467931), 110.00 MiB | 3.23 MiB/s\rReceiving objects: 18% (87011/467931), 113.36 MiB | 3.23 MiB/s\rReceiving objects: 18% (88140/467931), 115.04 MiB | 3.24 MiB/s\rReceiving objects: 19% (88907/467931), 116.38 MiB | 3.16 MiB/s\rReceiving objects: 19% (91271/467931), 117.88 MiB | 3.16 MiB/s\rReceiving objects: 20% (93587/467931), 121.54 MiB | 3.26 MiB/s\rReceiving objects: 20% (93752/467931), 121.54 MiB | 3.26 MiB/s\rReceiving objects: 20% (96272/467931), 124.85 MiB | 3.29 MiB/s\rReceiving objects: 21% (98266/467931), 128.00 MiB | 3.25 MiB/s\rReceiving objects: 21% (98441/467931), 128.00 MiB | 3.25 MiB/s\rReceiving objects: 21% (100429/467931), 131.18 MiB | 3.29 MiB/s\rReceiving objects: 22% (102945/467931), 134.41 MiB | 3.29 MiB/s\rReceiving objects: 22% (103230/467931), 134.41 MiB | 3.29 MiB/s\rReceiving objects: 22% (104569/467931), 139.17 MiB | 3.18 MiB/s\rReceiving objects: 22% (104570/467931), 142.56 MiB | 3.23 MiB/s\rReceiving objects: 22% (104613/467931), 144.16 MiB | 3.23 MiB/s\rReceiving objects: 23% (107625/467931), 147.48 MiB | 3.26 MiB/s\rReceiving objects: 23% (108316/467931), 147.48 MiB | 3.26 MiB/s\rReceiving objects: 23% (110792/467931), 150.69 MiB | 3.24 MiB/s\rReceiving objects: 24% (112304/467931), 152.34 MiB | 3.23 MiB/s\rReceiving objects: 24% (114330/467931), 153.94 MiB | 3.27 MiB/s\rReceiving objects: 25% (116983/467931), 157.35 MiB | 3.28 MiB/s\rReceiving objects: 25% (117678/467931), 157.35 MiB | 3.28 MiB/s\rReceiving objects: 25% (120889/467931), 161.05 MiB | 3.38 MiB/s\rReceiving objects: 26% (121663/467931), 162.72 MiB | 3.37 MiB/s\rReceiving objects: 26% (122727/467931), 165.84 MiB | 3.36 MiB/s\rReceiving objects: 26% (122731/467931), 168.98 MiB | 3.33 MiB/s\rReceiving objects: 26% (124563/467931), 170.69 MiB | 3.35 MiB/s\rReceiving objects: 27% (126342/467931), 172.48 MiB | 3.36 MiB/s\rReceiving objects: 27% (127620/467931), 174.19 MiB | 3.32 MiB/s\rReceiving objects: 28% (131021/467931), 177.33 MiB | 3.24 MiB/s\rReceiving objects: 28% (131971/467931), 177.33 MiB | 3.24 MiB/s\rReceiving objects: 28% (135582/467931), 180.76 MiB | 3.31 MiB/s\rReceiving objects: 29% (135700/467931), 180.76 MiB | 3.31 MiB/s\rReceiving objects: 30% (140380/467931), 184.41 MiB | 3.43 MiB/s\rReceiving objects: 30% (140556/467931), 184.41 MiB | 3.43 MiB/s\rReceiving objects: 31% (145059/467931), 187.69 MiB | 3.37 MiB/s\rReceiving objects: 31% (145417/467931), 187.69 MiB | 3.37 MiB/s\rReceiving objects: 31% (148817/467931), 190.97 MiB | 3.39 MiB/s\rReceiving objects: 32% (149738/467931), 192.73 MiB | 3.42 MiB/s\rReceiving objects: 32% (152750/467931), 194.49 MiB | 3.41 MiB/s\rReceiving objects: 33% (154418/467931), 196.10 MiB | 3.41 MiB/s\rReceiving objects: 33% (158699/467931), 197.70 MiB | 3.35 MiB/s\rReceiving objects: 34% (159097/467931), 197.70 MiB | 3.35 MiB/s\rReceiving objects: 34% (161728/467931), 201.06 MiB | 3.31 MiB/s\rReceiving objects: 35% (163776/467931), 202.90 MiB | 3.38 MiB/s\rReceiving objects: 35% (167717/467931), 204.66 MiB | 3.41 MiB/s\rReceiving objects: 36% (168456/467931), 204.66 MiB | 3.41 MiB/s\rReceiving objects: 37% (173135/467931), 208.01 MiB | 3.39 MiB/s\rReceiving objects: 37% (173664/467931), 208.01 MiB | 3.39 MiB/s\rReceiving objects: 38% (177814/467931), 211.36 MiB | 3.39 MiB/s\rReceiving objects: 38% (178119/467931), 211.36 MiB | 3.39 MiB/s\rReceiving objects: 39% (182494/467931), 214.62 MiB | 3.40 MiB/s\rReceiving objects: 39% (183529/467931), 214.62 MiB | 3.40 MiB/s\rReceiving objects: 40% (187173/467931), 216.30 MiB | 3.39 MiB/s\rReceiving objects: 40% (190805/467931), 218.12 MiB | 3.38 MiB/s\rReceiving objects: 41% (191852/467931), 219.80 MiB | 3.37 MiB/s\rReceiving objects: 41% (196119/467931), 221.36 MiB | 3.32 MiB/s\rReceiving objects: 42% (196532/467931), 221.36 MiB | 3.32 MiB/s\rReceiving objects: 42% (200739/467931), 224.68 MiB | 3.33 MiB/s\rReceiving objects: 43% (201211/467931), 224.68 MiB | 3.33 MiB/s\rReceiving objects: 44% (205890/467931), 228.11 MiB | 3.39 MiB/s\rReceiving objects: 44% (206907/467931), 228.11 MiB | 3.39 MiB/s\rReceiving objects: 45% (210569/467931), 231.35 MiB | 3.34 MiB/s\rReceiving objects: 45% (211161/467931), 231.35 MiB | 3.34 MiB/s\rReceiving objects: 46% (215249/467931), 232.88 MiB | 3.28 MiB/s\rReceiving objects: 47% (219928/467931), 234.80 MiB | 3.33 MiB/s\rReceiving objects: 47% (220605/467931), 234.80 MiB | 3.33 MiB/s\rReceiving objects: 48% (224607/467931), 236.67 MiB | 3.40 MiB/s\rReceiving objects: 49% (229287/467931), 238.60 MiB | 3.44 MiB/s\rReceiving objects: 49% (229822/467931), 238.60 MiB | 3.44 MiB/s\rReceiving objects: 50% (233966/467931), 240.12 MiB | 3.43 MiB/s\rReceiving objects: 51% (238645/467931), 241.57 MiB | 3.38 MiB/s\rReceiving objects: 51% (241108/467931), 241.57 MiB | 3.38 MiB/s\rReceiving objects: 52% (243325/467931), 243.13 MiB | 3.34 MiB/s\rReceiving objects: 53% (248004/467931), 243.13 MiB | 3.34 MiB/s\rReceiving objects: 53% (251308/467931), 244.89 MiB | 3.32 MiB/s\rReceiving objects: 54% (252683/467931), 244.89 MiB | 3.32 MiB/s\rReceiving objects: 55% (257363/467931), 246.88 MiB | 3.45 MiB/s\rReceiving objects: 55% (258986/467931), 248.48 MiB | 3.46 MiB/s\rReceiving objects: 56% (262042/467931), 251.87 MiB | 3.38 MiB/s\rReceiving objects: 56% (262452/467931), 251.87 MiB | 3.38 MiB/s\rReceiving objects: 57% (266721/467931), 255.38 MiB | 3.39 MiB/s\rReceiving objects: 57% (266734/467931), 255.38 MiB | 3.39 MiB/s\rReceiving objects: 57% (270716/467931), 258.33 MiB | 3.38 MiB/s\rReceiving objects: 58% (271400/467931), 258.33 MiB | 3.38 MiB/s\rReceiving objects: 59% (276080/467931), 261.86 MiB | 3.33 MiB/s\rReceiving objects: 59% (277133/467931), 261.86 MiB | 3.33 MiB/s\rReceiving objects: 60% (280759/467931), 265.09 MiB | 3.33 MiB/s\rReceiving objects: 60% (282946/467931), 265.09 MiB | 3.33 MiB/s\rReceiving objects: 61% (285438/467931), 266.73 MiB | 3.30 MiB/s\rReceiving objects: 62% (290118/467931), 268.46 MiB | 3.29 MiB/s\rReceiving objects: 62% (292358/467931), 268.46 MiB | 3.29 MiB/s\rReceiving objects: 63% (294797/467931), 270.23 MiB | 3.29 MiB/s\rReceiving objects: 64% (299476/467931), 271.86 MiB | 3.34 MiB/s\rReceiving objects: 65% (304156/467931), 271.86 MiB | 3.34 MiB/s\rReceiving objects: 65% (306580/467931), 271.86 MiB | 3.34 MiB/s\rReceiving objects: 66% (308835/467931), 271.86 MiB | 3.34 MiB/s\rReceiving objects: 67% (313514/467931), 275.35 MiB | 3.38 MiB/s\rReceiving objects: 67% (315193/467931), 275.35 MiB | 3.38 MiB/s\rReceiving objects: 68% (318194/467931), 277.11 MiB | 3.38 MiB/s\rReceiving objects: 69% (322873/467931), 278.85 MiB | 3.43 MiB/s\rReceiving objects: 69% (327456/467931), 278.85 MiB | 3.43 MiB/s\rReceiving objects: 70% (327552/467931), 278.85 MiB | 3.43 MiB/s\rReceiving objects: 71% (332232/467931), 280.41 MiB | 3.40 MiB/s\rReceiving objects: 72% (336911/467931), 282.12 MiB | 3.42 MiB/s\rReceiving objects: 72% (341205/467931), 282.12 MiB | 3.42 MiB/s\rReceiving objects: 73% (341590/467931), 282.12 MiB | 3.42 MiB/s\rReceiving objects: 74% (346269/467931), 283.90 MiB | 3.43 MiB/s\rReceiving objects: 75% (350949/467931), 285.59 MiB | 3.41 MiB/s\rReceiving objects: 75% (355094/467931), 285.59 MiB | 3.41 MiB/s\rReceiving objects: 76% (355628/467931), 285.59 MiB | 3.41 MiB/s\rReceiving objects: 77% (360307/467931), 287.23 MiB | 3.41 MiB/s\rReceiving objects: 78% (364987/467931), 288.75 MiB | 3.36 MiB/s\rReceiving objects: 79% (369666/467931), 288.75 MiB | 3.36 MiB/s\rReceiving objects: 79% (370551/467931), 288.75 MiB | 3.36 MiB/s\rReceiving objects: 80% (374345/467931), 290.39 MiB | 3.34 MiB/s\rReceiving objects: 81% (379025/467931), 290.39 MiB | 3.34 MiB/s\rReceiving objects: 82% (383704/467931), 292.04 MiB | 3.31 MiB/s\rReceiving objects: 82% (386758/467931), 292.04 MiB | 3.31 MiB/s\rReceiving objects: 83% (388383/467931), 292.04 MiB | 3.31 MiB/s\rReceiving objects: 84% (393063/467931), 293.75 MiB | 3.31 MiB/s\rReceiving objects: 85% (397742/467931), 293.75 MiB | 3.31 MiB/s\rReceiving objects: 85% (399007/467931), 295.58 MiB | 3.37 MiB/s\rReceiving objects: 86% (402421/467931), 297.29 MiB | 3.37 MiB/s\rReceiving objects: 87% (407100/467931), 297.29 MiB | 3.37 MiB/s\rReceiving objects: 88% (411780/467931), 298.86 MiB | 3.32 MiB/s\rReceiving objects: 88% (413494/467931), 298.86 MiB | 3.32 MiB/s\rReceiving objects: 89% (416459/467931), 300.30 MiB | 3.26 MiB/s\rReceiving objects: 90% (421138/467931), 300.30 MiB | 3.26 MiB/s\rReceiving objects: 91% (425818/467931), 301.68 MiB | 3.21 MiB/s\rReceiving objects: 91% (426774/467931), 301.68 MiB | 3.21 MiB/s\rReceiving objects: 92% (430497/467931), 303.52 MiB | 3.28 MiB/s\rReceiving objects: 93% (435176/467931), 303.52 MiB | 3.28 MiB/s\rReceiving objects: 93% (436776/467931), 305.43 MiB | 3.34 MiB/s\rReceiving objects: 94% (439856/467931), 307.10 MiB | 3.34 MiB/s\rReceiving objects: 94% (440061/467931), 308.61 MiB | 3.30 MiB/s\rReceiving objects: 94% (440065/467931), 311.84 MiB | 3.23 MiB/s\rReceiving objects: 94% (442555/467931), 316.82 MiB | 3.36 MiB/s\rReceiving objects: 95% (444535/467931), 318.51 MiB | 3.33 MiB/s\rReceiving objects: 95% (445501/467931), 318.51 MiB | 3.33 MiB/s\rReceiving objects: 96% (449214/467931), 318.51 MiB | 3.33 MiB/s\rReceiving objects: 97% (453894/467931), 320.34 MiB | 3.31 MiB/s\rReceiving objects: 98% (458573/467931), 322.19 MiB | 3.35 MiB/s\rReceiving objects: 98% (459483/467931), 322.19 MiB | 3.35 MiB/s\rReceiving objects: 99% (463252/467931), 323.84 MiB | 3.38 MiB/s\rReceiving objects: 99% (467823/467931), 325.40 MiB | 3.39 MiB/s\rremote: Total 467931 (delta 457), reused 293 (delta 293), pack-reused 467324 (from 5)\r\nReceiving objects: 100% (467931/467931), 327.02 MiB | 3.37 MiB/s\rReceiving objects: 100% (467931/467931), 327.21 MiB | 3.33 MiB/s, done.\r\nResolving deltas: 0% (0/359950)\rResolving deltas: 1% (3601/359950)\rResolving deltas: 2% (7199/359950)\rResolving deltas: 3% (10799/359950)\rResolving deltas: 4% (14398/359950)\rResolving deltas: 5% (17999/359950)\rResolving deltas: 6% (21597/359950)\rResolving deltas: 7% (25199/359950)\rResolving deltas: 8% (28796/359950)\rResolving deltas: 9% (32396/359950)\rResolving deltas: 10% (35996/359950)\rResolving deltas: 10% (36152/359950)\rResolving deltas: 11% (39597/359950)\rResolving deltas: 12% (43194/359950)\rResolving deltas: 13% (46794/359950)\rResolving deltas: 14% (50393/359950)\rResolving deltas: 15% (53993/359950)\rResolving deltas: 16% (57592/359950)\rResolving deltas: 16% (59112/359950)\rResolving deltas: 17% (61193/359950)\rResolving deltas: 18% (64791/359950)\rResolving deltas: 19% (68392/359950)\rResolving deltas: 20% (71990/359950)\rResolving deltas: 21% (75590/359950)\rResolving deltas: 22% (79189/359950)\rResolving deltas: 23% (82789/359950)\rResolving deltas: 24% (86388/359950)\rResolving deltas: 25% (89989/359950)\rResolving deltas: 26% (93587/359950)\rResolving deltas: 27% (97191/359950)\rResolving deltas: 28% (100786/359950)\rResolving deltas: 29% (104386/359950)\rResolving deltas: 30% (107985/359950)\rResolving deltas: 31% (111585/359950)\rResolving deltas: 32% (115186/359950)\rResolving deltas: 33% (118784/359950)\rResolving deltas: 34% (122383/359950)\rResolving deltas: 35% (125985/359950)\rResolving deltas: 35% (126955/359950)\rResolving deltas: 36% (129582/359950)\rResolving deltas: 37% (133184/359950)\rResolving deltas: 38% (136781/359950)\rResolving deltas: 39% (140384/359950)\rResolving deltas: 40% (143982/359950)\rResolving deltas: 41% (147580/359950)\rResolving deltas: 42% (151179/359950)\rResolving deltas: 43% (154779/359950)\rResolving deltas: 44% (158380/359950)\rResolving deltas: 45% (161978/359950)\rResolving deltas: 46% (165578/359950)\rResolving deltas: 47% (169177/359950)\rResolving deltas: 48% (172785/359950)\rResolving deltas: 49% (176378/359950)\rResolving deltas: 50% (179975/359950)\rResolving deltas: 50% (181610/359950)\rResolving deltas: 51% (183575/359950)\rResolving deltas: 52% (187174/359950)\rResolving deltas: 53% (190774/359950)\rResolving deltas: 54% (194375/359950)\rResolving deltas: 55% (197973/359950)\rResolving deltas: 56% (201574/359950)\rResolving deltas: 57% (205172/359950)\rResolving deltas: 58% (208772/359950)\rResolving deltas: 59% (212373/359950)\rResolving deltas: 60% (215970/359950)\rResolving deltas: 61% (219571/359950)\rResolving deltas: 62% (223169/359950)\rResolving deltas: 63% (226770/359950)\rResolving deltas: 64% (230368/359950)\rResolving deltas: 65% (233969/359950)\rResolving deltas: 66% (237570/359950)\rResolving deltas: 67% (241167/359950)\rResolving deltas: 68% (244766/359950)\rResolving deltas: 69% (248368/359950)\rResolving deltas: 70% (251965/359950)\rResolving deltas: 71% (255565/359950)\rResolving deltas: 72% (259164/359950)\rResolving deltas: 73% (262765/359950)\rResolving deltas: 74% (266363/359950)\rResolving deltas: 75% (269963/359950)\rResolving deltas: 76% (273569/359950)\rResolving deltas: 77% (277162/359950)\rResolving deltas: 78% (280761/359950)\rResolving deltas: 79% (284361/359950)\rResolving deltas: 80% (287965/359950)\rResolving deltas: 81% (291562/359950)\rResolving deltas: 82% (295159/359950)\rResolving deltas: 83% (298759/359950)\rResolving deltas: 84% (302360/359950)\rResolving deltas: 85% (305958/359950)\rResolving deltas: 86% (309557/359950)\rResolving deltas: 87% (313157/359950)\rResolving deltas: 88% (316756/359950)\rResolving deltas: 89% (320356/359950)\rResolving deltas: 89% (321848/359950)\rResolving deltas: 90% (323955/359950)\rResolving deltas: 91% (327555/359950)\rResolving deltas: 92% (331154/359950)\rResolving deltas: 93% (334754/359950)\rResolving deltas: 94% (338353/359950)\rResolving deltas: 95% (341953/359950)\rResolving deltas: 96% (345552/359950)\rResolving deltas: 97% (349152/359950)\rResolving deltas: 98% (352751/359950)\rResolving deltas: 99% (356351/359950)\rResolving deltas: 100% (359950/359950)\rResolving deltas: 100% (359950/359950), done.\r\nUpdating files: 10% (384/3649)\rUpdating files: 11% (402/3649)\rUpdating files: 12% (438/3649)\rUpdating files: 13% (475/3649)\rUpdating files: 14% (511/3649)\rUpdating files: 15% (548/3649)\rUpdating files: 16% (584/3649)\rUpdating files: 17% (621/3649)\rUpdating files: 18% (657/3649)\rUpdating files: 19% (694/3649)\rUpdating files: 19% (696/3649)\rUpdating files: 20% (730/3649)\rUpdating files: 21% (767/3649)\rUpdating files: 22% (803/3649)\rUpdating files: 23% (840/3649)\rUpdating files: 24% (876/3649)\rUpdating files: 25% (913/3649)\rUpdating files: 26% (949/3649)\rUpdating files: 27% (986/3649)\rUpdating files: 28% (1022/3649)\rUpdating files: 29% (1059/3649)\rUpdating files: 29% (1093/3649)\rUpdating files: 30% (1095/3649)\rUpdating files: 31% (1132/3649)\rUpdating files: 32% (1168/3649)\rUpdating files: 33% (1205/3649)\rUpdating files: 34% (1241/3649)\rUpdating files: 34% (1262/3649)\rUpdating files: 35% (1278/3649)\rUpdating files: 36% (1314/3649)\rUpdating files: 37% (1351/3649)\rUpdating files: 38% (1387/3649)\rUpdating files: 39% (1424/3649)\rUpdating files: 40% (1460/3649)\rUpdating files: 41% (1497/3649)\rUpdating files: 42% (1533/3649)\rUpdating files: 43% (1570/3649)\rUpdating files: 43% (1576/3649)\rUpdating files: 44% (1606/3649)\rUpdating files: 45% (1643/3649)\rUpdating files: 46% (1679/3649)\rUpdating files: 47% (1716/3649)\rUpdating files: 48% (1752/3649)\rUpdating files: 49% (1789/3649)\rUpdating files: 50% (1825/3649)\rUpdating files: 50% (1850/3649)\rUpdating files: 51% (1861/3649)\rUpdating files: 52% (1898/3649)\rUpdating files: 53% (1934/3649)\rUpdating files: 54% (1971/3649)\rUpdating files: 55% (2007/3649)\rUpdating files: 56% (2044/3649)\rUpdating files: 57% (2080/3649)\rUpdating files: 58% (2117/3649)\rUpdating files: 59% (2153/3649)\rUpdating files: 60% (2190/3649)\rUpdating files: 61% (2226/3649)\rUpdating files: 61% (2239/3649)\rUpdating files: 62% (2263/3649)\rUpdating files: 63% (2299/3649)\rUpdating files: 64% (2336/3649)\rUpdating files: 65% (2372/3649)\rUpdating files: 66% (2409/3649)\rUpdating files: 67% (2445/3649)\rUpdating files: 67% (2466/3649)\rUpdating files: 68% (2482/3649)\rUpdating files: 69% (2518/3649)\rUpdating files: 70% (2555/3649)\rUpdating files: 71% (2591/3649)\rUpdating files: 72% (2628/3649)\rUpdating files: 73% (2664/3649)\rUpdating files: 74% (2701/3649)\rUpdating files: 75% (2737/3649)\rUpdating files: 76% (2774/3649)\rUpdating files: 77% (2810/3649)\rUpdating files: 78% (2847/3649)\rUpdating files: 78% (2855/3649)\rUpdating files: 79% (2883/3649)\rUpdating files: 80% (2920/3649)\rUpdating files: 81% (2956/3649)\rUpdating files: 82% (2993/3649)\rUpdating files: 83% (3029/3649)\rUpdating files: 84% (3066/3649)\rUpdating files: 85% (3102/3649)\rUpdating files: 86% (3139/3649)\rUpdating files: 87% (3175/3649)\rUpdating files: 88% (3212/3649)\rUpdating files: 88% (3216/3649)\rUpdating files: 89% (3248/3649)\rUpdating files: 90% (3285/3649)\rUpdating files: 91% (3321/3649)\rUpdating files: 92% (3358/3649)\rUpdating files: 93% (3394/3649)\rUpdating files: 94% (3431/3649)\rUpdating files: 95% (3467/3649)\rUpdating files: 95% (3475/3649)\rUpdating files: 96% (3504/3649)\rUpdating files: 97% (3540/3649)\rUpdating files: 98% (3577/3649)\rUpdating files: 99% (3613/3649)\rUpdating files: 100% (3649/3649)\rUpdating files: 100% (3649/3649), done.\r\n]0;franz.srambical@hai-login1:~",,terminal_output
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-6da126cd-f641-4a15-bc10-f51c6b432fda1753788630792-2025_07_29-13.30.37.18/source.csv ADDED
The diff for this file is too large to render. See raw diff
 
1f15334ab7e6820c9fda17c961659882ef9853cc80f7356b9a9b22f286fd7389/crowd-code-6eacf655-5590-4c9d-ad09-856f09c6e0121751568373129-2025_07_03-20.47.02.778/source.csv ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Sequence,Time,File,RangeOffset,RangeLength,Text,Language,Type
2
+ 1,3,"experiments/tokenizer_cross_node_checkpointing_test.sh",0,0,"#!/usr/bin/env bash\nsource .venv/bin/activate\n\n\ndata_dir='data_tfrecords'\n\nsrun python train_tokenizer.py \\n --batch_size 12 \\n --ckpt_dir checkpoints/tokenizer_cross_node_checkpointing_test \\n --log_checkpoint_interval 10 \\n --num_steps 300000 \\n --warmup_steps 10000 \\n --seed 0 \\n --min_lr=0.0000866 \\n --max_lr=0.0000866 \\n --data_dir $data_dir",shellscript,tab
3
+ 2,1240,"extension-output-pdoom-org.crowd-code-#1-crowd-code",0,0,"8:47:01 PM [info] Activating crowd-code\n8:47:02 PM [info] Recording started\n8:47:02 PM [info] Initializing git provider using file system watchers...\n",Log,tab
4
+ 3,1339,"extension-output-pdoom-org.crowd-code-#1-crowd-code",150,0,"8:47:03 PM [info] Git repository found\n8:47:03 PM [info] Git provider initialized successfully\n8:47:03 PM [info] Initial git state: [object Object]\n",Log,content
5
+ 4,10285,"TERMINAL",0,0,"/usr/bin/python3 /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/printEnvVariablesToFile.py /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash/envVars.txt",,terminal_command
6
+ 5,10288,"TERMINAL",0,0,"]633;E;/usr/bin/python3 /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/printEnvVariablesToFile.py /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash/envVars.txt;c8ce12b3-1a75-4b36-97e0-87d6c697054a]633;C",,terminal_output
7
+ 6,10354,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash]633;D;0",,terminal_output
8
+ 7,65030,"experiments/tokenizer_cross_node_checkpointing_test.sh",0,0,"",shellscript,tab
9
+ 8,72724,"tests/test_checkpointer.py",0,0,"",python,tab
10
+ 9,75785,"tests/test_checkpointer.py",0,0,"import unittest\nimport tempfile\nimport os\nimport jax\nimport jax.numpy as jnp\nfrom flax.training import orbax_utils\nfrom orbax.checkpoint import PyTreeCheckpointer\nfrom pathlib import Path\n\nfrom models.tokenizer import TokenizerVQVAE\nfrom flax.training.train_state import TrainState\nimport optax\nfrom jax.sharding import Mesh, PartitionSpec, NamedSharding\nfrom jax.experimental.mesh_utils import create_device_mesh\n\nclass DistributedCheckpointerTest(unittest.TestCase):\n def setUp(self):\n super().setUp()\n self._temp_dir_manager = tempfile.TemporaryDirectory()\n self.checkpoint_dir = Path(self._temp_dir_manager.name)\n self.addCleanup(self._temp_dir_manager.cleanup)\n\n # FIXME (f.srambical): If the tests pass, we should use the default model config instead\n self.model_kwargs = dict(\n in_dim=3,\n model_dim=8,\n latent_dim=4,\n num_latents=16,\n patch_size=2,\n num_blocks=1,\n num_heads=1,\n dropout=0.0,\n codebook_dropout=0.0,\n )\n self.image_shape = (8, 8, 3)\n self.seq_len = 2\n self.batch_size = 2\n self.seed = 0\n\n def test_distributed_checkpointing(self):\n jax.distributed.initialize()\n num_devices = jax.device_count()\n self.assertGreater(num_devices, 0)\n\n model = TokenizerVQVAE(**self.model_kwargs)\n rng = jax.random.PRNGKey(self.seed)\n dummy_inputs = dict(\n videos=jnp.zeros((self.batch_size, self.seq_len, *self.image_shape), dtype=jnp.float32)\n )\n params = model.init(rng, dummy_inputs)\n\n tx = optax.adam(1e-3)\n state = TrainState.create(apply_fn=model.apply, params=params, tx=tx)\n\n device_mesh_arr = create_device_mesh((num_devices,))\n mesh = Mesh(devices=device_mesh_arr, axis_names=(""data"",))\n replicated_sharding = NamedSharding(mesh, PartitionSpec())\n state = jax.device_put(state, replicated_sharding)\n\n ckpt = {""model"": state}\n orbax_checkpointer = PyTreeCheckpointer()\n save_args = orbax_utils.save_args_from_target(ckpt)\n ckpt_path = str(self.checkpoint_dir / ""test_ckpt"")\n orbax_checkpointer.save(ckpt_path, ckpt, save_args=save_args)\n self.assertTrue(os.path.exists(ckpt_path))\n\n restore_target = {""model"": state}\n restore_args = orbax_utils.restore_args_from_target(restore_target)\n restored = orbax_checkpointer.restore(ckpt_path, item=restore_target, restore_args=restore_args)\n for k in state.params.keys():\n self.assertTrue(jax.tree_util.tree_all(jnp.allclose(state.params[k], restored[""model""].params[k])))\n\nif __name__ == ""__main__"":\n unittest.main()\n",python,content
11
+ 10,76559,"tests/test_checkpointer.py",0,0,"",python,selection_command
12
+ 11,116750,"tests/test_checkpointer.py",697,0,"",python,selection_mouse
13
+ 12,118887,"train_tokenizer.py",0,0,"from dataclasses import dataclass, field\nimport os\nimport time\n\nimport einops\nfrom flax.training import orbax_utils\nfrom flax.training.train_state import TrainState\nfrom jax.sharding import Mesh, PartitionSpec, NamedSharding\nfrom jax.experimental.mesh_utils import create_device_mesh\nimport optax\nfrom orbax.checkpoint import PyTreeCheckpointer\nimport numpy as np\nimport dm_pix as pix\nimport jax\nimport jax.numpy as jnp\nimport tyro\nimport wandb\n\nfrom models.tokenizer import TokenizerVQVAE\nfrom utils.dataloader import get_dataloader\nfrom utils.parameter_utils import count_parameters_by_component\n\nts = int(time.time())\n\n\n@dataclass\nclass Args:\n # Experiment\n num_steps: int = 300_000\n seed: int = 0\n seq_len: int = 16\n image_channels: int = 3\n image_height: int = 90\n image_width: int = 160\n data_dir: str = ""data_tfrecords/coinrun""\n checkpoint: str = """"\n # Optimization\n vq_beta: float = 0.25\n batch_size: int = 48\n min_lr: float = 3e-4\n max_lr: float = 3e-4\n warmup_steps: int = 10000\n # Tokenizer\n model_dim: int = 512\n latent_dim: int = 32\n num_latents: int = 1024\n patch_size: int = 4\n num_blocks: int = 8\n num_heads: int = 8\n dropout: float = 0.0\n codebook_dropout: float = 0.01\n # Logging\n log: bool = False\n entity: str = """"\n project: str = """"\n name: str = ""train_tokenizer""\n tags: list[str] = field(default_factory=lambda: [""tokenizer""])\n log_interval: int = 5\n log_image_interval: int = 250\n ckpt_dir: str = """"\n log_checkpoint_interval: int = 10000\n log_gradients: bool = False\n\n\nargs = tyro.cli(Args)\n\n\ndef tokenizer_loss_fn(params, state, inputs):\n # --- Compute loss ---\n outputs = state.apply_fn(\n params,\n inputs,\n training=True,\n rngs={""params"": inputs[""rng""], ""dropout"": inputs[""dropout_rng""]},\n )\n mse = jnp.square(inputs[""videos""] - outputs[""recon""]).mean()\n q_loss = jnp.square(jax.lax.stop_gradient(outputs[""emb""]) - outputs[""z""]).mean()\n commitment_loss = jnp.square(\n outputs[""emb""] - jax.lax.stop_gradient(outputs[""z""])\n ).mean()\n loss = mse + q_loss + args.vq_beta * commitment_loss\n\n # --- Compute validation metrics ---\n gt = inputs[""videos""].clip(0, 1).reshape(-1, *inputs[""videos""].shape[2:])\n recon = outputs[""recon""].clip(0, 1).reshape(-1, *outputs[""recon""].shape[2:])\n psnr = pix.psnr(gt, recon).mean()\n ssim = pix.ssim(gt, recon).mean()\n _, index_counts = jnp.unique_counts(\n jnp.ravel(outputs[""indices""]), size=args.num_latents, fill_value=0\n )\n codebook_usage = (index_counts != 0).mean()\n metrics = dict(\n loss=loss,\n mse=mse,\n q_loss=q_loss,\n commitment_loss=commitment_loss,\n psnr=psnr,\n ssim=ssim,\n codebook_usage=codebook_usage,\n )\n return loss, (outputs[""recon""], metrics)\n\n\n@jax.jit\ndef train_step(state, inputs):\n grad_fn = jax.value_and_grad(tokenizer_loss_fn, has_aux=True, allow_int=True)\n (loss, (recon, metrics)), grads = grad_fn(state.params, state, inputs)\n state = state.apply_gradients(grads=grads)\n if args.log_gradients:\n metrics[""encoder_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""encoder""]\n )\n metrics[""vq_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""vq""]\n )\n metrics[""decoder_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""decoder""]\n )\n return state, loss, recon, metrics\n\n\nif __name__ == ""__main__"":\n jax.distributed.initialize()\n num_devices = jax.device_count()\n if num_devices == 0:\n raise ValueError(""No JAX devices found."")\n print(f""Running on {num_devices} devices."")\n\n if args.batch_size % num_devices != 0:\n raise ValueError(\n f""Global batch size {args.batch_size} must be divisible by ""\n f""number of devices {num_devices}.""\n )\n\n per_device_batch_size_for_init = args.batch_size // num_devices\n\n rng = jax.random.PRNGKey(args.seed)\n\n # --- Initialize model ---\n tokenizer = TokenizerVQVAE(\n in_dim=args.image_channels,\n model_dim=args.model_dim,\n latent_dim=args.latent_dim,\n num_latents=args.num_latents,\n patch_size=args.patch_size,\n num_blocks=args.num_blocks,\n num_heads=args.num_heads,\n dropout=args.dropout,\n codebook_dropout=args.codebook_dropout,\n )\n rng, _rng = jax.random.split(rng)\n image_shape = (args.image_height, args.image_width, args.image_channels)\n inputs = dict(\n videos=jnp.zeros(\n (per_device_batch_size_for_init, args.seq_len, *image_shape),\n dtype=jnp.float32,\n ),\n )\n init_params = tokenizer.init(_rng, inputs)\n\n param_counts = count_parameters_by_component(init_params)\n\n if args.log and jax.process_index() == 0:\n wandb.init(\n entity=args.entity,\n project=args.project,\n name=args.name,\n tags=args.tags,\n group=""debug"",\n config=args,\n )\n wandb.config.update({""model_param_count"": param_counts})\n\n print(""Parameter counts:"")\n print(param_counts)\n\n # --- Initialize optimizer ---\n lr_schedule = optax.warmup_cosine_decay_schedule(\n args.min_lr, args.max_lr, args.warmup_steps, args.num_steps\n )\n tx = optax.adamw(learning_rate=lr_schedule, b1=0.9, b2=0.9, weight_decay=1e-4)\n train_state = TrainState.create(apply_fn=tokenizer.apply, params=init_params, tx=tx)\n\n # FIXME: switch to create_hybrid_device_mesh for runs spanning multiple nodes\n device_mesh_arr = create_device_mesh((num_devices,))\n mesh = Mesh(devices=device_mesh_arr, axis_names=(""data"",))\n\n replicated_sharding = NamedSharding(mesh, PartitionSpec())\n videos_sharding = NamedSharding(mesh, PartitionSpec(""data"", None, None, None, None))\n train_state = jax.device_put(train_state, replicated_sharding)\n\n # --- Load checkpoint ---\n step = 0\n if args.checkpoint:\n restore_target = {""model"": train_state}\n restore_args = orbax_utils.restore_args_from_target(restore_target)\n train_state.params[""params""].update(\n PyTreeCheckpointer()\n .restore(args.checkpoint, item=restore_target, restore_args=restore_args)[\n ""model""\n ]\n .params[""params""]\n )\n # Assume checkpoint is of the form tokenizer_<timestamp>_<step>\n step += int(args.checkpoint.split(""_"")[-1])\n\n # --- TRAIN LOOP ---\n tfrecord_files = [\n os.path.join(args.data_dir, x)\n for x in os.listdir(args.data_dir)\n if x.endswith("".tfrecord"")\n ]\n dataloader = get_dataloader(\n # NOTE: We deliberately pass the global batch size\n # The dataloader shards the dataset across all processes\n tfrecord_files,\n args.seq_len,\n args.batch_size,\n *image_shape,\n seed=args.seed,\n )\n dataloader = (jax.make_array_from_process_local_data(videos_sharding, elem) for elem in dataloader) # type: ignore\n print(f""Starting training from step {step}..."")\n while step < args.num_steps:\n for videos in dataloader:\n # --- Train step ---\n rng, _rng, _rng_dropout = jax.random.split(rng, 3)\n\n inputs = dict(videos=videos, rng=_rng, dropout_rng=_rng_dropout)\n train_state, loss, recon, metrics = train_step(train_state, inputs)\n print(f""Step {step}, loss: {loss}"")\n step += 1\n\n # --- Logging ---\n if args.log:\n if step % args.log_interval == 0 and jax.process_index() == 0:\n wandb.log(\n {\n ""loss"": loss,\n ""step"": step,\n **metrics,\n }\n )\n if step % args.log_image_interval == 0:\n gt_seq = inputs[""videos""][0]\n recon_seq = recon[0].clip(0, 1)\n comparison_seq = jnp.concatenate((gt_seq, recon_seq), axis=1)\n comparison_seq = einops.rearrange(\n comparison_seq * 255, ""t h w c -> h (t w) c""\n )\n # NOTE: Process-dependent control flow deliberately happens\n # after indexing operation since it must not contain code\n # sections that lead to cross-accelerator communication.\n if jax.process_index() == 0:\n log_images = dict(\n image=wandb.Image(np.asarray(gt_seq[0])),\n recon=wandb.Image(np.asarray(recon_seq[0])),\n true_vs_recon=wandb.Image(\n np.asarray(comparison_seq.astype(np.uint8))\n ),\n )\n wandb.log(log_images)\n if step % args.log_checkpoint_interval == 0:\n ckpt = {""model"": train_state}\n orbax_checkpointer = PyTreeCheckpointer()\n save_args = orbax_utils.save_args_from_target(ckpt)\n orbax_checkpointer.save(\n os.path.join(os.getcwd(), args.ckpt_dir, f""tokenizer_{ts}_{step}""),\n ckpt,\n save_args=save_args,\n )\n if step >= args.num_steps:\n break\n",python,tab
14
+ 13,119017,"train_tokenizer.py",0,9533,"from dataclasses import dataclass, field\nimport os\nimport time\n\nimport einops\nfrom flax.training import orbax_utils\nfrom flax.training.train_state import TrainState\nfrom jax.sharding import Mesh, PartitionSpec, NamedSharding\nfrom jax.experimental.mesh_utils import create_device_mesh\nimport optax\nfrom orbax.checkpoint import PyTreeCheckpointer\nimport numpy as np\nimport dm_pix as pix\nimport jax\nimport jax.numpy as jnp\nimport tyro\nimport wandb\n\nfrom models.tokenizer import TokenizerVQVAE\nfrom utils.dataloader import get_dataloader\nfrom utils.parameter_utils import count_parameters_by_component\n\nts = int(time.time())\n\n\n@dataclass\nclass Args:\n # Experiment\n num_steps: int = 300_000\n seed: int = 0\n seq_len: int = 16\n image_channels: int = 3\n image_height: int = 90\n image_width: int = 160\n data_dir: str = ""data_tfrecords/coinrun""\n checkpoint: str = """"\n # Optimization\n vq_beta: float = 0.25\n batch_size: int = 48\n min_lr: float = 3e-4\n max_lr: float = 3e-4\n warmup_steps: int = 10000\n # Tokenizer\n model_dim: int = 512\n latent_dim: int = 32\n num_latents: int = 1024\n patch_size: int = 4\n num_blocks: int = 8\n num_heads: int = 8\n dropout: float = 0.0\n codebook_dropout: float = 0.01\n # Logging\n log: bool = False\n entity: str = """"\n project: str = """"\n name: str = ""train_tokenizer""\n tags: list[str] = field(default_factory=lambda: [""tokenizer""])\n log_interval: int = 5\n log_image_interval: int = 250\n ckpt_dir: str = """"\n log_checkpoint_interval: int = 10000\n log_gradients: bool = False\n\n\nargs = tyro.cli(Args)\n\n\ndef tokenizer_loss_fn(params, state, inputs):\n # --- Compute loss ---\n outputs = state.apply_fn(\n params,\n inputs,\n training=True,\n rngs={""params"": inputs[""rng""], ""dropout"": inputs[""dropout_rng""]},\n )\n mse = jnp.square(inputs[""videos""] - outputs[""recon""]).mean()\n q_loss = jnp.square(jax.lax.stop_gradient(outputs[""emb""]) - outputs[""z""]).mean()\n commitment_loss = jnp.square(\n outputs[""emb""] - jax.lax.stop_gradient(outputs[""z""])\n ).mean()\n loss = mse + q_loss + args.vq_beta * commitment_loss\n\n # --- Compute validation metrics ---\n gt = inputs[""videos""].clip(0, 1).reshape(-1, *inputs[""videos""].shape[2:])\n recon = outputs[""recon""].clip(0, 1).reshape(-1, *outputs[""recon""].shape[2:])\n psnr = pix.psnr(gt, recon).mean()\n ssim = pix.ssim(gt, recon).mean()\n _, index_counts = jnp.unique_counts(\n jnp.ravel(outputs[""indices""]), size=args.num_latents, fill_value=0\n )\n codebook_usage = (index_counts != 0).mean()\n metrics = dict(\n loss=loss,\n mse=mse,\n q_loss=q_loss,\n commitment_loss=commitment_loss,\n psnr=psnr,\n ssim=ssim,\n codebook_usage=codebook_usage,\n )\n return loss, (outputs[""recon""], metrics)\n\n\n@jax.jit\ndef train_step(state, inputs):\n grad_fn = jax.value_and_grad(tokenizer_loss_fn, has_aux=True, allow_int=True)\n (loss, (recon, metrics)), grads = grad_fn(state.params, state, inputs)\n state = state.apply_gradients(grads=grads)\n if args.log_gradients:\n metrics[""encoder_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""encoder""]\n )\n metrics[""vq_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""vq""]\n )\n metrics[""decoder_gradients_std/""] = jax.tree.map(\n lambda x: x.std(), grads[""params""][""decoder""]\n )\n return state, loss, recon, metrics\n\n\nif __name__ == ""__main__"":\n jax.distributed.initialize()\n num_devices = jax.device_count()\n if num_devices == 0:\n raise ValueError(""No JAX devices found."")\n print(f""Running on {num_devices} devices."")\n\n if args.batch_size % num_devices != 0:\n raise ValueError(\n f""Global batch size {args.batch_size} must be divisible by ""\n f""number of devices {num_devices}.""\n )\n\n per_device_batch_size_for_init = args.batch_size // num_devices\n\n rng = jax.random.PRNGKey(args.seed)\n\n # --- Initialize model ---\n tokenizer = TokenizerVQVAE(\n in_dim=args.image_channels,\n model_dim=args.model_dim,\n latent_dim=args.latent_dim,\n num_latents=args.num_latents,\n patch_size=args.patch_size,\n num_blocks=args.num_blocks,\n num_heads=args.num_heads,\n dropout=args.dropout,\n codebook_dropout=args.codebook_dropout,\n )\n rng, _rng = jax.random.split(rng)\n image_shape = (args.image_height, args.image_width, args.image_channels)\n inputs = dict(\n videos=jnp.zeros(\n (per_device_batch_size_for_init, args.seq_len, *image_shape),\n dtype=jnp.float32,\n ),\n )\n init_params = tokenizer.init(_rng, inputs)\n\n param_counts = count_parameters_by_component(init_params)\n\n if args.log and jax.process_index() == 0:\n wandb.init(\n entity=args.entity,\n project=args.project,\n name=args.name,\n tags=args.tags,\n group=""debug"",\n config=args,\n )\n wandb.config.update({""model_param_count"": param_counts})\n\n print(""Parameter counts:"")\n print(param_counts)\n\n # --- Initialize optimizer ---\n lr_schedule = optax.warmup_cosine_decay_schedule(\n args.min_lr, args.max_lr, args.warmup_steps, args.num_steps\n )\n tx = optax.adamw(learning_rate=lr_schedule, b1=0.9, b2=0.9, weight_decay=1e-4)\n train_state = TrainState.create(apply_fn=tokenizer.apply, params=init_params, tx=tx)\n\n # FIXME: switch to create_hybrid_device_mesh for runs spanning multiple nodes\n device_mesh_arr = create_device_mesh((num_devices,))\n mesh = Mesh(devices=device_mesh_arr, axis_names=(""data"",))\n\n replicated_sharding = NamedSharding(mesh, PartitionSpec())\n videos_sharding = NamedSharding(mesh, PartitionSpec(""data"", None, None, None, None))\n train_state = jax.device_put(train_state, replicated_sharding)\n\n # --- Load checkpoint ---\n step = 0\n if args.checkpoint:\n restore_target = {""model"": train_state}\n restore_args = orbax_utils.restore_args_from_target(restore_target)\n train_state.params[""params""].update(\n PyTreeCheckpointer()\n .restore(args.checkpoint, item=restore_target, restore_args=restore_args)[\n ""model""\n ]\n .params[""params""]\n )\n # Assume checkpoint is of the form tokenizer_<timestamp>_<step>\n step += int(args.checkpoint.split(""_"")[-1])\n\n # --- TRAIN LOOP ---\n tfrecord_files = [\n os.path.join(args.data_dir, x)\n for x in os.listdir(args.data_dir)\n if x.endswith("".tfrecord"")\n ]\n dataloader = get_dataloader(\n # NOTE: We deliberately pass the global batch size\n # The dataloader shards the dataset across all processes\n tfrecord_files,\n args.seq_len,\n args.batch_size,\n *image_shape,\n seed=args.seed,\n )\n dataloader = (jax.make_array_from_process_local_data(videos_sharding, elem) for elem in dataloader) # type: ignore\n print(f""Starting training from step {step}..."")\n while step < args.num_steps:\n for videos in dataloader:\n # --- Train step ---\n rng, _rng, _rng_dropout = jax.random.split(rng, 3)\n\n inputs = dict(videos=videos, rng=_rng, dropout_rng=_rng_dropout)\n train_state, loss, recon, metrics = train_step(train_state, inputs)\n print(f""Step {step}, loss: {loss}"")\n step += 1\n\n # --- Logging ---\n if args.log:\n if step % args.log_interval == 0 and jax.process_index() == 0:\n wandb.log(\n {\n ""loss"": loss,\n ""step"": step,\n **metrics,\n }\n )\n if step % args.log_image_interval == 0:\n gt_seq = inputs[""videos""][0]\n recon_seq = recon[0].clip(0, 1)\n comparison_seq = jnp.concatenate((gt_seq, recon_seq), axis=1)\n comparison_seq = einops.rearrange(\n comparison_seq * 255, ""t h w c -> h (t w) c""\n )\n # NOTE: Process-dependent control flow deliberately happens\n # after indexing operation since it must not contain code\n # sections that lead to cross-accelerator communication.\n if jax.process_index() == 0:\n log_images = dict(\n image=wandb.Image(np.asarray(gt_seq[0])),\n recon=wandb.Image(np.asarray(recon_seq[0])),\n true_vs_recon=wandb.Image(\n np.asarray(comparison_seq.astype(np.uint8))\n ),\n )\n wandb.log(log_images)\n if step % args.log_checkpoint_interval == 0:\n ckpt = {""model"": train_state}\n orbax_checkpointer = PyTreeCheckpointer()\n save_args = orbax_utils.save_args_from_target(ckpt)\n orbax_checkpointer.save(\n os.path.join(os.getcwd(), args.ckpt_dir, f""tokenizer_{ts}_{step}""),\n ckpt,\n save_args=save_args,\n )\n if step >= args.num_steps:\n break\n",python,selection_command
15
+ 14,119294,"train_tokenizer.py",9533,0,"",python,selection_command
16
+ 15,610807,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
17
+ 16,610830,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2;d193c799-eb50-4b87-89db-ea172d98a654]633;C",,terminal_output
18
+ 17,759508,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 --gpu-bind=single:1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
19
+ 18,759658,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 --gpu-bind=single:1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2;d193c799-eb50-4b87-89db-ea172d98a654]633;Csalloc: Granted job allocation 26664731\r\n",,terminal_output
20
+ 19,759723,"TERMINAL",0,0,"salloc: Nodes gpusrv[69-70] are ready for job\r\n",,terminal_output
21
+ 20,760047,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
22
+ 21,761817,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
23
+ 22,761915,"TERMINAL",0,0,"s': python -m unittest tests.test_tokenizer_reproducibility.TokenizerReproducibilityTest -v",,terminal_output
24
+ 23,761971,"TERMINAL",0,0,"r': srun echo $CUDA_VISIBLE_DEVICES\r\n\r",,terminal_output
25
+ 24,762166,"TERMINAL",0,0,"[1@u': sru[1@n': srun",,terminal_output
26
+ 25,762797,"TERMINAL",0,0,"\r[8@[franz.srambical@gpusrv69 jafar]$ srun",,terminal_output
27
+ 26,762903,"TERMINAL",0,0,"[?25l[?2004l\r[?25h",,terminal_output
28
+ 27,763132,"TERMINAL",0,0,"0,1\r\n0,1\r\n",,terminal_output
29
+ 28,763232,"TERMINAL",0,0,"0,1\r\n0,1\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
30
+ 29,952005,"TERMINAL",0,0,"e",,terminal_output
31
+ 30,952401,"TERMINAL",0,0,"[?25lx[?25h",,terminal_output
32
+ 31,952402,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
33
+ 32,952403,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
34
+ 33,952404,"TERMINAL",0,0,"[?25l[?2004l\rexit\r\n[?25h",,terminal_output
35
+ 34,952452,"TERMINAL",0,0,"salloc: Relinquishing job allocation 26664731\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar",,terminal_output
36
+ 35,980297,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
37
+ 36,980308,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2;d193c799-eb50-4b87-89db-ea172d98a654]633;C",,terminal_output
38
+ 37,992032,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
39
+ 38,992121,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2;d193c799-eb50-4b87-89db-ea172d98a654]633;C",,terminal_output
40
+ 39,992138,"TERMINAL",0,0,"salloc: error: Failed to validate job spec. --gpus-per-task or --tres-per-task used without either --gpus or -n/--ntasks is not allowed.\r\nsalloc: error: Invalid generic resource (gres) specification\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D;1",,terminal_output
41
+ 40,1283900,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
42
+ 41,1283922,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2;d193c799-eb50-4b87-89db-ea172d98a654]633;Csalloc: error: Failed to validate job spec. --gpus-per-task or --tres-per-task used without either --gpus or -n/--ntasks is not allowed.\r\nsalloc: error: Invalid generic resource (gres) specification\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D;1",,terminal_output
43
+ 42,1299071,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
44
+ 43,1299086,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2;d193c799-eb50-4b87-89db-ea172d98a654]633;C",,terminal_output
45
+ 44,1390358,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2 --ntasks=4",,terminal_command
46
+ 45,1390513,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2 --ntasks=4;d193c799-eb50-4b87-89db-ea172d98a654]633;Csalloc: Granted job allocation 26664743\r\n",,terminal_output
47
+ 46,1390578,"TERMINAL",0,0,"salloc: Nodes gpusrv[69-70] are ready for job\r\n",,terminal_output
48
+ 47,1390938,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
49
+ 48,1392447,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
50
+ 49,1392695,"TERMINAL",0,0,"s': srun echo $CUDA_VISIBLE_DEVICES\r",,terminal_output
51
+ 50,1392808,"TERMINAL",0,0,"[?25lsu': squeue -w supergpu16,supergpu18,gpusrv[69,70],supergpu14[?25h",,terminal_output
52
+ 51,1392897,"TERMINAL",0,0,"[?25ls\rfailed reverse-i-search)`sun': squeue -w supergpu16,supergpu18,gpusrv[69,70],supergpu14[?25h",,terminal_output
53
+ 52,1394909,"TERMINAL",0,0,"\r[2@[franz.srambical@gpusrv69 jafar]$",,terminal_output
54
+ 53,1395027,"TERMINAL",0,0,"\r-me",,terminal_output
55
+ 54,1395757,"TERMINAL",0,0,"alloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 -w gpusrv69,gpusrv70 --cpus-per-task=8/usr/bin/python3 /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/printEnvVariablesToFile.py /ictstr01/home/aih/franz.srambical/.cursor-server/extensions/ms-python.python-2024.12.3-linux-x64/python_files/deactivate/bash/envVars.txtsource .venv/bin/activate\r\n\r\r\n\r\r\n\rbash experiments/tokenizer_cross_node_checkpointing_test.sh nvidia-smi \r\n\rsrun test.shecho $CUDA_VISIBLE_DEVICESexitsrun echo $CUDA_VISIBLE_DEVICESidlequeuesqueue --mepython -m unittest tests.test_tokenizer_reproducibility.TokenizerReproducibilityTest -v",,terminal_output
56
+ 55,1396281,"TERMINAL",0,0,"exit\r\n\rsrun echo $CUDA_VISIBLE_DEVICESexit",,terminal_output
57
+ 56,1396806,"TERMINAL",0,0,"",,terminal_output
58
+ 57,1397150,"TERMINAL",0,0,"",,terminal_output
59
+ 58,1397331,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
60
+ 59,1397492,"TERMINAL",0,0,"s': srun echo $CUDA_VISIBLE_DEVICES\r",,terminal_output
61
+ 60,1397562,"TERMINAL",0,0,"[?25ls[1@r': sr[?25h",,terminal_output
62
+ 61,1397610,"TERMINAL",0,0,"[?25ls[1@u': sru[?25h",,terminal_output
63
+ 62,1397679,"TERMINAL",0,0,"[?25ls[1@n': srun[?25h",,terminal_output
64
+ 63,1398229,"TERMINAL",0,0,"\r[8@[franz.srambical@gpusrv69 jafar]$ srun",,terminal_output
65
+ 64,1398465,"TERMINAL",0,0,"[?25l[?2004l\r[?25h",,terminal_output
66
+ 65,1398669,"TERMINAL",0,0,"0,1\r\n0,1\r\n0,1\r\n0,1\r\n",,terminal_output
67
+ 66,1398805,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
68
+ 67,1533571,"TERMINAL",0,0,"srun printenv | grep CUDA_VISIBLE_DEVICES",,terminal_output
69
+ 68,1534010,"TERMINAL",0,0,"[?25l\rsrun printenv | grep CUDA_VISIBLE_DEVICES\r\n[?2004l\r[?25h",,terminal_output
70
+ 69,1534199,"TERMINAL",0,0,"CUDA_VISIBLE_DEVICES=0\r\nCUDA_VISIBLE_DEVICES=0\r\nCUDA_VISIBLE_DEVICES=0\r\nCUDA_VISIBLE_DEVICES=0\r\n",,terminal_output
71
+ 70,1534330,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
72
+ 71,1692595,"TERMINAL",0,0," \r\n\rsrun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'\r\n\r\n\r ",,terminal_output
73
+ 72,1693091,"TERMINAL",0,0," \r\n\rsrun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'\r\n\r\n\r ",,terminal_output
74
+ 73,1693793,"TERMINAL",0,0,"\r\n\r\n\r\n\r",,terminal_output
75
+ 74,1694392,"TERMINAL",0,0,"",,terminal_output
76
+ 75,1694563,"TERMINAL",0,0,"",,terminal_output
77
+ 76,1694818,"TERMINAL",0,0,"",,terminal_output
78
+ 77,1694913,"TERMINAL",0,0,"\r",,terminal_output
79
+ 78,1695172,"TERMINAL",0,0,"",,terminal_output
80
+ 79,1695517,"TERMINAL",0,0,"",,terminal_output
81
+ 80,1695977,"TERMINAL",0,0,"\r",,terminal_output
82
+ 81,1696813,"TERMINAL",0,0,"",,terminal_output
83
+ 82,1697756,"TERMINAL",0,0,"\r\n\r",,terminal_output
84
+ 83,1698019,"TERMINAL",0,0,"\r",,terminal_output
85
+ 84,1698512,"TERMINAL",0,0,"\r\n\r",,terminal_output
86
+ 85,1699085,"TERMINAL",0,0,"\r",,terminal_output
87
+ 86,1699359,"TERMINAL",0,0,"",,terminal_output
88
+ 87,1700194,"TERMINAL",0,0,"",,terminal_output
89
+ 88,1700941,"TERMINAL",0,0,"\r\n\r",,terminal_output
90
+ 89,1701893,"TERMINAL",0,0,"[?25l\r[?25h",,terminal_output
91
+ 90,1702455,"TERMINAL",0,0,"srun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
92
+ 91,1703242,"TERMINAL",0,0,"srun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid -format=csv,noheader'srun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'srun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'srun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'srun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'srun --ntasks=4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'",,terminal_output
93
+ 92,1703948,"TERMINAL",0,0,"",,terminal_output
94
+ 93,1704421,"TERMINAL",0,0,"[?25l4 bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
95
+ 94,1704858,"TERMINAL",0,0,"[?25ls= bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h[?25ls bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h[?25lk bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h[?25ls bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h[?25la bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25ln bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
96
+ 95,1704997,"TERMINAL",0,0,"[?25l- bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
97
+ 96,1705183,"TERMINAL",0,0,"[?25l- bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
98
+ 97,1705521,"TERMINAL",0,0,"[?25l bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'[?25h",,terminal_output
99
+ 98,1706097,"TERMINAL",0,0,"\r\n\r",,terminal_output
100
+ 99,1706287,"TERMINAL",0,0,"[?25l[?2004l\r[?25h",,terminal_output
101
+ 100,1706540,"TERMINAL",0,0,"GPU-f3062939-2421-5673-6abc-1eb76d971cd6\r\nGPU-3e808c85-2952-72e2-8da6-6beec88de390\r\nGPU-e3008a0f-dcb9-f740-edf8-3364a398e339\r\nGPU-1bb263c4-21ed-4863-da84-ca4f36c17637\r\n",,terminal_output
102
+ 101,1706652,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
103
+ 102,2239299,"experiments/tokenizer_cross_node_checkpointing_test.sh",0,0,"",shellscript,tab
104
+ 103,2241491,"experiments/tokenizer_cross_node_checkpointing_test.sh",274,0,"",shellscript,selection_mouse
105
+ 104,2242979,"experiments/tokenizer_cross_node_checkpointing_test.sh",249,0,"",shellscript,selection_command
106
+ 105,2243137,"experiments/tokenizer_cross_node_checkpointing_test.sh",214,0,"",shellscript,selection_command
107
+ 106,2243294,"experiments/tokenizer_cross_node_checkpointing_test.sh",145,0,"",shellscript,selection_command
108
+ 107,2244746,"experiments/tokenizer_cross_node_checkpointing_test.sh",146,0,"",shellscript,selection_command
109
+ 108,2244853,"experiments/tokenizer_cross_node_checkpointing_test.sh",156,0,"",shellscript,selection_command
110
+ 109,2245129,"experiments/tokenizer_cross_node_checkpointing_test.sh",128,0,"",shellscript,selection_command
111
+ 110,2245985,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"",shellscript,selection_command
112
+ 111,2252860,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,2,"",shellscript,content
113
+ 112,2253835,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"8",shellscript,content
114
+ 113,2253836,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"",shellscript,selection_keyboard
115
+ 114,2254161,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,1,"",shellscript,content
116
+ 115,2254258,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"3",shellscript,content
117
+ 116,2254259,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"",shellscript,selection_keyboard
118
+ 117,2254381,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"8",shellscript,content
119
+ 118,2254382,"experiments/tokenizer_cross_node_checkpointing_test.sh",127,0,"",shellscript,selection_keyboard
120
+ 119,2254771,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,1,"",shellscript,content
121
+ 120,2254881,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,1,"",shellscript,content
122
+ 121,2254983,"experiments/tokenizer_cross_node_checkpointing_test.sh",125,0,"4",shellscript,content
123
+ 122,2254984,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"",shellscript,selection_keyboard
124
+ 123,2255096,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"8",shellscript,content
125
+ 124,2255097,"experiments/tokenizer_cross_node_checkpointing_test.sh",127,0,"",shellscript,selection_keyboard
126
+ 125,2255383,"experiments/tokenizer_cross_node_checkpointing_test.sh",126,0,"",shellscript,selection_command
127
+ 126,2255979,"experiments/tokenizer_cross_node_checkpointing_test.sh",148,0,"",shellscript,selection_command
128
+ 127,2263053,"TERMINAL",0,0,"b",,terminal_output
129
+ 128,2263217,"TERMINAL",0,0,"[?25la[?25h[?25ls[?25h",,terminal_output
130
+ 129,2263349,"TERMINAL",0,0,"[?25lh[?25h",,terminal_output
131
+ 130,2263715,"TERMINAL",0,0,"[?25l [?25h",,terminal_output
132
+ 131,2263945,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
133
+ 132,2264024,"TERMINAL",0,0,"[?25lo[?25h[?25lk[?25h",,terminal_output
134
+ 133,2264159,"TERMINAL",0,0,"[?25le[?25h",,terminal_output
135
+ 134,2264232,"TERMINAL",0,0,"[?25ln[?25h",,terminal_output
136
+ 135,2264356,"TERMINAL",0,0,"",,terminal_output
137
+ 136,2265077,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
138
+ 137,2265131,"TERMINAL",0,0,"",,terminal_output
139
+ 138,2265996,"TERMINAL",0,0,"",,terminal_output
140
+ 139,2266129,"TERMINAL",0,0,"",,terminal_output
141
+ 140,2267228,"TERMINAL",0,0,"",,terminal_output
142
+ 141,2267477,"TERMINAL",0,0,"[?25le[?25h",,terminal_output
143
+ 142,2267861,"TERMINAL",0,0,"[?25lx[?25h",,terminal_output
144
+ 143,2267966,"TERMINAL",0,0,"[?25lp[?25h",,terminal_output
145
+ 144,2268137,"TERMINAL",0,0,"[?25le[?25h[?25lr[?25h",,terminal_output
146
+ 145,2268204,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
147
+ 146,2268274,"TERMINAL",0,0,"[?25lm[?25h",,terminal_output
148
+ 147,2268361,"TERMINAL",0,0,"ents/",,terminal_output
149
+ 148,2268557,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
150
+ 149,2268663,"TERMINAL",0,0,"[?25lo[?25h[?25lk[?25h",,terminal_output
151
+ 150,2268761,"TERMINAL",0,0,"enizer_",,terminal_output
152
+ 151,2270197,"TERMINAL",0,0,"[?25lc[?25h",,terminal_output
153
+ 152,2270355,"TERMINAL",0,0,"[?25lr[?25h",,terminal_output
154
+ 153,2270438,"TERMINAL",0,0,"[?25lo[?25h",,terminal_output
155
+ 154,2270578,"TERMINAL",0,0,"ss_node_checkpointing_test.sh ",,terminal_output
156
+ 155,2270712,"TERMINAL",0,0,"",,terminal_output
157
+ 156,2290521,"experiments/tokenizer_cross_node_checkpointing_test.sh",130,69,"",shellscript,content
158
+ 157,2290535,"experiments/tokenizer_cross_node_checkpointing_test.sh",134,0,"",shellscript,selection_command
159
+ 158,2292564,"TERMINAL",0,0,"[?25l[?2004l\r[?25h",,terminal_output
160
+ 159,2302589,"TERMINAL",0,0,"^Csrun: interrupt (one more within 1 sec to abort)\r\nsrun: StepId=26664743.3 tasks 0-3: running\r\n",,terminal_output
161
+ 160,2302695,"TERMINAL",0,0,"^Csrun: sending Ctrl-C to StepId=26664743.3\r\nsrun: forcing job termination\r\nsrun: Job step aborted: Waiting up to 32 seconds for job step to finish.\r\nslurmstepd: error: *** STEP 26664743.3 ON gpusrv69 CANCELLED AT 2025-07-03T21:25:25 ***\r\n",,terminal_output
162
+ 161,2302843,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
163
+ 162,2304357,"experiments/tokenizer_cross_node_checkpointing_test.sh",306,0,"",shellscript,selection_mouse
164
+ 163,2304360,"experiments/tokenizer_cross_node_checkpointing_test.sh",305,0,"",shellscript,selection_command
165
+ 164,2305257,"experiments/tokenizer_cross_node_checkpointing_test.sh",136,0,"ckpt_dir checkpoints/tokenizer_cross_node_checkpointing_test \\n --",shellscript,content
166
+ 165,2305267,"experiments/tokenizer_cross_node_checkpointing_test.sh",148,0,"",shellscript,selection_command
167
+ 166,2306283,"experiments/tokenizer_cross_node_checkpointing_test.sh",130,68," --ckpt_dir checkpoints/tokenizer_cross_node_checkpointing_test \",shellscript,selection_command
168
+ 167,2306459,"experiments/tokenizer_cross_node_checkpointing_test.sh",130,103," --ckpt_dir checkpoints/tokenizer_cross_node_checkpointing_test \\n --log_checkpoint_interval 10 \",shellscript,selection_command
169
+ 168,2306883,"experiments/tokenizer_cross_node_checkpointing_test.sh",130,104,"",shellscript,content
170
+ 169,2306888,"experiments/tokenizer_cross_node_checkpointing_test.sh",134,0,"",shellscript,selection_command
171
+ 170,2309491,"TERMINAL",0,0,"bash experiments/tokenizer_cross_node_checkpointing_test.sh ",,terminal_output
172
+ 171,2309846,"TERMINAL",0,0,"[franz.srambical@gpusrv69 jafar]$ bash experiments/tokenizer_cross_node_checkpointing_test.sh ",,terminal_output
173
+ 172,2310154,"TERMINAL",0,0,"[?25l[?2004l\r[?25h",,terminal_output
174
+ 173,2368708,"experiments/tokenizer_cross_node_checkpointing_test.sh",74,0,"",shellscript,selection_mouse
175
+ 174,2370127,"experiments/tokenizer_cross_node_checkpointing_test.sh",48,0,"",shellscript,selection_command
176
+ 175,2370314,"experiments/tokenizer_cross_node_checkpointing_test.sh",47,0,"",shellscript,selection_command
177
+ 176,2370628,"experiments/tokenizer_cross_node_checkpointing_test.sh",46,0,"",shellscript,selection_command
178
+ 177,2409878,"experiments/tokenizer_cross_node_checkpointing_test.sh",47,0,"",shellscript,selection_command
179
+ 178,2412239,"experiments/tokenizer_cross_node_checkpointing_test.sh",48,0,"",shellscript,selection_command
180
+ 179,2412495,"experiments/tokenizer_cross_node_checkpointing_test.sh",56,0,"",shellscript,selection_command
181
+ 180,2412522,"experiments/tokenizer_cross_node_checkpointing_test.sh",58,0,"",shellscript,selection_command
182
+ 181,2412554,"experiments/tokenizer_cross_node_checkpointing_test.sh",72,0,"",shellscript,selection_command
183
+ 182,2412581,"experiments/tokenizer_cross_node_checkpointing_test.sh",74,0,"",shellscript,selection_command
184
+ 183,2412616,"experiments/tokenizer_cross_node_checkpointing_test.sh",75,0,"",shellscript,selection_command
185
+ 184,2412652,"experiments/tokenizer_cross_node_checkpointing_test.sh",80,0,"",shellscript,selection_command
186
+ 185,2413532,"experiments/tokenizer_cross_node_checkpointing_test.sh",87,0,"",shellscript,selection_command
187
+ 186,2415112,"experiments/tokenizer_cross_node_checkpointing_test.sh",102,0,"",shellscript,selection_command
188
+ 187,2415352,"experiments/tokenizer_cross_node_checkpointing_test.sh",103,0,"",shellscript,selection_command
189
+ 188,2461686,"TERMINAL",0,0,"2025-07-03 21:28:04.344578: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-03 21:28:04.344619: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-03 21:28:04.344695: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-03 21:28:04.344729: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n",,terminal_output
190
+ 189,2462333,"TERMINAL",0,0,"WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751570885.025387 2463513 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751570885.025374 2463514 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751570885.026820 2459674 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751570885.026835 2459675 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\n",,terminal_output
191
+ 190,2462775,"TERMINAL",0,0,"E0000 00:00:1751570885.469961 2463514 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nE0000 00:00:1751570885.469988 2463513 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nE0000 00:00:1751570885.470054 2459674 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nE0000 00:00:1751570885.470059 2459675 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\n",,terminal_output
192
+ 191,2464525,"TERMINAL",0,0,"W0000 00:00:1751570887.196521 2463513 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.196573 2463513 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.196580 2463513 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.196584 2463513 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.196532 2463514 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.196572 2463514 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.196576 2463514 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.196579 2463514 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.218392 2459674 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.218432 2459674 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.218438 2459674 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.218441 2459674 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.218429 2459675 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.218491 2459675 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.218497 2459675 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751570887.218501 2459675 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\n",,terminal_output
193
+ 192,2619154,"TERMINAL",0,0,"W0000 00:00:1751571041.843067 2463513 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751571041.843086 2459674 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751571041.843105 2463514 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751571041.843055 2459675 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\n",,terminal_output
194
+ 193,2925218,"TERMINAL",0,0,"2025-07-03 21:35:47.896755: F external/xla/xla/pjrt/distributed/client.h:80] Terminating process because the JAX distributed service detected fatal errors. This most likely indicates that another task died; see the other task logs for more details. Disable Python buffering, i.e. `python -u`, to be sure to see all the previous output. absl::Status: DEADLINE_EXCEEDED: Deadline Exceeded\r\n\r\nRPC: /tensorflow.CoordinationService/RegisterTask\r\n2025-07-03 21:35:47.896778: F external/xla/xla/pjrt/distributed/client.h:80] Terminating process because the JAX distributed service detected fatal errors. This most likely indicates that another task died; see the other task logs for more details. Disable Python buffering, i.e. `python -u`, to be sure to see all the previous output. absl::Status: DEADLINE_EXCEEDED: Deadline Exceeded\r\n\r\nRPC: /tensorflow.CoordinationService/RegisterTask\r\n2025-07-03 21:35:47.897076: F external/xla/xla/pjrt/distributed/client.h:80] Terminating process because the JAX distributed service detected fatal errors. This most likely indicates that another task died; see the other task logs for more details. Disable Python buffering, i.e. `python -u`, to be sure to see all the previous output. absl::Status: DEADLINE_EXCEEDED: Deadline Exceeded\r\n\r\nRPC: /tensorflow.CoordinationService/RegisterTask\r\n2025-07-03 21:35:47.897090: F external/xla/xla/pjrt/distributed/client.h:80] Terminating process because the JAX distributed service detected fatal errors. This most likely indicates that another task died; see the other task logs for more details. Disable Python buffering, i.e. `python -u`, to be sure to see all the previous output. absl::Status: DEADLINE_EXCEEDED: Deadline Exceeded\r\n\r\nRPC: /tensorflow.CoordinationService/RegisterTask\r\n",,terminal_output
195
+ 194,2925910,"TERMINAL",0,0,"srun: error: gpusrv70: tasks 2-3: Aborted (core dumped)\r\nsrun: error: gpusrv69: tasks 0-1: Aborted (core dumped)\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
196
+ 195,3136855,"TERMINAL",0,0,"e",,terminal_output
197
+ 196,3137164,"TERMINAL",0,0,"[?25lx[?25h",,terminal_output
198
+ 197,3137217,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
199
+ 198,3137489,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
200
+ 199,3139183,"TERMINAL",0,0,"",,terminal_output
201
+ 200,3211564,"TERMINAL",0,0,"bash experiments/tokenizer_cross_node_checkpointing_test.sh ",,terminal_output
202
+ 201,3212608,"TERMINAL",0,0,"\r\n\r",,terminal_output
203
+ 202,3213418,"TERMINAL",0,0,"e",,terminal_output
204
+ 203,3213649,"TERMINAL",0,0,"[?25lx[?25h",,terminal_output
205
+ 204,3213848,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
206
+ 205,3214091,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
207
+ 206,3214616,"TERMINAL",0,0,"[?25l[?2004l\rexit\r\n[?25h",,terminal_output
208
+ 207,3214833,"TERMINAL",0,0,"srun: error: gpusrv69: task 0: Exited with exit code 134\r\nsalloc: Relinquishing job allocation 26664743\r\nsalloc: Job allocation 26664743 has been revoked.\r\n",,terminal_output
209
+ 208,3223824,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
210
+ 209,3223846,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2;d193c799-eb50-4b87-89db-ea172d98a654]633;C",,terminal_output
211
+ 210,3239955,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
212
+ 211,3240035,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2;d193c799-eb50-4b87-89db-ea172d98a654]633;Csalloc: Granted job allocation 26664812\r\n",,terminal_output
213
+ 212,3240143,"TERMINAL",0,0,"salloc: Nodes gpusrv[69-70] are ready for job\r\n",,terminal_output
214
+ 213,3240527,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
215
+ 214,3242400,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
216
+ 215,3242669,"TERMINAL",0,0,"[61@s': bash experiments/tokenizer_cross_node_checkpointing_test.sh",,terminal_output
217
+ 216,3243226,"TERMINAL",0,0,"[?25ls\ro': source .venv/bin/activate[?25h",,terminal_output
218
+ 217,3243536,"TERMINAL",0,0,"[?25ls[1@u': sou[?25h",,terminal_output
219
+ 218,3244078,"TERMINAL",0,0,"\r[9@[franz.srambical@gpusrv69 jafar]$ sou\r\n[?2004l\r]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h(jafar) [franz.srambical@gpusrv69 jafar]$ ",,terminal_output
220
+ 219,3247297,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
221
+ 220,3247926,"TERMINAL",0,0,"b': source .venv/bin/activate",,terminal_output
222
+ 221,3248048,"TERMINAL",0,0,"[?25lba': bash experiments/tokenizer_cross_node_checkpointing_test.sh \r[?25h",,terminal_output
223
+ 222,3248131,"TERMINAL",0,0,"[?25lb[1@s': bas[?25h",,terminal_output
224
+ 223,3248236,"TERMINAL",0,0,"[?25lb[1@h': bash[?25h",,terminal_output
225
+ 224,3249224,"TERMINAL",0,0,"\rjafar) [franz.srambical@gpusrv69 jafar]$ bash experiments/tokenizer_cross_node_checkpointing_test.sh \r\n\r",,terminal_output
226
+ 225,3250054,"TERMINAL",0,0,"\r\n[?2004l\r",,terminal_output
227
+ 226,3321398,"TERMINAL",0,0,"2025-07-03 21:42:24.064048: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-03 21:42:24.064041: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-03 21:42:24.065689: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-03 21:42:24.065698: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n",,terminal_output
228
+ 227,3322051,"TERMINAL",0,0,"WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751571744.633994 2466893 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751571744.633988 2466892 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751571744.649136 2462879 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751571744.649129 2462880 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\n",,terminal_output
229
+ 228,3322173,"TERMINAL",0,0,"E0000 00:00:1751571744.801568 2462879 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nE0000 00:00:1751571744.801616 2462880 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nE0000 00:00:1751571744.808444 2466892 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nE0000 00:00:1751571744.808457 2466893 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\n",,terminal_output
230
+ 229,3323053,"TERMINAL",0,0,"W0000 00:00:1751571745.740866 2466892 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.740902 2466892 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.740906 2466892 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.740909 2466892 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.740936 2466893 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.740978 2466893 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.740983 2466893 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.740987 2466893 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\n",,terminal_output
231
+ 230,3323146,"TERMINAL",0,0,"W0000 00:00:1751571745.837265 2462879 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.837303 2462879 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.837309 2462879 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.837312 2462879 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.837301 2462880 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.837335 2462880 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.837340 2462880 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751571745.837343 2462880 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\n",,terminal_output
232
+ 231,3381108,"TERMINAL",0,0,"W0000 00:00:1751571803.740339 2466892 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751571803.740352 2466893 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751571803.741264 2462879 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751571803.741275 2462880 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\n",,terminal_output
233
+ 232,3542883,"experiments/tokenizer_cross_node_checkpointing_test.sh",74,0,"",shellscript,selection_mouse
234
+ 233,3686476,"TERMINAL",0,0,"2025-07-03 21:48:28.957747: F external/xla/xla/pjrt/distributed/client.h:80] Terminating process because the JAX distributed service detected fatal errors. This most likely indicates that another task died; see the other task logs for more details. Disable Python buffering, i.e. `python -u`, to be sure to see all the previous output. absl::Status: DEADLINE_EXCEEDED: Deadline Exceeded\r\n\r\nRPC: /tensorflow.CoordinationService/RegisterTask\r\n2025-07-03 21:48:28.958290: F external/xla/xla/pjrt/distributed/client.h:80] Terminating process because the JAX distributed service detected fatal errors. This most likely indicates that another task died; see the other task logs for more details. Disable Python buffering, i.e. `python -u`, to be sure to see all the previous output. absl::Status: DEADLINE_EXCEEDED: Deadline Exceeded\r\n\r\nRPC: /tensorflow.CoordinationService/RegisterTask\r\n2025-07-03 21:48:28.958282: F external/xla/xla/pjrt/distributed/client.h:80] Terminating process because the JAX distributed service detected fatal errors. This most likely indicates that another task died; see the other task logs for more details. Disable Python buffering, i.e. `python -u`, to be sure to see all the previous output. absl::Status: DEADLINE_EXCEEDED: Deadline Exceeded\r\n\r\nRPC: /tensorflow.CoordinationService/RegisterTask\r\n2025-07-03 21:48:29.017875: F external/xla/xla/pjrt/distributed/client.h:80] Terminating process because the JAX distributed service detected fatal errors. This most likely indicates that another task died; see the other task logs for more details. Disable Python buffering, i.e. `python -u`, to be sure to see all the previous output. absl::Status: DEADLINE_EXCEEDED: Deadline Exceeded\r\n\r\nRPC: /tensorflow.CoordinationService/RegisterTask\r\n",,terminal_output
235
+ 234,3686728,"TERMINAL",0,0,"srun: error: gpusrv70: task 3: Aborted (core dumped)\r\n",,terminal_output
236
+ 235,3686862,"TERMINAL",0,0,"srun: error: gpusrv69: task 1: Aborted (core dumped)\r\nsrun: error: gpusrv70: task 2: Aborted (core dumped)\r\n",,terminal_output
237
+ 236,3686921,"TERMINAL",0,0,"srun: error: gpusrv69: task 0: Aborted (core dumped)\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h(jafar) [franz.srambical@gpusrv69 jafar]$ ",,terminal_output
238
+ 237,3728405,"TERMINAL",0,0,"e",,terminal_output
239
+ 238,3728562,"TERMINAL",0,0,"[?25lx[?25h",,terminal_output
240
+ 239,3728660,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
241
+ 240,3728750,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
242
+ 241,3728877,"TERMINAL",0,0,"\r\n[?2004l\rexit\r\n",,terminal_output
243
+ 242,3729136,"TERMINAL",0,0,"srun: error: gpusrv69: task 0: Exited with exit code 134\r\nsalloc: Relinquishing job allocation 26664812\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D;134]633;P;Cwd=/lustre/groups/haicu/workspace/franz.srambical/jafar",,terminal_output
244
+ 243,3738642,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gres=gpu:2 -w gpusrv69 --cpus-per-task=4 --ntasks-per-node=2",,terminal_command
245
+ 244,3738713,"TERMINAL",0,0,"]633;Csalloc: Granted job allocation 26665017\r\n",,terminal_output
246
+ 245,3738818,"TERMINAL",0,0,"salloc: Nodes gpusrv69 are ready for job\r\n",,terminal_output
247
+ 246,3739191,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
248
+ 247,3739821,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
249
+ 248,3739991,"TERMINAL",0,0,"[61@b': bash experiments/tokenizer_cross_node_checkpointing_test.sh\r",,terminal_output
250
+ 249,3740106,"TERMINAL",0,0,"[?25lb[1@a': ba[?25h[?25lb[1@s': bas[?25h",,terminal_output
251
+ 250,3740183,"TERMINAL",0,0,"[?25lb[1@h': bash[?25h",,terminal_output
252
+ 251,3740502,"TERMINAL",0,0,"\r[franz.srambical@gpusrv69 jafar]$ bash experiments/tokenizer_cross_node_checkpointing_test.sh \r\n\r\r\n[?2004l\r",,terminal_output
253
+ 252,3801051,"TERMINAL",0,0,"2025-07-03 21:50:23.641855: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n2025-07-03 21:50:23.641891: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:467] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\r\n",,terminal_output
254
+ 253,3801794,"TERMINAL",0,0,"WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751572224.474692 2468770 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nWARNING: All log messages before absl::InitializeLog() is called are written to STDERR\r\nE0000 00:00:1751572224.474696 2468771 cuda_dnn.cc:8579] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\r\nE0000 00:00:1751572224.487252 2468770 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\nE0000 00:00:1751572224.487243 2468771 cuda_blas.cc:1407] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\r\n",,terminal_output
255
+ 254,3802101,"TERMINAL",0,0,"W0000 00:00:1751572224.791692 2468770 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751572224.791712 2468770 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751572224.791715 2468770 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751572224.791717 2468770 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751572224.791699 2468771 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751572224.791714 2468771 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751572224.791717 2468771 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\nW0000 00:00:1751572224.791719 2468771 computation_placer.cc:177] computation placer already registered. Please check linkage and avoid linking the same target more than once.\r\n",,terminal_output
256
+ 255,3823224,"TERMINAL",0,0,"W0000 00:00:1751572245.915941 2468770 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\nW0000 00:00:1751572245.915950 2468771 gpu_device.cc:2341] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.\r\nSkipping registering GPU devices...\r\n",,terminal_output
257
+ 256,4421348,"TERMINAL",0,0,"^Csrun: interrupt (one more within 1 sec to abort)\r\nsrun: StepId=26665017.0 tasks 0-1: running\r\n",,terminal_output
258
+ 257,4646245,"TERMINAL",0,0,"^Csrun: interrupt (one more within 1 sec to abort)\r\nsrun: StepId=26665017.0 tasks 0-1: running\r\n",,terminal_output
259
+ 258,4646426,"TERMINAL",0,0,"^Csrun: sending Ctrl-C to StepId=26665017.0\r\nsrun: forcing job termination\r\nsrun: Job step aborted: Waiting up to 32 seconds for job step to finish.\r\nslurmstepd: error: *** STEP 26665017.0 ON gpusrv69 CANCELLED AT 2025-07-03T22:04:29 ***\r\n",,terminal_output
260
+ 259,4646687,"TERMINAL",0,0,"^Csrun: sending Ctrl-C to StepId=26665017.0\r\nsrun: job abort in progress\r\n",,terminal_output
261
+ 260,4647398,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
262
+ 261,4649272,"TERMINAL",0,0,"bash experiments/tokenizer_cross_node_checkpointing_test.sh ",,terminal_output
263
+ 262,4650031,"TERMINAL",0,0,"exit\r\n\r",,terminal_output
264
+ 263,4650375,"TERMINAL",0,0,"bash experiments/tokenizer_cross_node_checkpointing_test.sh ",,terminal_output
265
+ 264,4650565,"TERMINAL",0,0,"\r\n\r",,terminal_output
266
+ 265,4650903,"TERMINAL",0,0,"e",,terminal_output
267
+ 266,4651044,"TERMINAL",0,0,"[?25lx[?25h",,terminal_output
268
+ 267,4651130,"TERMINAL",0,0,"[?25li[?25h",,terminal_output
269
+ 268,4651246,"TERMINAL",0,0,"[?25lt[?25h",,terminal_output
270
+ 269,4651351,"TERMINAL",0,0,"[?25l[?2004l\rexit\r\n[?25h",,terminal_output
271
+ 270,4651593,"TERMINAL",0,0,"srun: error: gpusrv69: task 0: Exited with exit code 137\r\nsalloc: Relinquishing job allocation 26665017\r\nsalloc: Job allocation 26665017 has been revoked.\r\n]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar]633;D;137]633;P;Cwd=/lustre/groups/haicu/workspace/franz.srambical/jafar",,terminal_output
272
+ 271,4754894,"TERMINAL",0,0,"salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2 --ntasks=4",,terminal_command
273
+ 272,4754971,"TERMINAL",0,0,"]633;E;salloc --reservation=haicu_stefan -p gpu_p --time=05:00:00 --job-name=interactive_bash --qos=gpu_normal --gpu-bind=single:1 --gpus-per-task=1 -w gpusrv69,gpusrv70 --cpus-per-task=4 --ntasks-per-node=2 --ntasks=4;d193c799-eb50-4b87-89db-ea172d98a654]633;Csalloc: Granted job allocation 26665156\r\n",,terminal_output
274
+ 273,4755072,"TERMINAL",0,0,"salloc: Nodes gpusrv[69-70] are ready for job\r\n",,terminal_output
275
+ 274,4755423,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output
276
+ 275,4756071,"TERMINAL",0,0,"\r(reverse-i-search)`': ",,terminal_output
277
+ 276,4756309,"TERMINAL",0,0,"[61@s': bash experiments/tokenizer_cross_node_checkpointing_test.sh",,terminal_output
278
+ 277,4756404,"TERMINAL",0,0,"[?25ls\rr': srun bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'\r[?25h",,terminal_output
279
+ 278,4756503,"TERMINAL",0,0,"[?25lrs[1@u': sru[?25h[1@n': srun",,terminal_output
280
+ 279,4757633,"TERMINAL",0,0,"\r[franz.srambical@gpusrv69 jafar]$ srun bash -c 'nvidia-smi --query-gpu=uuid --format=csv,noheader'\r\n\r\r\n[?2004l\r",,terminal_output
281
+ 280,4757857,"TERMINAL",0,0,"GPU-3e808c85-2952-72e2-8da6-6beec88de390\r\nGPU-e3008a0f-dcb9-f740-edf8-3364a398e339\r\nGPU-f3062939-2421-5673-6abc-1eb76d971cd6\r\nGPU-1bb263c4-21ed-4863-da84-ca4f36c17637\r\n",,terminal_output
282
+ 281,4757973,"TERMINAL",0,0,"]0;franz.srambical@hpc-submit01:/lustre/groups/haicu/workspace/franz.srambical/jafar[?2004h[franz.srambical@gpusrv69 jafar]$ ",,terminal_output