[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-AntreasAntoniou--HowToTrainYourMAMLPytorch":3,"tool-AntreasAntoniou--HowToTrainYourMAMLPytorch":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":70,"readme_en":71,"readme_zh":72,"quickstart_zh":73,"use_case_zh":74,"hero_image_url":75,"owner_login":76,"owner_name":77,"owner_avatar_url":78,"owner_bio":79,"owner_company":80,"owner_location":81,"owner_email":82,"owner_twitter":83,"owner_website":84,"owner_url":85,"languages":86,"stars":95,"forks":96,"last_commit_at":97,"license":98,"difficulty_score":10,"env_os":99,"env_gpu":100,"env_ram":101,"env_deps":102,"category_tags":109,"github_topics":110,"view_count":23,"oss_zip_url":110,"oss_zip_packed_at":110,"status":16,"created_at":111,"updated_at":112,"faqs":113,"releases":144},2654,"AntreasAntoniou\u002FHowToTrainYourMAMLPytorch","HowToTrainYourMAMLPytorch","The original code for the paper \"How to train your MAML\" along with a replication of the original \"Model Agnostic Meta Learning\" (MAML) paper in Pytorch.","HowToTrainYourMAMLPytorch 是一个基于 PyTorch 构建的开源代码库，旨在复现并优化元学习领域的经典研究。它完整实现了原始“模型无关元学习”（MAML）论文及其进阶版\"How to train your MAML\"中的算法，为研究人员提供了从数据加载、模型训练到实验复现的一站式解决方案。\n\n在元学习中，如何让模型快速适应新任务一直是个挑战，而原始 MAML 的训练过程往往复杂且难以调优。该项目不仅解决了复现难题，还通过改进训练策略提升了模型的收敛速度与最终性能。项目内置了 Omniglot 数据集支持，并提供了 Mini-ImageNet 数据集的自动化下载与解压流程，极大降低了环境配置门槛。\n\n其技术亮点在于高度模块化的架构设计：通过模板化配置文件与自动脚本生成工具，用户可以轻松批量调整超参数并复现论文中的所有实验结果，显著提升了科研效率。\n\n这套工具非常适合人工智能领域的研究人员、算法工程师以及希望深入理解元学习机制的开发者使用。对于想要探索小样本学习或快速原型验证的团队来说，HowToTrainYourMAMLPytorch 提供了一个严谨、透明且易于","HowToTrainYourMAMLPytorch 是一个基于 PyTorch 构建的开源代码库，旨在复现并优化元学习领域的经典研究。它完整实现了原始“模型无关元学习”（MAML）论文及其进阶版\"How to train your MAML\"中的算法，为研究人员提供了从数据加载、模型训练到实验复现的一站式解决方案。\n\n在元学习中，如何让模型快速适应新任务一直是个挑战，而原始 MAML 的训练过程往往复杂且难以调优。该项目不仅解决了复现难题，还通过改进训练策略提升了模型的收敛速度与最终性能。项目内置了 Omniglot 数据集支持，并提供了 Mini-ImageNet 数据集的自动化下载与解压流程，极大降低了环境配置门槛。\n\n其技术亮点在于高度模块化的架构设计：通过模板化配置文件与自动脚本生成工具，用户可以轻松批量调整超参数并复现论文中的所有实验结果，显著提升了科研效率。\n\n这套工具非常适合人工智能领域的研究人员、算法工程师以及希望深入理解元学习机制的开发者使用。对于想要探索小样本学习或快速原型验证的团队来说，HowToTrainYourMAMLPytorch 提供了一个严谨、透明且易于扩展的实验基准。","# How to train your MAML in Pytorch\nA replication of the paper [\"How to train your MAML\"](https:\u002F\u002Farxiv.org\u002Fabs\u002F1810.09502), along with a replication of the original [\"Model Agnostic Meta Learning\"](https:\u002F\u002Farxiv.org\u002Fabs\u002F1703.03400) (MAML) paper.\n\n## Introduction\n\nWelcome to the code repository of [How to train your MAML](https:\u002F\u002Farxiv.org\u002Fabs\u002F1810.09502). This repository includes code for training both MAML\nand MAML++ models, as well as data providers and the datasets for both. By using this codebase you agree to the terms \nand conditions in the [LICENSE](https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fblob\u002Fmaster\u002FLICENSE) file. If you choose to use the Mini-Imagenet dataset, you must abide by the terms and conditions in the [ImageNet LICENSE](https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fblob\u002Fmaster\u002Fimagenet_license.md)\n\n## Installation\n\nThe code uses Pytorch to run, along with many other smaller packages. To take care of everything at once, we recommend \nusing the conda package management library. More specifically, \n[miniconda3](https:\u002F\u002Frepo.continuum.io\u002Fminiconda\u002FMiniconda3-latest-Linux-x86_64.sh), as it is lightweight and fast to install.\nIf you have an existing miniconda3 installation please start at step 3. \nIf you want to  install both conda and the required packages, please run:\n 1. ```wget https:\u002F\u002Frepo.continuum.io\u002Fminiconda\u002FMiniconda3-latest-Linux-x86_64.sh```\n 2. Go through the installation.\n 3. Activate conda\n 4. conda create -n meta_learning_pytorch_env python=3.6.\n 5. conda activate meta_learning_pytorch_env\n 6. At this stage you need to choose which version of pytorch you need by visiting [here](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F)\n 7. Choose and install the pytorch variant of your choice using the conda commands.\n 8. Then run ```bash install.sh```\n\nTo execute an installation script simply run:\n```bash \u003Cinstallation_file_name>```\n\nTo activate your conda installations simply run:\n```conda activate```\n\n## Datasets\n\nWe provide the omniglot dataset in the datasets folder directly in this repo. However, due to Mini-ImageNet being \nsubstantially larger than github's limit, we chose to upload it on gdrive using pbzip (parallel zip) compression, which\nis one of the fastest compressions available as we are writing this (really helps if you are zipping something as big \nas today's large scale datasets). We have automated the unzipping and usage of the dataset, all one needs to do is download it\nfrom our [mini_imagenet gdrive folder](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1qQCoGoEJKUCQkk8roncWH7rhPN7aMfBr\u002Fview?usp=sharing).\nOnce download, please place it in the datasets folder in this repo. The rest will be done automagically when you \nrun your mini-imagenet experiment. \n\nNote: By downloading and using the mini-imagenet datasets, you accept terms and conditions found in [imagenet_license.md](https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fblob\u002Fmaster\u002Fimagenet_license.md) \n\n## Overview of code:\n\n- datasets folder: Contains the dataset pbzip files and folders containing the images in a structure readable by the \ncustom data provider.\n- experiments_config: Contains configuration files for each and every experiment listed in the experiments script folder.\nAll of the scripts are automatically generated using the script_generation_tools\u002Fgenerate_configs.py script.\n- experiment_scripts: Contains scripts that can reproduce every results in the paper. Each script is easily runnable\nsimply by executing:\n```bash \u003Cexperiment-script.sh>```\n- experiment_template_config: Contains the template configuration files. These files have variables declared in their \nfiles indicated as $variable_name$, which are then filled automatically by the generate_configs.py script. This way one\ncan vary various hyperparameters automatically.\n- script_generation_tools: Contains scripts and template files for the automatic generation of experiment scripts.\n- utils: Contains utilities for dataset extraction, parser argument extraction and storage of statistics and others.\n- data.py: Contains the data providers for the few shot meta learning task generation. The data provider is agnostic\nto dataset, which means it can be used with any dataset. Most importantly, it can only scan and use datasets when they \nare presented in a specific format. The two formats that the data provider can read are:\n1. A folder structure where the top level folders are the classes and the contained images of each folders, the images \nof that class, as illustrated below:\n```\nDataset\n    ||______\n    |       |\n class_0 class_1 ... class_N\n    |       |___________________\n    |                           |\nsamples for class_0    samples for class_1\n```\nIn this case the data provider will split the data into 3 sets, train, val and test using the train_val_test_split \nvariable found in the experiment_config files. However, in the case where you have a pre-split dataset, such \nas mini_imagenet, you can instead use:\n2. A folder structure where the higher level folders indicate the set (i.e. train, val, test), the mid level folders \n(i.e. the folders within a particular set) indicate the class and the images within each class indicate the images of \nthat class.\n```\nDataset\n    ||\n ___||_________\n|       |     |\nTrain   Val  Test\n|_________________________\n    |       |            |\n class_0 class_1 ... class_N\n    |       |___________________\n    |                           |\nsamples for class_0    samples for class_1\n```\n- experiment_builder.py: Builds an experiment ready to train and evaluate your meta learning models. It supports automatic\ncheckpoining and even fault-tolerant code. If your script is killed for whatever reason, you can simply rerun the script.\nIt will find where it was before it was killed and continue onwards towards convergence!\n\n- few_shot_learning_system.py: Contains the meta_learning_system class which is where most of MAML and MAML++ are actually\nimplemented. It takes care of inner and outer loop optimization, checkpointing, reloading and statistics generation, as \nwell as setting the rng seeds in pytorch.\n\n- meta_neural_network_architectures: Contains new pytorch layers which are capable of utilizing either internal \nparameter or externally passed parameters. This is very useful in a meta-learning setting where inner-loop update \nsteps are applied on the internal parameters. By allowing layers to receive weight which they will only use for the \ncurrent inference phase, one can easily build various meta-learning models, which require inner_loop optimization \nwithout having to reload the internal parameters at every step. Essentially at the technical level, the meta-layers \nforward prop looks like:\n```python\ndef forward(x, weights=None):\n\n    if weights is not None:\n        out = layer(x, weights)\n    else:\n        out = layer(x, self.parameters)\n    return out\n\n```\nIf we pass weights to it, then the layer\u002Fmodel will use those to do inference, otherwise it will use its internal \nparameters. Doing so allows a model like MAML to be build very easily. At the first step, use weights=None and for any\nsubsequent step just pass the new inner loop\u002Fdynamic weights to the network.\n\n- train_maml_system.py: A very minimal script that combines the data provider with a meta learning system and sends them\n to the experiment builder to run an experiment. Also takes care of automated extraction of data if they are not \n available in a folder structure.\n\n# Running an experiment\n\nTo run an experiment from the paper on Omniglot:\n1. Activate your conda environment ```conda activate pytorch_meta_learning_env```\n2. cd experiment_scripts\n3. Find which experiment you want to run.\n4. ```bash experiment_script.sh gpu_ids_separated_by_spaces```\n\nNote: By downloading and using the mini-imagenet datasets, you accept terms and conditions found in [imagenet_license.md](https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fblob\u002Fmaster\u002Fimagenet_license.md) \n\nTo run an experiment from the paper on Mini-Imagenet:\n1. Activate your conda environment ```conda activate pytorch_meta_learning_env```\n2. Download the mini_imagenet dataset from the [mini_imagenet gdrive folder](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1qQCoGoEJKUCQkk8roncWH7rhPN7aMfBr\u002Fview?usp=sharing)\n3. copy the .pbzip file in datasets\n4. cd experiment_scripts\n5. Find which experiment you want to run.\n6. ```bash experiment_script.sh gpu_ids_separated_by_spaces```\n\nTo run a custom\u002Fnew experiment on any dataset:\n1. Activate your conda environment ```conda activate pytorch_meta_learning_env```\n2. Make sure your data is in datasets\u002F in a folder structure the data provider can read.\n3. cd experiment_template_config\n4. Find an experiment close to what you want to do and open its config file.\n5. For example let's take an omniglot experiment on maml++. Make changes to the hyperparameters such that your \nexperiment takes form. Note that the variables in $\u003Cvariable>$ are hyperparameters automatically filled by the config\ngeneration script. If you add any new of those, you'll have to change the generate_configs.py file in order to tell it\nwhat to fill those with.\n6.\n    ```json\n    {\n      \"batch_size\":16,\n      \"image_height\":28,\n      \"image_width\":28,\n      \"image_channels\":1,\n      \"gpu_to_use\":0,\n      \"num_dataprovider_workers\":8,\n      \"max_models_to_save\":5,\n      \"dataset_name\":\"omniglot_dataset\",\n      \"dataset_path\":\"omniglot_dataset\",\n      \"reset_stored_paths\":false,\n      \"experiment_name\":\"MAML++_Omniglot_$num_classes$_way_$samples_per_class$_shot_$train_update_steps$_filter_multi_step_loss_with_max_pooling_seed_$train_seed$\",\n      \"train_seed\": $train_seed$, \"val_seed\": $val_seed$,\n      \"train_val_test_split\": [0.70918052988, 0.03080714725, 0.2606284658],\n      \"indexes_of_folders_indicating_class\": [-3, -2],\n      \"sets_are_pre_split\": false,\n    \n      \"total_epochs\": 150,\n      \"total_iter_per_epoch\":500, \"continue_from_epoch\": -2,\n    \n      \"max_pooling\": true,\n      \"per_step_bn_statistics\": true,\n      \"learnable_batch_norm_momentum\": false,\n    \n      \"dropout_rate_value\":0.0,\n      \"min_learning_rate\":0.00001,\n      \"meta_learning_rate\":0.001,   \"total_epochs_before_pause\": 150,\n      \"task_learning_rate\":-1,\n      \"init_task_learning_rate\":0.4,\n      \"first_order_to_second_order_epoch\":80,\n    \n      \"norm_layer\":\"batch_norm\",\n      \"cnn_num_filters\":64,\n      \"num_stages\":4,\n      \"number_of_training_steps_per_iter\":$train_update_steps$,\n      \"number_of_evaluation_steps_per_iter\":$val_update_steps$,\n      \"cnn_blocks_per_stage\":1,\n      \"num_classes_per_set\":$num_classes$,\n      \"num_samples_per_class\":$samples_per_class$,\n      \"num_target_samples\": $target_samples_per_class$,\n    \n      \"second_order\": true,\n      \"use_multi_step_loss_optimization\":true,\n      \"use_gdrive\":false\n    }\n    \n    ```\n7. ```cd script_generation_tools```\n8. ```python generate_configs.py; python generate_scripts.py```\n9. Your new scripts can be found in the experiment_scripts, ready to be run.\n\n# Acknowledgments\nThanks to the University of Edinburgh and EPSRC research council for funding this research.\n \n \n","# 如何用 PyTorch 训练你的 MAML\n本项目复现了论文《如何训练你的 MAML》（[arXiv:1810.09502](https:\u002F\u002Farxiv.org\u002Fabs\u002F1810.09502)），同时也复现了原始的《模型无关元学习》（[arXiv:1703.03400](https:\u002F\u002Farxiv.org\u002Fabs\u002F1703.03400)，即 MAML）论文。\n\n## 引言\n\n欢迎来到《如何训练你的 MAML》代码仓库（[arXiv:1810.09502](https:\u002F\u002Farxiv.org\u002Fabs\u002F1810.09502)）。该仓库包含了训练 MAML 和 MAML++ 模型的代码，以及相应的数据提供器和数据集。使用本代码库即表示您同意 [LICENSE](https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fblob\u002Fmaster\u002FLICENSE) 文件中的条款与条件。如果您选择使用 Mini-Imagenet 数据集，则必须遵守 [ImageNet LICENSE](https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fblob\u002Fmaster\u002Fimagenet_license.md) 中的条款与条件。\n\n## 安装\n\n本代码使用 PyTorch 运行，并依赖许多其他小型库。为了简化安装流程，我们推荐使用 conda 包管理工具。具体来说，建议使用 [miniconda3](https:\u002F\u002Frepo.continuum.io\u002Fminiconda\u002FMiniconda3-latest-Linux-x86_64.sh)，因为它轻量且安装迅速。如果您已经安装了 miniconda3，请从第 3 步开始。若要同时安装 conda 和所需依赖包，请执行以下步骤：\n\n1. `wget https:\u002F\u002Frepo.continuum.io\u002Fminiconda\u002FMiniconda3-latest-Linux-x86_64.sh`\n2. 按照提示完成安装。\n3. 激活 conda。\n4. `conda create -n meta_learning_pytorch_env python=3.6`。\n5. `conda activate meta_learning_pytorch_env`。\n6. 在此阶段，您需要访问 [这里](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F) 来选择所需的 PyTorch 版本。\n7. 使用 conda 命令安装您选择的 PyTorch 版本。\n8. 最后运行 `bash install.sh`。\n\n要执行安装脚本，只需运行：\n```bash \u003Cinstallation_file_name>```\n\n要激活您的 conda 环境，只需运行：\n```conda activate```\n\n## 数据集\n\n我们在 datasets 文件夹中直接提供了 omniglot 数据集。然而，由于 Mini-ImageNet 数据集远超 GitHub 的文件大小限制，我们选择将其上传至 Google Drive，并采用 pbzip（并行压缩）方式进行压缩。这种压缩方式在撰写本文时属于速度最快的之一，尤其适用于当今大规模数据集的压缩任务。我们已自动化了该数据集的解压和使用流程，您只需从我们的 [mini_imagenet Google Drive 文件夹](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1qQCoGoEJKUCQkk8roncWH7rhPN7aMfBr\u002Fview?usp=sharing) 下载即可。下载完成后，请将其放置于本仓库的 datasets 文件夹中，后续操作将由程序自动完成，当您运行 Mini-Imagenet 实验时即可正常使用。\n\n注意：下载并使用 Mini-Imagenet 数据集即表示您已接受 [imagenet_license.md](https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fblob\u002Fmaster\u002Fimagenet_license.md) 中的条款与条件。\n\n## 代码概述：\n\n- datasets 文件夹：包含数据集的 pbzip 文件以及图像文件夹，其结构可供自定义数据提供器读取。\n- experiments_config：包含 experiments 脚本文件夹中列出的每项实验的配置文件。所有脚本均通过 script_generation_tools\u002Fgenerate_configs.py 脚本自动生成。\n- experiment_scripts：包含可复现论文中所有结果的脚本。每个脚本只需简单执行以下命令即可运行：\n```bash \u003Cexperiment-script.sh>```\n- experiment_template_config：包含模板配置文件。这些文件中声明了以 $variable_name$ 标记的变量，随后由 generate_configs.py 脚本自动填充。这样可以自动调整各种超参数。\n- script_generation_tools：包含用于自动生成实验脚本的脚本和模板文件。\n- utils：包含用于数据集提取、解析器参数提取、统计信息存储等实用工具。\n- data.py：包含用于小样本元学习任务生成的数据提供器。该数据提供器与数据集无关，因此可用于任何数据集。最重要的是，它仅能在数据集采用特定格式时进行扫描和使用。数据提供器支持的两种格式如下：\n1. 文件夹结构：顶级文件夹代表类别，每个文件夹内的图像即为该类别的样本，具体结构如下：\n```\nDataset\n    ||______\n    |       |\n class_0 class_1 ... class_N\n    |       |___________________\n    |                           |\nclass_0 的样本    class_1 的样本\n```\n在这种情况下，数据提供器会根据 experiment_config 文件中的 train_val_test_split 变量将数据划分为训练集、验证集和测试集。然而，对于已预先划分数据集的情况（如 mini_imagenet），则可采用以下格式：\n2. 文件夹结构：更高级别的文件夹表示数据集类型（如训练集、验证集、测试集），中间级别的文件夹表示类别，而每个类别文件夹内的图像即为该类别的样本。\n```\nDataset\n    ||\n ___||_________\n|       |     |\n训练集   验证集  测试集\n|_________________________\n    |       |            |\n class_0 class_1 ... class_N\n    |       |___________________\n    |                           |\nclass_0 的样本    class_1 的样本\n```\n- experiment_builder.py：构建一个可直接用于训练和评估元学习模型的实验环境。它支持自动检查点保存，并具备容错功能。如果脚本因某种原因被终止，只需重新运行即可。脚本会自动找到上次中断的位置并从中继续执行，直至收敛！\n\n- few_shot_learning_system.py：包含 meta_learning_system 类，MAML 和 MAML++ 的核心实现大多在此类中完成。该类负责内层和外层优化循环、检查点保存与加载、统计信息生成，以及 PyTorch 中随机数种子的设置。\n- meta_neural_network_architectures：包含新型 PyTorch 层，这些层既可以利用内部参数，也可以接收外部传入的参数。这在元学习场景中非常有用——内层更新步骤作用于模型的内部参数。通过允许各层接收仅用于当前推理阶段的权重，用户可以轻松构建各类需要内层优化的元学习模型，而无需在每一步都重新加载内部参数。从技术层面来看，元学习层的前向传播逻辑如下：\n```python\ndef forward(x, weights=None):\n\n    if weights is not None:\n        out = layer(x, weights)\n    else:\n        out = layer(x, self.parameters)\n    return out\n\n```\n如果传入权重，则该层或模型将使用这些权重进行推理；否则则使用其内部参数。这种方式使得构建 MAML 等模型变得极为简便：第一步使用 weights=None，后续步骤则只需将新的内层动态权重传递给网络即可。\n- train_maml_system.py：一个极简脚本，将数据提供器与元学习系统结合，并将其送入实验构建器以运行实验。此外，若数据未以文件夹结构存在，该脚本还会自动完成数据提取工作。\n\n# 运行实验\n\n### 在 Omniglot 数据集上运行论文中的实验：\n1. 激活你的 Conda 环境：`conda activate pytorch_meta_learning_env`\n2. 切换到 `experiment_scripts` 目录：`cd experiment_scripts`\n3. 找到你想运行的实验。\n4. 运行命令：`bash experiment_script.sh gpu_ids_separated_by_spaces`\n\n**注意**：通过下载和使用 mini-ImageNet 数据集，即表示你已接受 [imagenet_license.md](https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fblob\u002Fmaster\u002Fimagenet_license.md) 文件中的条款与条件。\n\n### 在 Mini-ImageNet 数据集上运行论文中的实验：\n1. 激活你的 Conda 环境：`conda activate pytorch_meta_learning_env`\n2. 从 [mini_imagenet gdrive 文件夹](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1qQCoGoEJKUCQkk8roncWH7rhPN7aMfBr\u002Fview?usp=sharing) 下载 mini-imagenet 数据集。\n3. 将 `.pbzip` 文件复制到 `datasets` 目录。\n4. 切换到 `experiment_scripts` 目录：`cd experiment_scripts`\n5. 找到你想运行的实验。\n6. 运行命令：`bash experiment_script.sh gpu_ids_separated_by_spaces`\n\n### 在任意数据集上运行自定义\u002F新实验：\n1. 激活你的 Conda 环境：`conda activate pytorch_meta_learning_env`\n2. 确保你的数据已按照数据提供者可读取的文件夹结构存放在 `datasets\u002F` 目录下。\n3. 切换到 `experiment_template_config` 目录：`cd experiment_template_config`\n4. 找到一个与你计划进行的实验相近的配置文件并打开。\n5. 以 MAML++ 在 Omniglot 上的实验为例，调整超参数以适应你的实验需求。请注意，`${variable}` 中的变量是由配置生成脚本自动填充的超参数。如果你添加了新的此类变量，还需要修改 `generate_configs.py` 文件，告知脚本如何填充这些变量。\n6.\n    ```json\n    {\n      \"batch_size\":16,\n      \"image_height\":28,\n      \"image_width\":28,\n      \"image_channels\":1,\n      \"gpu_to_use\":0,\n      \"num_dataprovider_workers\":8,\n      \"max_models_to_save\":5,\n      \"dataset_name\":\"omniglot_dataset\",\n      \"dataset_path\":\"omniglot_dataset\",\n      \"reset_stored_paths\":false,\n      \"experiment_name\":\"MAML++_Omniglot_$num_classes$_way_$samples_per_class$_shot_$train_update_steps$_filter_multi_step_loss_with_max_pooling_seed_$train_seed$\",\n      \"train_seed\": $train_seed$, \"val_seed\": $val_seed$,\n      \"train_val_test_split\": [0.70918052988, 0.03080714725, 0.2606284658],\n      \"indexes_of_folders_indicating_class\": [-3, -2],\n      \"sets_are_pre_split\": false,\n\n      \"total_epochs\": 150,\n      \"total_iter_per_epoch\":500, \"continue_from_epoch\": -2,\n\n      \"max_pooling\": true,\n      \"per_step_bn_statistics\": true,\n      \"learnable_batch_norm_momentum\": false,\n\n      \"dropout_rate_value\":0.0,\n      \"min_learning_rate\":0.00001,\n      \"meta_learning_rate\":0.001,   \"total_epochs_before_pause\": 150,\n      \"task_learning_rate\":-1,\n      \"init_task_learning_rate\":0.4,\n      \"first_order_to_second_order_epoch\":80,\n\n      \"norm_layer\":\"batch_norm\",\n      \"cnn_num_filters\":64,\n      \"num_stages\":4,\n      \"number_of_training_steps_per_iter\":$train_update_steps$,\n      \"number_of_evaluation_steps_per_iter\":$val_update_steps$,\n      \"cnn_blocks_per_stage\":1,\n      \"num_classes_per_set\":$num_classes$,\n      \"num_samples_per_class\":$samples_per_class$,\n      \"num_target_samples\": $target_samples_per_class$,\n\n      \"second_order\": true,\n      \"use_multi_step_loss_optimization\":true,\n      \"use_gdrive\":false\n    }\n    ```\n7. 切换到 `script_generation_tools` 目录：`cd script_generation_tools`\n8. 运行以下命令：`python generate_configs.py; python generate_scripts.py`\n9. 你的新脚本将出现在 `experiment_scripts` 目录中，可以直接运行。\n\n### 致谢\n感谢爱丁堡大学和 EPSRC 研究理事会为本研究提供的资助。","# HowToTrainYourMAMLPytorch 快速上手指南\n\n本指南帮助中国开发者快速部署并运行 MAML 及 MAML++ 元学习模型。该项目复现了论文《How to train your MAML》及原始 MAML 论文的核心算法。\n\n## 环境准备\n\n*   **操作系统**: Linux (推荐，脚本针对 Linux 优化)\n*   **包管理器**: Miniconda3 (轻量级，安装迅速)\n*   **Python 版本**: 3.6 (项目指定版本)\n*   **深度学习框架**: PyTorch (需根据本地 CUDA 版本选择对应安装包)\n*   **硬件要求**: 支持 CUDA 的 NVIDIA GPU (用于加速元学习训练)\n\n> **注意**：国内用户建议配置 Conda 和 Pip 的国内镜像源（如清华源或中科大源）以加速依赖下载。\n\n## 安装步骤\n\n### 1. 安装 Miniconda\n如果尚未安装 Miniconda，请执行以下命令下载并安装（以 Linux x86_64 为例）：\n\n```bash\nwget https:\u002F\u002Frepo.continuum.io\u002Fminiconda\u002FMiniconda3-latest-Linux-x86_64.sh\n# 随后按提示完成安装流程\n```\n\n### 2. 创建并激活虚拟环境\n创建名为 `meta_learning_pytorch_env` 的环境并激活：\n\n```bash\nconda create -n meta_learning_pytorch_env python=3.6\nconda activate meta_learning_pytorch_env\n```\n\n### 3. 安装 PyTorch\n访问 [PyTorch 官网](https:\u002F\u002Fpytorch.org\u002Fget-started\u002Flocally\u002F) 选择适合你系统的安装命令。\n**国内加速建议**：将命令中的 `pip` 或 `conda` 源替换为国内镜像。例如使用 pip 安装时：\n\n```bash\n# 示例：使用清华源安装 CPU 版本 (请根据实际需求替换为 cuda 版本命令)\npip install torch torchvision torchaudio --index-url https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 4. 安装项目依赖\n在项目根目录下运行提供的安装脚本：\n\n```bash\nbash install.sh\n```\n\n### 5. 数据集准备\n*   **Omniglot**: 已包含在 `datasets` 文件夹中，无需额外操作。\n*   **Mini-ImageNet**: 由于文件较大，需手动下载。\n    1. 从 [Google Drive 链接](https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1qQCoGoEJKUCQkk8roncWH7rhPN7aMfBr\u002Fview?usp=sharing) 下载 `.pbzip` 压缩包。\n    2. 将下载的文件放入项目根目录下的 `datasets` 文件夹中。\n    3. 程序在首次运行时会自动解压。\n\n## 基本使用\n\n### 运行预置实验 (Omniglot)\n这是最简单的启动方式，直接复现论文中的 Omniglot 实验结果。\n\n1. 激活环境：\n   ```bash\n   conda activate meta_learning_pytorch_env\n   ```\n2. 进入实验脚本目录：\n   ```bash\n   cd experiment_scripts\n   ```\n3. 选择并运行一个实验脚本（需指定可用的 GPU ID，空格分隔）：\n   ```bash\n   bash \u003Cexperiment_script.sh> 0\n   # 例如：bash maml_omniglot_5_way_1_shot.sh 0\n   ```\n\n### 运行 Mini-ImageNet 实验\n确保已完成上述“数据集准备”步骤中 Mini-ImageNet 的下载。\n\n1. 激活环境并进入目录：\n   ```bash\n   conda activate meta_learning_pytorch_env\n   cd experiment_scripts\n   ```\n2. 运行对应的 Mini-ImageNet 实验脚本：\n   ```bash\n   bash \u003Cmini_imagenet_experiment_script.sh> 0\n   ```\n\n### 运行自定义实验\n若需修改超参数或使用新数据集：\n\n1. 编辑配置文件：\n   进入 `experiment_template_config` 目录，复制并修改接近你需求的 `.json` 配置文件。注意 `$variable$` 格式的变量将由脚本自动生成填充。\n   \n2. 生成新的实验脚本：\n   ```bash\n   cd script_generation_tools\n   python generate_configs.py\n   python generate_scripts.py\n   ```\n   生成的新脚本将位于 `experiment_scripts` 目录，可直接运行。\n\n> **特性提示**：本项目支持断点续训。如果训练意外中断，重新运行相同的脚本即可自动加载最近的 checkpoint 继续训练。","某初创公司的算法团队正致力于开发一款能快速适应新物种识别的野外生物监测 App，需要在极少样本下实现高精度分类。\n\n### 没有 HowToTrainYourMAMLPytorch 时\n- **复现门槛极高**：团队需从零研读 MAML 及 MAML++ 论文并手动推导梯度更新公式，极易因代码细节错误导致模型无法收敛。\n- **实验配置繁琐**：每次调整超参数（如内层迭代次数、学习率）都需手动修改脚本，难以系统化地复现论文中的对比实验。\n- **数据预处理耗时**：Mini-ImageNet 等标准数据集体积庞大且格式复杂，自行编写解压、加载及增强管道耗费了数周工程时间。\n- **基线对比困难**：缺乏统一的基准代码，难以公平评估自研改进策略是否真正优于原始 MAML 算法。\n\n### 使用 HowToTrainYourMAMLPytorch 后\n- **开箱即用复现**：直接调用内置的 MAML 和 MAML++ 训练脚本，几分钟内即可跑通官方结果，将研发重心从“造轮子”转向“优化模型”。\n- **自动化实验管理**：利用 `generate_configs.py` 自动生成不同超参数组合的实验配置，轻松完成大规模消融实验以寻找最优解。\n- **数据流程标准化**：借助集成的 Omniglot 和 Mini-ImageNet 数据提供者，自动处理下载、解压与读取，当天即可启动模型训练。\n- **权威基线对齐**：基于与论文完全一致的代码底座进行改进，确保性能提升真实可信，大幅增强了技术报告说服力。\n\nHowToTrainYourMAMLPytorch 将元学习的研究周期从“月级”压缩至“天级”，让团队能专注于解决小样本学习的核心难题而非工程琐事。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FAntreasAntoniou_HowToTrainYourMAMLPytorch_3cf7c64a.png","AntreasAntoniou","Antreas Antoniou","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FAntreasAntoniou_6f6ff258.jpg","Research Associate in Machine Learning, interested in the intersection of multi-modal learning and meta-learning.","University of Edinburgh","Edinburgh","iam@antreas.io","AntreasAntonio","https:\u002F\u002Fantreas.io","https:\u002F\u002Fgithub.com\u002FAntreasAntoniou",[87,91],{"name":88,"color":89,"percentage":90},"Python","#3572A5",92,{"name":92,"color":93,"percentage":94},"Shell","#89e051",8,828,147,"2026-03-27T08:02:03","NOASSERTION","Linux","需要 NVIDIA GPU（运行脚本时需指定 gpu_ids），具体型号和显存大小未说明，需根据 PyTorch 版本匹配对应的 CUDA 版本","未说明",{"notes":103,"python":104,"dependencies":105},"1. 官方安装指南明确针对 Linux 系统（提供 Miniconda3 Linux x86_64 下载链接）。2. 推荐使用 conda 管理环境。3. Mini-ImageNet 数据集需手动从 Google Drive 下载并放入 datasets 文件夹，代码支持自动解压。4. Omniglot 数据集已包含在仓库中。5. 实验脚本支持断点续训（fault-tolerant），意外中断后可直接重跑脚本继续训练。","3.6",[106,107,108],"pytorch","conda","pbzip2",[13,54],null,"2026-03-27T02:49:30.150509","2026-04-06T07:05:49.796173",[114,119,124,129,134,139],{"id":115,"question_zh":116,"answer_zh":117,"source_url":118},12286,"为什么 MAML 和 MAML++ 的训练速度非常慢？","这通常是由于数据加载或配置问题导致的。维护者曾通过优化代码解决了该问题，建议用户尝试重新拉取最新代码运行。此外，确保使用 SSD 硬盘存储数据集也能显著提升读取速度。如果问题依旧，请检查是否使用了正确的配置文件以及学习率和批次大小等参数是否与原始论文一致。","https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fissues\u002F5",{"id":120,"question_zh":121,"answer_zh":122,"source_url":123},12287,"为什么无法复现 Mini-Imagenet 上 MAML++ 的准确率，甚至不如普通 MAML？","最常见的原因是混淆了配置文件。运行 MAML++ 模型时必须使用专门的 `maml++` 配置文件，而运行普通 MAML 时需使用 `maml` 配置文件。请检查启动脚本中引用的 JSON 配置文件是否正确（例如 `mini-imagenet_maml++-mini-imagenet_1_2_0.01_48_5_0.json`），错误的配置会导致性能大幅下降。","https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fissues\u002F47",{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},12288,"配置文件中的 `total_epochs_before_pause` 和 `first_order_to_second_order_epoch` 参数是什么意思？","`total_epochs_before_pause` 是一个控制程序运行多久后暂停退出的超参数，主要用于在计算资源受限的集群上将实验分块运行。`first_order_to_second_order_epoch` 用于加速训练（一阶近似），但在某些实验中关闭它（设为 -1）反而能更快收敛或不使用余弦退火策略，具体取决于实验设置和维护者复现论文结果时的特定需求。","https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fissues\u002F29",{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},12289,"为什么加载保存的模型后进行测试，得到的准确率与训练时打印的不一致且波动很大？","这通常是因为保存模型时未包含外部循环优化器（如 Adam）的状态，导致重新加载时梯度统计信息（running grads）被重置，从而影响训练连续性。虽然这在纯测试阶段不应发生，但如果遇到此问题，请确保更新到最新的代码提交，维护者已修复了权重重载和测试输出一致性的问题。如果问题仍存在，请检查是否正确加载了所有参数状态和训练历史。","https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fissues\u002F11",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},12290,"如何将代码转换为 Jupyter Notebook 以便在 Google Colab 上运行？","将现有的运行脚本转换为 Jupyter Notebook 格式非常简单，但仓库维护者目前没有时间提供官方版本。用户可以自行编写转换后的 Notebook 并提交 Pull Request 到仓库。此外，关于数据集，虽然 README 提到提供了 Omniglot 数据集，但实际文件夹中可能只有 JSON 描述文件，用户需要自行下载 Omniglot 原始数据并放置在 `datasets\u002Fomniglot` 目录下。","https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fissues\u002F13",{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},12291,"加载保存的参数后，损失函数值显著变差，直到重新训练几次才恢复，这是什么原因？","这种现象通常是因为保存模型时没有保存外部循环优化器（Outer Loop Optimizer，通常是 Adam）的状态。当实验重启时，优化器的动量和梯度统计信息被重新初始化，导致初始几步的性能下降。建议在保存模型时同时保存优化器的 `state_dict`，并在加载时恢复它，以确保训练状态的完全一致性。","https:\u002F\u002Fgithub.com\u002FAntreasAntoniou\u002FHowToTrainYourMAMLPytorch\u002Fissues\u002F9",[]]