MCPcopy Create free account

hub / github.com/PrathamLearnsToCode/paper2code / functions

Functions98 in github.com/PrathamLearnsToCode/paper2code

↓ 7 callersMethod__init__
(self, config: TransformerConfig)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:385
↓ 5 callersMethod__init__
(self, config: UNetConfig)
skills/paper2code/worked/ddpm/src/model.py:236
↓ 4 callersMethod__init__
Args: model: the model to track decay: §4 — "decay factor of 0.9999"
skills/paper2code/worked/ddpm/src/utils.py:212
↓ 4 callersFunctionsave_list_to_dir
Save a list of extracted items as individual files.
skills/paper2code/scripts/extract_structure.py:226
↓ 3 callersFunctionadd_link
(url: str, source: str, context: str = "")
skills/paper2code/scripts/fetch_paper.py:286
↓ 3 callersFunctionextract_tag
(tag: str, content: str)
skills/paper2code/scripts/fetch_paper.py:80
↓ 2 callersFunctioncheck_text_quality
Check if extracted text is reasonable quality (not garbled).
skills/paper2code/scripts/fetch_paper.py:243
↓ 2 callersFunctionlinear_noise_schedule
§4 — Linear variance schedule. "We set the forward process variances to constants increasing linearly from β_1 = 10^-4 to β_T = 0.02."
skills/paper2code/worked/ddpm/src/utils.py:23
↓ 2 callersFunctionsave_current
()
skills/paper2code/scripts/extract_structure.py:41
↓ 1 callersMethod_init_weights
[UNSPECIFIED] — Weight initialization not described in paper. Using Xavier uniform, a common choice for transformer models.
skills/paper2code/worked/attention_is_all_you_need/src/model.py:492
↓ 1 callersMethod_make_causal_mask
§3.2.3 — Create causal (autoregressive) mask for decoder self-attention. "We also modify the self-attention sub-layer in the decoder stack to
skills/paper2code/worked/attention_is_all_you_need/src/model.py:547
↓ 1 callersFunctionbuild_optimizer
Build optimizer with parameter groups. §{{SECTION}} — "{{quote about optimizer}}"
skills/paper2code/scaffolds/train_template.py:31
↓ 1 callersFunctionbuild_scheduler
Build learning rate scheduler. §{{SECTION}} — "{{quote about LR schedule}}"
skills/paper2code/scaffolds/train_template.py:87
↓ 1 callersFunctioncompute_all_metrics
Compute all evaluation metrics reported in the paper. §6, Table 2 — "We report BLEU scores" Args: hypotheses: list of predicted tran
skills/paper2code/worked/attention_is_all_you_need/src/evaluate.py:56
↓ 1 callersFunctioncompute_bleu
Compute BLEU score using sacrebleu for reproducibility. §6, Table 2 — "BLEU" score on WMT 2014 EN-DE and EN-FR. The paper reports BLEU score
skills/paper2code/worked/attention_is_all_you_need/src/evaluate.py:18
↓ 1 callersFunctioncompute_fid
Compute FID score between generated samples and real data. §4 — "We report FID score... Our best results are FID: 3.17" Requires the pytorch
skills/paper2code/worked/ddpm/src/evaluate.py:166
↓ 1 callersFunctioncreate_causal_mask
§3.2.3 — Create a causal (autoregressive) mask. "We also modify the self-attention sub-layer in the decoder stack to prevent positions from
skills/paper2code/worked/attention_is_all_you_need/src/utils.py:58
↓ 1 callersFunctioncreate_padding_mask
Create a padding mask for source sequences. Args: tokens: (batch, seq_len) — token IDs pad_idx: the padding token index Retu
skills/paper2code/worked/attention_is_all_you_need/src/utils.py:45
↓ 1 callersFunctiondownload_pdf
Download the PDF from arxiv.
skills/paper2code/scripts/fetch_paper.py:122
↓ 1 callersFunctionextract_algorithms
Extract algorithm boxes from the paper. Looks for patterns like: Algorithm 1: Name ...algorithm body... (ends at next section h
skills/paper2code/scripts/extract_structure.py:79
↓ 1 callersFunctionextract_equations
Extract numbered equations. Looks for: - LaTeX equation environments: \\begin{equation}...\\end{equation} - Display math with numberi
skills/paper2code/scripts/extract_structure.py:107
↓ 1 callersFunctionextract_footnotes
Extract footnotes from the paper.
skills/paper2code/scripts/extract_structure.py:198
↓ 1 callersFunctionextract_tables
Extract tables from the paper text. Looks for: - Markdown tables (pipes) - Table captions (Table N: ...) - Structured text that
skills/paper2code/scripts/extract_structure.py:158
↓ 1 callersFunctionextract_with_pdfplumber
Extract text using pdfplumber (fallback).
skills/paper2code/scripts/fetch_paper.py:163
↓ 1 callersFunctionextract_with_pymupdf4llm
Extract text using pymupdf4llm (preserves math notation as LaTeX).
skills/paper2code/scripts/fetch_paper.py:144
↓ 1 callersFunctionfetch_ar5iv_html
Fetch HTML version from ar5iv (renders math as readable text).
skills/paper2code/scripts/fetch_paper.py:188
↓ 1 callersFunctionfetch_metadata
Fetch paper metadata from the arxiv API.
skills/paper2code/scripts/fetch_paper.py:64
↓ 1 callersFunctionfind_official_code
Search for official code repositories linked to this paper. Checks two sources: 1. The paper text itself — GitHub/GitLab URLs, "code availabl
skills/paper2code/scripts/fetch_paper.py:274
↓ 1 callersFunctionforward
Args: x: {{description}} — shape: (batch, {{dims}}) Returns: {{description}} — shape: (batch, {{
skills/paper2code/scaffolds/model_template.py:65
↓ 1 callersFunctiongenerate_samples
Generate samples using Algorithm 2 — Sampling. §3.4 — "sampling from p_θ(x_{t-1} | x_t) = N(x_{t-1}; μ_θ(x_t, t), σ²_t I)" Args: mod
skills/paper2code/worked/ddpm/src/evaluate.py:91
↓ 1 callersFunctionget_cifar10_transforms
Return train and test transforms for CIFAR-10. §4 — "random horizontal flips during training" [FROM_OFFICIAL_CODE] — normalize to [-1, 1]
skills/paper2code/worked/ddpm/src/data.py:26
↓ 1 callersFunctionget_dataloaders
Create CIFAR-10 train and test dataloaders. §4 — CIFAR-10 unconditional generation at 32×32 §4 — "batch size 128" [FROM_OFFICIAL_CODE — paper
skills/paper2code/worked/ddpm/src/data.py:58
↓ 1 callersFunctionget_transformer_lr_schedule
§5.3, Eq. 3 — Transformer learning rate schedule. "We used the Adam optimizer with β1 = 0.9, β2 = 0.98 and ε = 10^−9. We varied the learning
skills/paper2code/worked/attention_is_all_you_need/src/utils.py:14
↓ 1 callersFunctionidentify_sections
Identify section boundaries using heading patterns. Detects: - Markdown headings (# , ## , ### ) - Numbered headings (1. Introduction
skills/paper2code/scripts/extract_structure.py:21
↓ 1 callersFunctionload_config
Load training configuration.
skills/paper2code/scaffolds/train_template.py:25
↓ 1 callersFunctionload_model
Load a trained DDPM model from checkpoint. §4 — "we also report results with an exponential moving average" The EMA parameters typically prod
skills/paper2code/worked/ddpm/src/evaluate.py:41
↓ 1 callersFunctionmain
()
skills/paper2code/scripts/extract_structure.py:247
↓ 1 callersFunctionmain
()
skills/paper2code/scripts/fetch_paper.py:339
↓ 1 callersFunctionnormalize_arxiv_id
Extract arxiv ID from a URL or bare ID string. Handles: https://arxiv.org/abs/2106.09685 https://arxiv.org/pdf/2106.09685.pdf
skills/paper2code/scripts/fetch_paper.py:26
↓ 1 callersFunctionp_sample
Algorithm 2, lines 3-4 — Single reverse step: sample x_{t-1} from p_θ(x_{t-1} | x_t). "x_{t-1} = 1/√α_t * (x_t - β_t/√(1-α̅_t) * ε_θ(x_t, t)) + σ
skills/paper2code/worked/ddpm/src/utils.py:115
↓ 1 callersFunctionq_sample
§3, Eq. 4 — Forward process: sample x_t from q(x_t | x_0). "A notable property is that we can sample x_t at any arbitrary time step t in clo
skills/paper2code/worked/ddpm/src/utils.py:77
↓ 1 callersFunctionsample
Algorithm 2 — Full reverse sampling process. "Algorithm 2 Sampling 1: x_T ~ N(0, I) 2: for t = T, ..., 1 do 3: z ~ N(0, I) if t
skills/paper2code/worked/ddpm/src/utils.py:164
↓ 1 callersFunctionsave_samples
Save generated samples as images. Args: samples: (N, C, H, W) in [0, 1] output_dir: Directory to save images prefix: File
skills/paper2code/worked/ddpm/src/evaluate.py:133
↓ 1 callersFunctionscaled_dot_product_attention
§3.2.1, Eq. 1 — Attention(Q, K, V) = softmax(QK^T / √d_k) V "We compute the attention function on a set of queries simultaneously, packed to
skills/paper2code/worked/attention_is_all_you_need/src/model.py:61
↓ 1 callersFunctiontrain
Algorithm 1 — DDPM Training. Args: config_path: Path to YAML config file
skills/paper2code/worked/ddpm/src/train.py:43
↓ 1 callersFunctiontrain
Minimal training example with paper-specified optimizer and schedule.
skills/paper2code/worked/attention_is_all_you_need/src/train.py:27
↓ 1 callersFunctiontrain
Main training loop. {{Describe what this training loop does and which paper sections it follows.}}
skills/paper2code/scaffolds/train_template.py:118
↓ 1 callersMethodupdate
Update EMA weights after each training step.
skills/paper2code/worked/ddpm/src/utils.py:225
Function__getitem__
Load and preprocess a single sample. Returns: dict with keys: {{key_1}}: {{description}} — shape: {{shape
skills/paper2code/scaffolds/data_template.py:76
Method__getitem__
Load and preprocess a single sentence pair. Returns: dict with keys: "src": source token IDs — shape: (src_len,)
skills/paper2code/worked/attention_is_all_you_need/src/data.py:110
Function__init__
(self, config: ModelConfig)
skills/paper2code/scaffolds/model_template.py:60
Function__init__
Args: data_dir: path to the dataset root directory split: one of "train", "val", "test"
skills/paper2code/scaffolds/data_template.py:38
Method__init__
(self)
skills/paper2code/worked/ddpm/src/loss.py:40
Method__init__
(self, embed_dim: int)
skills/paper2code/worked/ddpm/src/model.py:66
Method__init__
( self, in_channels: int, out_channels: int, time_embed_dim: int, drop
skills/paper2code/worked/ddpm/src/model.py:99
Method__init__
(self, channels: int, num_groups: int = 32)
skills/paper2code/worked/ddpm/src/model.py:158
Method__init__
(self, channels: int)
skills/paper2code/worked/ddpm/src/model.py:195
Method__init__
(self, channels: int)
skills/paper2code/worked/ddpm/src/model.py:206
Method__init__
Args: smoothing: §5.4 — ε_ls = 0.1 pad_idx: index of padding token (loss ignored for these positions)
skills/paper2code/worked/attention_is_all_you_need/src/loss.py:33
Method__init__
Args: data_dir: path to the preprocessed data directory split: one of "train", "valid", "test" max_seq_le
skills/paper2code/worked/attention_is_all_you_need/src/data.py:56
Method__init__
(self, config: TransformerConfig)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:120
Method__init__
(self, config: TransformerConfig)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:192
Method__init__
(self, config: TransformerConfig)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:229
Method__init__
(self, config: TransformerConfig)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:274
Method__init__
(self, config: TransformerConfig)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:328
Method__init__
(self, config: TransformerConfig)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:409
Method__init__
(self, config: TransformerConfig)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:456
Function__len__
(self)
skills/paper2code/scaffolds/data_template.py:73
Method__len__
(self)
skills/paper2code/worked/attention_is_all_you_need/src/data.py:107
Function__repr__
Print architecture summary.
skills/paper2code/scaffolds/model_template.py:129
Method__repr__
(self)
skills/paper2code/worked/ddpm/src/model.py:372
Method__repr__
(self)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:559
Method_load_data
Load BPE-tokenized source and target sentences. TODO: Implement based on your tokenization format. Expected: each line is space-separ
skills/paper2code/worked/attention_is_all_you_need/src/data.py:86
Function_load_samples
Load sample paths/metadata for the given split. TODO: Implement based on the dataset structure.
skills/paper2code/scaffolds/data_template.py:55
Function_preprocess
Apply preprocessing as described in §{{SECTION}}. TODO: Implement the paper's preprocessing pipeline: {{list preprocessing st
skills/paper2code/scaffolds/data_template.py:65
Methodapply
Load EMA weights into model (for evaluation/sampling).
skills/paper2code/worked/ddpm/src/utils.py:233
Functioncollate_fn
Pad sequences to the same length within a batch. §5.1 — "Each training batch contained a set of sentence pairs containing approximately 25000
skills/paper2code/worked/attention_is_all_you_need/src/data.py:134
Functioncreate_decoder_mask
Create combined causal + padding mask for decoder self-attention. Args: tgt: (batch, tgt_len) — target token IDs pad_idx: padding
skills/paper2code/worked/attention_is_all_you_need/src/utils.py:75
Functionextract_all_tags
(tag: str, content: str)
skills/paper2code/scripts/fetch_paper.py:85
Methodforward
§3.4, Eq. 14 — L_simple = E[||ε − ε_θ(x_t, t)||²] Args: noise_pred: (batch, C, H, W) — predicted noise ε_θ(x_t, t)
skills/paper2code/worked/ddpm/src/loss.py:43
Methodforward
Args: t: (batch,) — integer timesteps Returns: (batch, embed_dim) — sinusoidal embedding
skills/paper2code/worked/ddpm/src/model.py:70
Methodforward
Args: x: (batch, in_channels, H, W) t_emb: (batch, time_embed_dim) Returns: (batch, out_channels
skills/paper2code/worked/ddpm/src/model.py:124
Methodforward
Args: x: (batch, channels, H, W) Returns: (batch, channels, H, W)
skills/paper2code/worked/ddpm/src/model.py:164
Methodforward
(self, x: torch.Tensor)
skills/paper2code/worked/ddpm/src/model.py:199
Methodforward
(self, x: torch.Tensor)
skills/paper2code/worked/ddpm/src/model.py:210
Methodforward
Predict noise ε_θ(x_t, t). Args: x: (batch, C, H, W) — noisy image x_t t: (batch,) — integer timesteps Retur
skills/paper2code/worked/ddpm/src/model.py:316
Methodforward
Compute label-smoothed cross-entropy loss. Args: logits: (batch, seq_len, vocab_size) — model output logits (NOT probabilities)
skills/paper2code/worked/attention_is_all_you_need/src/loss.py:44
Methodforward
Args: query: (batch, seq_q, d_model) key: (batch, seq_k, d_model) value: (batch, seq_k, d_model)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:141
Methodforward
Args: x: (batch, seq_len, d_model) Returns: (batch, seq_len, d_model)
skills/paper2code/worked/attention_is_all_you_need/src/model.py:199
Methodforward
Args: x: (batch, seq_len, d_model) — embedding output (already scaled by √d_model) Returns: (batch, seq_len,
skills/paper2code/worked/attention_is_all_you_need/src/model.py:246
Methodforward
Args: x: (batch, seq_len, d_model) src_mask: (batch, 1, 1, seq_len) — padding mask Returns: (batc
skills/paper2code/worked/attention_is_all_you_need/src/model.py:289
Methodforward
Args: x: (batch, tgt_len, d_model) — decoder input memory: (batch, src_len, d_model) — encoder output tgt
skills/paper2code/worked/attention_is_all_you_need/src/model.py:343
Methodforward
Args: x: (batch, src_len, d_model) — embedded + positionally-encoded source mask: (batch, 1, 1, src_len) — source pad
skills/paper2code/worked/attention_is_all_you_need/src/model.py:391
Methodforward
Args: x: (batch, tgt_len, d_model) — embedded + positionally-encoded target memory: (batch, src_len, d_model) — encod
skills/paper2code/worked/attention_is_all_you_need/src/model.py:415
Methodforward
Full encoder-decoder forward pass. Args: src: (batch, src_len) — source token IDs tgt: (batch, tgt_len) — target toke
skills/paper2code/worked/attention_is_all_you_need/src/model.py:500
Functionlr_lambda
(step: int)
skills/paper2code/worked/attention_is_all_you_need/src/utils.py:38
Functionlr_lambda
(step)
skills/paper2code/scaffolds/train_template.py:102
Methodrestore
Restore original model weights (after evaluation).
skills/paper2code/worked/ddpm/src/utils.py:239