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

推荐订阅源

人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
月光博客
月光博客
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
罗磊的独立博客
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
量子位
雷峰网
雷峰网
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队
博客园 - 聂微东
V
V2EX

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
Fine-tune LLaMA to speak like Homer Simpson – Replicate blog
2023-03-17 · via Replicate's blog

Yesterday we explained how to replicate Alpaca, a fine-tuned version of LLaMA that can follow instructions.

It was trained on a set of on instructions and answers to turn it into an assistant. It turns out you can replace that with a script from a TV show and it speaks in the voice of the characters from that TV show.

We were surprised about how easy this was. With a small amount of data (~60K lines of dialog) and 90 minutes of fine-tuning, you can make LLaMA output text in the voice of the dataset.

It makes a remarkably good Homer Simpson bot. Occasionally, it’s funny:

Marge Simpson: Where are the children?
Homer Simpson: I’ll tell you one thing, they’re not at Moe’s.
Marge Simpson: How was your day, Homie?
Homer Simpson: Oh, it was just lovely, Marge. First off, I got to sleep in till five A.M. Then I had a leisurely breakfast of malt liquor and pickled beets.
Marge Simpson: Doesn’t that give you a stomach ache?
Homer Simpson: Nah, I’ve got a cast-iron stomach. You should see me eat a ten pound ham.
Marge Simpson: What adventures did you get up to today, Homie?
Homer Simpson: I had a bit of a scare when I thought my pants were stuck in the toaster, but apart from that it’s been a quiet, uneventful day.

Here’s how we made it.

What we did

First, grab simpsons_script_lines.csv from The Simpsons dataset from Kaggle. This has the script for all Simpsons episodes up through Season 27.

We only pulled out the data for seasons 1-12, because they’re the good ones. The resulting dataset has 61k lines of dialog and 1.1M tokens.

We want to train LLaMA to reproduce the voice of the characters. LLaMA was originally designed to be a helpful assistant, and this task is a bit different.

To accomplish this, we generated a dataset for all scenes in the dataset consisting of previous lines in a given scene, the character with the next line, and that next line. Here’s an example:

Here’s a notebook which shows the parsing process.

Once we parsed these lines, we modified the training prompt and script from the existing Alpaca codebase so that the model is prompted to complete the line in the context of the scene.

Here’s the prompt:

From here on, it’s the same process as training Alpaca, which we covered in our blog post yesterday.

We made a few modifications to the training script, so after you’ve checked out the repository, you’ll need to switch to the homerbot branch:

Once you have a trained model, you can generate scripts with cog predict commands like so:

Next steps

Vanilla LLaMA and GPT-4 struggle to produce output that is in the voice of The Simpsons. Fine-tuning LLaMA to have the voice of a particular character was surprisingly fast and easy, and only possible because it’s open-source.

We’re going to be posting more guides to tinkering on open-source language models. Follow us on Twitter to follow along.

We can’t wait to see what you build, too. Join us in #llama on Discord to share what you’ve built.