repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/machine_learning_with_tools.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:18.825836 | import asyncio
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main(requirement: str):
role = DataInterpreter(use_reflection=True, tools=["<all>"])
await role.run(requirement)
if __name__ == "__main__":
data_path = "your/path/to/titanic"
train_path = f"{data_path}/split_trai... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/requirements_prompt.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.240585 | # InfiAgent-DABench requirements
DABENCH = "You are required to {question} from a CSV file named {file_name}. **Constraints**: Ensure that {constraints}, which must be strictly followed throughout the task. The output format should be {format}. This task is categorized as {level}."
# ML-Benchmark requirements
IRIS_REQ... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/run_flask.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.444160 | import asyncio
from metagpt.roles.di.data_interpreter import DataInterpreter
USE_GOT_REPO_REQ = """
Write a service using Flask, create a conda environment and run it, and call the service's interface for validation.
Notice: Don't write all codes in one response, each time, just write code for one step.
"""
# If you ... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/rm_image_background.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.444692 | import asyncio
from metagpt.const import DEFAULT_WORKSPACE_ROOT, EXAMPLE_DATA_PATH
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main(requirement: str = ""):
di = DataInterpreter()
await di.run(requirement)
if __name__ == "__main__":
image_path = EXAMPLE_DATA_PATH / "di/dog.jp... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/run_open_ended_tasks.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.618758 | import os
import fire
from examples.di.requirements_prompt import OPEN_ENDED_TASKS_REQUIREMENTS
from metagpt.const import DATA_PATH
from metagpt.roles.di.data_interpreter import DataInterpreter
from metagpt.tools.tool_recommend import TypeMatchToolRecommender
# Ensure Open-Ended Tasks dataset has been downloaded be... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/crawl_webpage.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.632597 | # -*- encoding: utf-8 -*-
"""
@Date : 2024/01/24 15:11:27
@Author : orange-crow
@File : crawl_webpage.py
"""
from metagpt.roles.di.data_interpreter import DataInterpreter
from metagpt.tools.libs.web_scraping import view_page_element_to_scrape
PAPER_LIST_REQ = """"
Get data from `paperlist` table in https... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/run_ml_benchmark.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.633160 | import os
import fire
from examples.di.requirements_prompt import ML_BENCHMARK_REQUIREMENTS
from metagpt.const import DATA_PATH
from metagpt.roles.di.data_interpreter import DataInterpreter
from metagpt.tools.tool_recommend import TypeMatchToolRecommender
# Ensure ML-Benchmark dataset has been downloaded before usi... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/custom_tool.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.833498 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2024/3/22 10:54
@Author : alexanderwu
@File : custom_tool.py
"""
from metagpt.roles.di.data_interpreter import DataInterpreter
from metagpt.tools.tool_registry import register_tool
@register_tool()
def magic_function(arg1: str, arg2: int) -> dict:
... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/use_browser.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.871089 | import asyncio
from metagpt.roles.di.data_interpreter import DataInterpreter
MG_LLM_CONFIG_REQ = """
This is a link to the doc site of MetaGPT project: https://docs.deepwisdom.ai/main/en/
Check where you can go to on the site and try to find out the list of LLM APIs supported by MetaGPT.
Don't write all codes in one ... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/exp_pool/decorator.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:19.994758 | """
This script demonstrates how to automatically store experiences using @exp_cache and query the stored experiences.
"""
import asyncio
import uuid
from metagpt.exp_pool import exp_cache, get_exp_manager
from metagpt.logs import logger
@exp_cache()
async def produce(req=""):
return f"{req} {uuid.uuid4().hex}"... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/use_github_repo.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.036494 | import asyncio
from metagpt.roles.di.data_interpreter import DataInterpreter
USE_GOT_REPO_REQ = """
This is a link to the GOT github repo: https://github.com/spcl/graph-of-thoughts.git.
Clone it, read the README to understand the usage, install it, and finally run the quick start example.
**Note the config for LLM is... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/exp_pool/manager.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.193631 | """
Demonstrate the creation and querying of experiences.
This script creates a new experience, logs its creation, and then queries for experiences matching the same request.
"""
import asyncio
from metagpt.exp_pool import get_exp_manager
from metagpt.exp_pool.schema import EntryType, Experience
from metagpt.logs im... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/exp_pool/load_exps_from_log.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.197201 | """Load and save experiences from the log file."""
import json
from pathlib import Path
from metagpt.exp_pool import get_exp_manager
from metagpt.exp_pool.schema import LOG_NEW_EXPERIENCE_PREFIX, Experience
from metagpt.logs import logger
def load_exps(log_file_path: str) -> list[Experience]:
"""Loads experienc... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/exp_pool/init_exp_pool.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.280009 | """Init experience pool.
Put some useful experiences into the experience pool.
"""
import asyncio
import json
from pathlib import Path
from metagpt.const import EXAMPLE_DATA_PATH
from metagpt.exp_pool import get_exp_manager
from metagpt.exp_pool.schema import EntryType, Experience, Metric, Score
from metagpt.logs im... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/exp_pool/scorer.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.427749 | import asyncio
from metagpt.exp_pool.scorers import SimpleScorer
# Request to implement quicksort in Python
REQ = "Write a program to implement quicksort in python."
# First response: Quicksort implementation without base case
RESP1 = """
def quicksort(arr):
return quicksort([x for x in arr[1:] if x <= arr[0]]) ... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/hello_world.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.481394 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2023/5/6 14:13
@Author : alexanderwu
@File : hello_world.py
"""
import asyncio
from metagpt.llm import LLM
from metagpt.logs import logger
async def ask_and_print(question: str, llm: LLM, system_prompt) -> str:
logger.info(f"Q: {question}")
rsp... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/invoice_ocr.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.550439 | #!/usr/bin/env python3
# _*_ coding: utf-8 _*_
"""
@Time : 2023/9/21 21:40:57
@Author : Stitch-z
@File : invoice_ocr.py
"""
import asyncio
from pathlib import Path
from metagpt.roles.invoice_ocr_assistant import InvoiceOCRAssistant, InvoicePath
from metagpt.schema import Message
async def main():
relati... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/llm_vision.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.594890 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Desc : example to run the ability of LLM vision
import asyncio
from pathlib import Path
from metagpt.llm import LLM
from metagpt.utils.common import encode_image
async def main():
llm = LLM()
# check if the configured llm supports llm-vision capacity. If n... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/mgx_write_project_framework.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.763963 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2024/6/13
@Author : mashenquan
@File : write_project_framework.py
@Desc : The implementation of RFC243. https://deepwisdom.feishu.cn/wiki/QobGwPkImijoyukBUKHcrYetnBb
"""
import asyncio
import json
import uuid
from json import JSONDecodeError
from pathl... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/ping.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.789800 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2024/4/22 14:28
@Author : alexanderwu
@File : ping.py
"""
import asyncio
from metagpt.llm import LLM
from metagpt.logs import logger
async def ask_and_print(question: str, llm: LLM, system_prompt) -> str:
logger.info(f"Q: {question}")
rsp = aw... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/rag/omniparse.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.858383 | import asyncio
from metagpt.config2 import config
from metagpt.const import EXAMPLE_DATA_PATH
from metagpt.logs import logger
from metagpt.rag.parsers import OmniParse
from metagpt.rag.schema import OmniParseOptions, OmniParseType, ParseResultType
from metagpt.utils.omniparse_client import OmniParseClient
TEST_DOCX =... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/rag/rag_bm.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:20.971784 | # -*- coding: utf-8 -*-
"""RAG benchmark pipeline"""
import asyncio
from llama_index.core.node_parser import SentenceSplitter
from llama_index.core.schema import NodeWithScore
from metagpt.const import DATA_PATH, EXAMPLE_BENCHMARK_PATH, EXAMPLE_DATA_PATH
from metagpt.logs import logger
from metagpt.rag.benchmark imp... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/rag/rag_pipeline.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:21.054681 | """RAG pipeline"""
import asyncio
from pydantic import BaseModel
from metagpt.const import DATA_PATH, EXAMPLE_DATA_PATH
from metagpt.logs import logger
from metagpt.rag.engines import SimpleEngine
from metagpt.rag.schema import (
ChromaIndexConfig,
ChromaRetrieverConfig,
ElasticsearchIndexConfig,
Ela... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/sd_tool_usage.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:24.585853 | # -*- coding: utf-8 -*-
# @Date : 1/11/2024 7:06 PM
# @Author : stellahong (stellahong@fuzhi.ai)
# @Desc :
import asyncio
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main(requirement: str = ""):
di = DataInterpreter(tools=["SDEngine"])
await di.run(requirement)
if __name_... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/solve_math_problems.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:24.760132 | import asyncio
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main(requirement: str = ""):
di = DataInterpreter()
await di.run(requirement)
if __name__ == "__main__":
requirement = "Solve this math problem: The greatest common divisor of positive integers m and n is 6. The leas... |
FoundationAgents/MetaGPT | https://github.com/FoundationAgents/MetaGPT | null | null | null | null | 67,657 | null | null | mit | null | null | null | null | null | null | null | examples/di/software_company.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:24.811407 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import fire
from metagpt.roles.di.data_interpreter import DataInterpreter
async def main():
prompt = """
This is a software requirement:
```text
write a snake game
```
---
1. Writes a PRD based on software requirements.
2. Writes a design to the project repository, b... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/activations/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.018148 | """
---
title: Neural Network Activation Functions
summary: >
A set of PyTorch implementations/tutorials related to neural network activations
---
# Neural Networks Activations
* [Fuzzy Tiling Activations](fta/index.html)
* 🚧 [Swish](swish/index.html)
"""
from .swish import Swish
|
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/capsule_networks/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.019059 | """
---
title: Capsule Networks
summary: >
PyTorch implementation and tutorial of Capsule Networks.
Capsule network is a neural network architecture that embeds features
as capsules and routes them with a voting mechanism to next layer of capsules.
---
# Capsule Networks
This is a [PyTorch](https://pytorch.org)... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/adaptive_computation/ponder_net/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.037801 | """
---
title: "PonderNet: Learning to Ponder"
summary: >
A PyTorch implementation/tutorial of PonderNet: Learning to Ponder.
---
# PonderNet: Learning to Ponder
This is a [PyTorch](https://pytorch.org) implementation of the paper
[PonderNet: Learning to Ponder](https://arxiv.org/abs/2107.05407).
PonderNet adapts t... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/activations/fta/experiment.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.066213 | """
---
title: Fuzzy Tiling Activation Experiment
summary: >
Training a transformer with FTA in FFN on Tiny Shakespeare.
---
# [Fuzzy Tiling Activation](index.html) Experiment
[](https://colab.research.google.com/github/labmlai/annotated_deep_... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/activations/swish.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.069542 | import torch
from torch import nn
class Swish(nn.Module):
def __init__(self):
super().__init__()
self.sigmoid = nn.Sigmoid()
def forward(self, x: torch.Tensor) -> torch.Tensor:
return x * self.sigmoid(x)
|
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/activations/fta/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.070155 | """
---
title: Fuzzy Tiling Activations
summary: >
PyTorch implementation and tutorial of Fuzzy Tiling Activations from the
paper Fuzzy Tiling Activations: A Simple Approach to Learning Sparse Representations Online.
---
# Fuzzy Tiling Activations (FTA)
[ [Parity Task](../parity.html) Experiment
This trains a [PonderNet](index.html) on [Parity Task](../parity.html).
"""
from typing import Any
import torch
from torch import nn
from to... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/adaptive_computation/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.073943 | """
---
title: Neural Networks with Adaptive Computation
summary: >
A set of PyTorch implementations/tutorials related to adaptive computation
---
# Neural Networks with Adaptive Computation
These are neural network architectures that change the computation complexity based on the
complexity of the input sample.
* ... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.074932 | """
# [Annotated Research Paper Implementations: Transformers, StyleGAN, Stable Diffusion, DDPM/DDIM, LayerNorm, Nucleus Sampling and more](index.html)
This is a collection of simple PyTorch implementations of
neural networks and related algorithms.
[These implementations](https://github.com/labmlai/annotated_deep_lea... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/adaptive_computation/parity.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.122463 | """
---
title: "Parity Task"
summary: >
This creates data for Parity Task from the paper Adaptive Computation Time
for Recurrent Neural Networks
---
# Parity Task
This creates data for Parity Task from the paper
[Adaptive Computation Time for Recurrent Neural Networks](https://arxiv.org/abs/1603.08983).
The inpu... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/cfr/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.615612 | """
---
title: Regret Minimization in Games with Incomplete Information (CFR)
summary: >
This is an annotated implementation/tutorial of Regret Minimization in Games with Incomplete Information
---
# Regret Minimization in Games with Incomplete Information (CFR)
The paper
[Regret Minimization in Games with Incomple... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/capsule_networks/mnist.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.625139 | """
---
title: Classify MNIST digits with Capsule Networks
summary: Code for training Capsule Networks on MNIST dataset
---
# Classify MNIST digits with Capsule Networks
This is an annotated PyTorch code to classify MNIST digits with PyTorch.
This paper implements the experiment described in paper
[Dynamic Routing B... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/cfr/analytics.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.645461 | from typing import List
import altair as alt
import numpy as np
from labml import analytics
from labml.analytics import IndicatorCollection
def calculate_percentages(means: List[np.ndarray], names: List[List[str]]):
normalized = []
for i in range(len(means)):
total = np.zeros_like(means[i])
... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/conv_mixer/experiment.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.683798 | """
---
title: Train ConvMixer on CIFAR 10
summary: >
Train ConvMixer on CIFAR 10
---
# Train a [ConvMixer](index.html) on CIFAR 10
This script trains a ConvMixer on CIFAR 10 dataset.
This is not an attempt to reproduce the results of the paper.
The paper uses image augmentations
present in [PyTorch Image Models... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/cfr/kuhn/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.684516 | """
---
title: CFR on Kuhn Poker
summary: >
This is an annotated implementation/tutorial of CFR on Kuhn Poker
---
# [Counterfactual Regret Minimization (CFR)](../index.html) on Kuhn Poker
This applies [Counterfactual Regret Minimization (CFR)](../index.html) to Kuhn poker.
[Kuhn Poker](https://en.wikipedia.org/wik... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/conv_mixer/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.686782 | """
---
title: Patches Are All You Need? (ConvMixer)
summary: >
A PyTorch implementation/tutorial of the paper
"Patches Are All You Need?"
---
# Patches Are All You Need? (ConvMixer)
This is a [PyTorch](https://pytorch.org) implementation of the paper
[Patches Are All You Need?](https://arxiv.org/abs/2201.09792).
... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/cfr/infoset_saver.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.688476 | import json
import pathlib
from typing import Dict
from labml import experiment
from labml_nn.cfr import InfoSet
class InfoSetSaver(experiment.ModelSaver):
def __init__(self, infosets: Dict[str, InfoSet]):
self.infosets = infosets
def save(self, checkpoint_path: pathlib.Path) -> any:
data = ... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/ddpm/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.689327 | """
---
title: Denoising Diffusion Probabilistic Models (DDPM)
summary: >
PyTorch implementation and tutorial of the paper
Denoising Diffusion Probabilistic Models (DDPM).
---
# Denoising Diffusion Probabilistic Models (DDPM)
[](https://col... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.714294 | """
---
title: Diffusion models
summary: >
A set of PyTorch implementations/tutorials of diffusion models.
---
# Diffusion models
* [Denoising Diffusion Probabilistic Models (DDPM)](ddpm/index.html)
* [Stable Diffusion](stable_diffusion/index.html)
* [Latent Diffusion Model](stable_diffusion/latent_diffusion.html)
*... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/ddpm/evaluate.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:28.729207 | """
---
title: Denoising Diffusion Probabilistic Models (DDPM) evaluation/sampling
summary: >
Code to generate samples from a trained
Denoising Diffusion Probabilistic Model.
---
# [Denoising Diffusion Probabilistic Models (DDPM)](index.html) evaluation/sampling
This is the code to generate images and create inte... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/ddpm/unet.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.224315 | """
---
title: U-Net model for Denoising Diffusion Probabilistic Models (DDPM)
summary: >
UNet model for Denoising Diffusion Probabilistic Models (DDPM)
---
# U-Net model for [Denoising Diffusion Probabilistic Models (DDPM)](index.html)
This is a [U-Net](../../unet/index.html) based model to predict noise
$\textcol... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/ddpm/experiment.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.244806 | """
---
title: Denoising Diffusion Probabilistic Models (DDPM) training
summary: >
Training code for
Denoising Diffusion Probabilistic Model.
---
# [Denoising Diffusion Probabilistic Models (DDPM)](index.html) training
[](https://colab.rese... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/ddpm/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.290428 | """
---
title: Utility functions for DDPM experiment
summary: >
Utility functions for DDPM experiment
---
# Utility functions for [DDPM](index.html) experiemnt
"""
import torch.utils.data
def gather(consts: torch.Tensor, t: torch.Tensor):
"""Gather consts for $t$ and reshape to feature map shape"""
c = con... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/model/clip_embedder.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.315694 | """
---
title: CLIP Text Embedder
summary: >
CLIP embedder to get prompt embeddings for stable diffusion
---
# CLIP Text Embedder
This is used to get prompt embeddings for [stable diffusion](../index.html).
It uses HuggingFace Transformers CLIP model.
"""
from typing import List
from torch import nn
from transform... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/latent_diffusion.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.320862 | """
---
title: Latent Diffusion Models
summary: >
Annotated PyTorch implementation/tutorial of latent diffusion models from paper
High-Resolution Image Synthesis with Latent Diffusion Models
---
# Latent Diffusion Models
Latent diffusion models use an auto-encoder to map between image space and
latent space. The di... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/model/autoencoder.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.322123 | """
---
title: Autoencoder for Stable Diffusion
summary: >
Annotated PyTorch implementation/tutorial of the autoencoder
for stable diffusion.
---
# Autoencoder for [Stable Diffusion](../index.html)
This implements the auto-encoder model used to map between image space and latent space.
We have kept to the model de... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.332745 | """
---
title: Stable Diffusion
summary: >
Annotated PyTorch implementation/tutorial of stable diffusion.
---
# Stable Diffusion
This is based on official stable diffusion repository
[CompVis/stable-diffusion](https://github.com/CompVis/stable-diffusion).
We have kept the model structure same so that open sourced w... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/model/unet_attention.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.333933 | """
---
title: Transformer for Stable Diffusion U-Net
summary: >
Annotated PyTorch implementation/tutorial of the transformer
for U-Net in stable diffusion.
---
# Transformer for Stable Diffusion [U-Net](unet.html)
This implements the transformer module used in [U-Net](unet.html) that
gives $\epsilon_\text{cond}(x... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/model/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.354440 | """
---
title: Modules used in stable diffusion
summary: >
Models and components for stable diffusion.
---
# [Stable Diffusion](../index.html) Models
* [AutoEncoder](autoencoder.html)
* [U-Net](unet.html) with [attention](unet_attention.html)
* [CLIP embedder](clip_embedder.html).
"""
|
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/model/unet.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.374816 | """
---
title: U-Net for Stable Diffusion
summary: >
Annotated PyTorch implementation/tutorial of the U-Net in stable diffusion.
---
# U-Net for [Stable Diffusion](../index.html)
This implements the U-Net that
gives $\epsilon_\text{cond}(x_t, c)$
We have kept to the model definition and naming unchanged from
[Com... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/sampler/ddim.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.833019 | """
---
title: Denoising Diffusion Implicit Models (DDIM) Sampling
summary: >
Annotated PyTorch implementation/tutorial of
Denoising Diffusion Implicit Models (DDIM) Sampling
for stable diffusion model.
---
# Denoising Diffusion Implicit Models (DDIM) Sampling
This implements DDIM sampling from the paper
[Denoisin... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/sampler/ddpm.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.902229 | """
---
title: Denoising Diffusion Probabilistic Models (DDPM) Sampling
summary: >
Annotated PyTorch implementation/tutorial of
Denoising Diffusion Probabilistic Models (DDPM) Sampling
for stable diffusion model.
---
# Denoising Diffusion Probabilistic Models (DDPM) Sampling
For a simpler DDPM implementation refer... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/sampler/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.916090 | """
---
title: Sampling algorithms for stable diffusion
summary: >
Annotated PyTorch implementation/tutorial of
sampling algorithms
for stable diffusion model.
---
# Sampling algorithms for [stable diffusion](../index.html)
We have implemented the following [sampling algorithms](sampler/index.html):
* [Denoising ... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/util.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.958111 | """
---
title: Utility functions for stable diffusion
summary: >
Utility functions for stable diffusion
---
# Utility functions for [stable diffusion](index.html)
"""
import os
import random
from pathlib import Path
import PIL
import numpy as np
import torch
from PIL import Image
from labml import monit
from labml... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/scripts/image_to_image.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.959202 | """
---
title: Generate images using stable diffusion with a prompt from a given image
summary: >
Generate images using stable diffusion with a prompt from a given image
---
# Generate images using [stable diffusion](../index.html) with a prompt from a given image
"""
import argparse
from pathlib import Path
import... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/scripts/text_to_image.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.971208 | """
---
title: Generate images using stable diffusion with a prompt
summary: >
Generate images using stable diffusion with a prompt
---
# Generate images using [stable diffusion](../index.html) with a prompt
"""
import argparse
import os
from pathlib import Path
import torch
from labml import lab, monit
from labml... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/distillation/large.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.978567 | """
---
title: Train a large model on CIFAR 10
summary: >
Train a large model on CIFAR 10 for distillation.
---
# Train a large model on CIFAR 10
This trains a large model on CIFAR 10 for [distillation](index.html).
"""
import torch.nn as nn
from labml import experiment, logger
from labml.configs import option
f... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/scripts/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.979848 | """
---
title: Scripts to show example usages stable diffusion
summary: >
Annotated PyTorch implementation/tutorial of example usages of stable diffusion
---
# Scripts to show example usages [stable diffusion](../index.html)
* [Prompt to image diffusion](text_to_image.html)
* [Image to image diffusion](image_to_imag... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/diffusion/stable_diffusion/scripts/in_paint.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:29.981099 | """
---
title: In-paint images using stable diffusion with a prompt
summary: >
In-paint images using stable diffusion with a prompt
---
# In-paint images using [stable diffusion](../index.html) with a prompt
"""
import argparse
from pathlib import Path
from typing import Optional
import torch
from labml import lab... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/distillation/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.010140 | """
---
title: Distilling the Knowledge in a Neural Network
summary: >
PyTorch implementation and tutorial of the paper
Distilling the Knowledge in a Neural Network.
---
# Distilling the Knowledge in a Neural Network
This is a [PyTorch](https://pytorch.org) implementation/tutorial of the paper
[Distilling the Kno... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/distillation/small.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.415030 | """
---
title: Train a small model on CIFAR 10
summary: >
Train a small model on CIFAR 10 to test how much distillation benefits.
---
# Train a small model on CIFAR 10
This trains a small model on CIFAR 10 to test how much [distillation](index.html) benefits.
"""
import torch.nn as nn
from labml import experimen... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/experiments/arithmetic_dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.565234 | """
---
title: Arithmetic Dataset
summary: >
This creates arithmetic problems.
---
*This is based on code by [Georges Harik (@gharik)](https://twitter.com/gharik).*
"""
import random
import string
from typing import List
import torch
from labml.logger import Text
from torch.utils.data import DataLoader, Dataset
f... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/gan/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.589544 | """
---
title: Generative Adversarial Networks
summary: >
A set of PyTorch implementations/tutorials of GANs.
---
# Generative Adversarial Networks
* [Original GAN](original/index.html)
* [GAN with deep convolutional network](dcgan/index.html)
* [Cycle GAN](cycle_gan/index.html)
* [Wasserstein GAN](wasserstein/index... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/experiments/mnist.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.611275 | """
---
title: MNIST Experiment
summary: >
This is a reusable trainer for MNIST dataset
---
# MNIST Experiment
"""
import torch.nn as nn
import torch.utils.data
from labml import tracker
from labml.configs import option
from labml_nn.helpers.datasets import MNISTConfigs as MNISTDatasetConfigs
from labml_nn.helpers... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/experiments/nlp_autoregression.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.611774 | """
---
title: NLP auto-regression trainer
summary: >
This is a reusable trainer for auto-regressive tasks
---
# Auto-regressive NLP model trainer
"""
from typing import Callable
import torch
import torch.nn as nn
from labml import lab, monit, logger, tracker
from labml.configs import option
from labml.logger impo... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/gan/dcgan/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.630011 | """
---
title: Deep Convolutional Generative Adversarial Networks (DCGAN)
summary: A simple PyTorch implementation/tutorial of Deep Convolutional Generative Adversarial Networks (DCGAN).
---
# Deep Convolutional Generative Adversarial Networks (DCGAN)
This is a [PyTorch](https://pytorch.org) implementation of paper
[... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/experiments/cifar10.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.631280 | """
---
title: CIFAR10 Experiment
summary: >
This is a reusable trainer for CIFAR10 dataset
---
# CIFAR10 Experiment
"""
from typing import List
import torch.nn as nn
from labml import lab
from labml.configs import option
from labml_nn.helpers.datasets import CIFAR10Configs as CIFAR10DatasetConfigs
from labml_nn.e... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/gan/cycle_gan/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.655084 | """
---
title: Cycle GAN
summary: >
A simple PyTorch implementation/tutorial of Cycle GAN introduced in paper
Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks.
---
# Cycle GAN
This is a [PyTorch](https://pytorch.org) implementation/tutorial of the paper
[Unpaired Image-to-Image Tran... |
labmlai/annotated_deep_learning_paper_implementations | https://github.com/labmlai/annotated_deep_learning_paper_implementations | null | null | null | null | 66,511 | null | null | mit | null | null | null | null | null | null | null | labml_nn/experiments/nlp_classification.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:30.677598 | """
---
title: NLP classification trainer
summary: >
This is a reusable trainer for classification tasks
---
# NLP model trainer for classification
"""
from collections import Counter
from typing import Callable
import torchtext
import torchtext.vocab
from torchtext.vocab import Vocab
import torch
from labml impo... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/discord.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.536811 | """Discord channel integration using discord.py."""
from __future__ import annotations
import asyncio
import logging
import threading
from typing import Any
from app.channels.base import Channel
from app.channels.message_bus import InboundMessageType, MessageBus, OutboundMessage, ResolvedAttachment
logger = logging... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.566900 | """IM Channel integration for DeerFlow.
Provides a pluggable channel system that connects external messaging platforms
(Feishu/Lark, Slack, Telegram) to the DeerFlow agent via the ChannelManager,
which uses ``langgraph-sdk`` to communicate with Gateway's LangGraph-compatible API.
"""
from app.channels.base import Cha... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/commands.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.568541 | """Shared command definitions used by all channel implementations.
Keeping the authoritative command set in one place ensures that channel
parsers (e.g. Feishu) and the ChannelManager dispatcher stay in sync
automatically — adding or removing a command here is the single edit
required.
"""
from __future__ import anno... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/dingtalk.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.570891 | """DingTalk channel implementation."""
from __future__ import annotations
import asyncio
import json
import logging
import re
import threading
import time
from pathlib import Path
from typing import Any
import httpx
from app.channels.base import Channel
from app.channels.commands import KNOWN_CHANNEL_COMMANDS
from ... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/feishu.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.587332 | """Feishu/Lark channel — connects to Feishu via WebSocket (no public IP needed)."""
from __future__ import annotations
import asyncio
import json
import logging
import re
import threading
from typing import Any, Literal
from app.channels.base import Channel
from app.channels.commands import KNOWN_CHANNEL_COMMANDS
fr... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/service.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.591912 | """ChannelService — manages the lifecycle of all IM channels."""
from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING, Any
from app.channels.base import Channel
from app.channels.manager import DEFAULT_GATEWAY_URL, DEFAULT_LANGGRAPH_URL, ChannelManager
from app.channels.messag... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/message_bus.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.593282 | """MessageBus — async pub/sub hub that decouples channels from the agent dispatcher."""
from __future__ import annotations
import asyncio
import logging
import time
from collections.abc import Callable, Coroutine
from dataclasses import dataclass, field
from enum import StrEnum
from pathlib import Path
from typing im... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/manager.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.631982 | """ChannelManager — consumes inbound messages and dispatches them to the DeerFlow agent via Gateway."""
from __future__ import annotations
import asyncio
import logging
import mimetypes
import re
import time
from collections.abc import Awaitable, Callable, Mapping
from pathlib import Path
from typing import Any
impo... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/base.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:33.678827 | """Abstract base class for IM channels."""
from __future__ import annotations
import logging
from abc import ABC, abstractmethod
from typing import Any
from app.channels.message_bus import InboundMessage, InboundMessageType, MessageBus, OutboundMessage, ResolvedAttachment
logger = logging.getLogger(__name__)
clas... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/slack.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.108643 | """Slack channel — connects via Socket Mode (no public IP needed)."""
from __future__ import annotations
import asyncio
import logging
from typing import Any
from markdown_to_mrkdwn import SlackMarkdownConverter
from app.channels.base import Channel
from app.channels.message_bus import InboundMessageType, MessageBu... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/store.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.130833 | """ChannelStore — persists IM chat-to-DeerFlow thread mappings."""
from __future__ import annotations
import json
import logging
import tempfile
import threading
import time
from pathlib import Path
from typing import Any
logger = logging.getLogger(__name__)
class ChannelStore:
"""JSON-file-backed store that m... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/telegram.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.132392 | """Telegram channel — connects via long-polling (no public IP needed)."""
from __future__ import annotations
import asyncio
import logging
import threading
from typing import Any
from app.channels.base import Channel
from app.channels.message_bus import InboundMessage, InboundMessageType, MessageBus, OutboundMessage... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.182474 | from .app import app, create_app
from .config import GatewayConfig, get_gateway_config
__all__ = ["app", "create_app", "GatewayConfig", "get_gateway_config"]
|
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/wechat.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.184464 | """WeChat channel — connects to iLink via long-polling."""
from __future__ import annotations
import asyncio
import base64
import binascii
import hashlib
import json
import logging
import mimetypes
import secrets
import time
from collections.abc import Mapping
from enum import IntEnum
from pathlib import Path
from ty... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/channels/wecom.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.186052 | from __future__ import annotations
import asyncio
import base64
import hashlib
import logging
from collections.abc import Awaitable, Callable
from typing import Any, cast
from app.channels.base import Channel
from app.channels.message_bus import (
InboundMessageType,
MessageBus,
OutboundMessage,
Resol... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/app.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.205147 | import asyncio
import logging
import os
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.gateway.auth_middleware import AuthMiddleware
from app.gateway.config import get_gateway_config
from app... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.220375 | """Authentication module for DeerFlow.
This module provides:
- JWT-based authentication
- Provider Factory pattern for extensible auth methods
- UserRepository interface for storage backends (SQLite)
"""
from app.gateway.auth.config import AuthConfig, get_auth_config, set_auth_config
from app.gateway.auth.errors impo... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/config.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.338703 | """Authentication configuration for DeerFlow."""
import logging
import os
import secrets
from pydantic import BaseModel, Field
logger = logging.getLogger(__name__)
class AuthConfig(BaseModel):
"""JWT and auth-related configuration. Parsed once at startup.
Note: the ``users`` table now lives in the shared ... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/credential_file.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.355974 | """Write initial admin credentials to a restricted file instead of logs.
Logging secrets to stdout/stderr is a well-known CodeQL finding
(py/clear-text-logging-sensitive-data) — in production those logs
get collected into ELK/Splunk/etc and become a secret sprawl
source. This helper writes the credential to a 0600 fil... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/local_provider.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.714014 | """Local email/password authentication provider."""
import logging
from app.gateway.auth.models import User
from app.gateway.auth.password import hash_password_async, needs_rehash, verify_password_async
from app.gateway.auth.providers import AuthProvider
from app.gateway.auth.repositories.base import UserRepository
... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/jwt.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.730784 | """JWT token creation and verification."""
from datetime import UTC, datetime, timedelta
import jwt
from pydantic import BaseModel
from app.gateway.auth.config import get_auth_config
from app.gateway.auth.errors import TokenError
class TokenPayload(BaseModel):
"""JWT token payload."""
sub: str # user_id
... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/models.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.800650 | """User Pydantic models for authentication."""
from datetime import UTC, datetime
from typing import Literal
from uuid import UUID, uuid4
from pydantic import BaseModel, ConfigDict, EmailStr, Field
def _utc_now() -> datetime:
"""Return current UTC time (timezone-aware)."""
return datetime.now(UTC)
class U... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/providers.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.801571 | """Auth provider abstraction."""
from abc import ABC, abstractmethod
class AuthProvider(ABC):
"""Abstract base class for authentication providers."""
@abstractmethod
async def authenticate(self, credentials: dict) -> "User | None":
"""Authenticate user with given credentials.
Returns Us... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/errors.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.808796 | """Typed error definitions for auth module.
AuthErrorCode: exhaustive enum of all auth failure conditions.
TokenError: exhaustive enum of JWT decode failures.
AuthErrorResponse: structured error payload for HTTP responses.
"""
from enum import StrEnum
from pydantic import BaseModel
class AuthErrorCode(StrEnum):
... |
bytedance/deer-flow | https://github.com/bytedance/deer-flow | null | null | null | null | 64,601 | null | null | mit | null | null | null | null | null | null | null | backend/app/gateway/auth/password.py | null | null | null | null | null | null | Python | 2026-05-04T02:17:34.810132 | """Password hashing utilities with versioned hash format.
Hash format: ``$dfv<N>$<bcrypt_hash>`` where ``<N>`` is the version.
- **v1** (legacy): ``bcrypt(password)`` — plain bcrypt, susceptible to
72-byte silent truncation.
- **v2** (current): ``bcrypt(b64(sha256(password)))`` — SHA-256 pre-hash
avoids the 72-by... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.