惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
The Cloudflare Blog
IT之家
IT之家
雷峰网
雷峰网
小众软件
小众软件
博客园 - 叶小钗
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 【当耐特】
V
V2EX
博客园_首页
T
Tailwind CSS Blog

Replicate's blog

How to make remarkable videos with Seedance 2.0 – Replicate blog How to prompt Seedream 5.0 – Replicate blog Recraft V4: image generation with design taste – Replicate blog Run Isaac 0.1 on Replicate – Replicate blog Run FLUX.2 on Replicate – Replicate blog How to prompt Nano Banana Pro – Replicate blog Retro Diffusion's pixel art models are now on Replicate – Replicate blog Replicate is joining Cloudflare – Replicate blog Extract text from documents and images with Datalab Marker and OCR – Replicate blog How to prompt Veo 3.1 – Replicate blog IBM's Granite 4.0 is now on Replicate – Replicate blog Which image editing model should I use? – Replicate blog Introducing our new search API – Replicate blog Torch compile caching for inference speed – Replicate blog Announcing Replicate's remote MCP server – Replicate blog How to prompt Veo 3 with images – Replicate blog Open source video is back – Replicate blog Generate consistent characters – Replicate blog Bria is now on Replicate – Replicate blog How we optimized FLUX.1 Kontext [dev] – Replicate blog Compare AI video models – Replicate blog The FLUX.1 Kontext hackathon – Replicate blog How to prompt Veo 3 for the best results – Replicate blog Get the most from Google Veo 3 – Replicate blog FLUX.1 Kontext from the community – Replicate blog Use FLUX.1 Kontext to edit images with words – Replicate blog Generate incredible images with Google's Imagen 4 – Replicate blog Run OpenAI’s latest models on Replicate – Replicate blog NVIDIA H100 GPUs are here – Replicate blog Run 30,000+ LoRAs on Hugging Face with Replicate – Replicate blog
AutoCog — Generate Cog configuration with GPT-4 – Replica...
2023-04-19 · via Replicate's blog

https://github.com/andreasjansson/AutoCog/raw/main/assets/screen-recording.gif

Cog lets you create a Docker image from a machine learning repository with very little code. But wouldn’t it be better if you didn’t have to write any code? Enter AutoCog!

Inspired by tools like Auto-GPT and BabyAGI, AutoCog uses GPT-4 to not only write code, but to run and fix the code. The algorithm is roughly:

  1. Give AutoCog a machine learning repository
  2. Order the files in the repository based on how important they are to Cog
  3. Pass as many of them as the GPT-4 context window allows into GPT-4
  4. Tell GPT-4 to create a cog.yaml and predict.py file based on the files in the repository
  5. Create a cog predict shell command to run a prediction based on the generated files
  6. Run the cog predict command
  7. If it fails, diagnose the error and try to fix either cog.yaml, predict.py, or the cog predict command. Repeat from the previous step up to five times.

Human in the loop

AutoCog is pretty magical when it works. But a lot of the times it doesn’t. Sometimes it doesn’t know the exact Python package versions, and sometimes it just goes down a bad path that makes things worse at every attempt.

In those cases, you might just want to hit Ctrl-C and fix it yourself. Luckily your fix doesn’t have to be perfect either, since AutoCog has a --continue flag that picks up where you left off. Most of the time, a gentle nudge from a human is all that’s needed to help AutoCog reach a working solution.

Programming the programmer

AutoCog itself was written by a human, me. Writing a tool like this is like being a micromanager for a technically excellent programmer with poor judgement. After a while you develop empathy for GPT-4, and you break up the task into smaller subtasks that GPT-4 has a chance of achieving.

The subtasks are comprised of a prompt and some code to parse the output. For example, the prompt to order the Python files in the directory is:

The reason we order the paths before we send them to GPT-4 is the length of the context window. A repository often has more Python code than the 8096 tokens GPT-4 accepts, so AutoCog truncates the input files it passes them to GPT-4.

The limited context window is one of the main hurdles when writing a tool like AutoCog. The prompts need to be constructed in a way that includes as much information as possible, without going over the limit.

Try it yourself

You can run AutoCog on your own project by installing AutoCog from PyPI. There is more documentation on how to use it on the GitHub README at andreasjansson/AutoCog.