4 篇文章带有标签 “DeepLearning.AI”

How Diffusion Models Work

How Diffusion Models Work

扩散模型如何工作

灵感来源于物理学,你可以想像一滴墨水滴入一杯水中,最初你确切地知道它落在哪里,但随着时间的推移,你看到到扩散到水中,直到消失。

神经网络真正应该思考的是在每个噪声级别,当你逐渐向图像添加噪声时:

  1. Bob the Sprite!: 如果是 Bob Sprite,你想让神经网络说那是 Bob Sprite,让 Bob 保持原样。
  2. Probable Bob: 如果可能是 Bob Sprite,你可能想让神经网络说你知道这里有些噪声,建议可能填写的详细信息,让它看起来就像 Bob Sprite。
  3. Well, Bob or Fred...: 如果它只是精灵的轮廓,你想建议可能的精灵的一般细节。
  4. No Idea: 如果看起来什么也不知道,建议提出什么是轮廓,让它看起来更像精灵。

它学会消除您添加的噪声。

"No Idea" 的噪声级别很重要,因为它是正态分布的,每一个像素的采样都来自于正态分布。正态分布也可以称为 Gaussian distribution 或 bell shaped curve

当你向神经网络请求一个新的精灵时:

  • 你可以从正态分布中采样噪声
  • 使用网络消除噪声获得全新的精灵

NN 试图完全预测每一步的噪声。实际上,这只是一个预测。您需要多个 step 才能获得高质量的精灵。

Building Systems with the ChatGPT API

Building Systems with the ChatGPT API

使用 ChatGPT API 构建系统

def get_completion(prompt, model="gpt-3.5-turbo"):
    messages = [{"role": "user", "content": prompt}]
    response = openai.ChatCompletion.create(
        model=model,
        messages=messages,
        temperature=0,
    )
    return response.choices[0].message["content"]
response = get_completion("What is the capital of France?")
print(response)
The capital of France is Paris.
response = get_completion("法国的首都是什么?")
print(response)
法国的首都是巴黎。

LangChain for LLM Application Development

LangChain for LLM Application Development

LangChain 是用于构建 LLM 应用程序的开源框架

LLM 应用程序开发的 LangChain

安装依赖包

pip install python-dotenv
pip install openai

ChatCompletion import os import openai from dotenv import load_dotenv, find_dotenv _ = load_dotenv(find_dotenv()) # read local .env file openai.api_key = os.environ['OPENAI_API_KEY'] def get_completion(prompt, model="gpt-3.5-turbo"): messages = [{"role": "user", "content": prompt}] response = openai.ChatCompletion.create( model=model, messages=messages, temperature=0, ) return response.choices[0].

ChatGPT Prompt Engineering for Developers

ChatGPT Prompt Engineering for Developers 由Isa Fulford(OpenAI)和Andrew Ng(DeepLearning.AI)教授的课程将描述 LLM 的工作原理,提供快速工程的最佳实践,并展示 LLM API 如何用于各种任务的应用程序。

面向开发人员的 ChatGPT 提示工程

  1. { "book_id": 2, "title": "The Secret Garden", "author": "Sophie Brown", "genre": "Children's Literature" }

{ "book_id": 3, "title": "The Last Hope", "author": "David Lee", "genre": "Science Fiction" } ```py prompt = f""" 生成三个虚构的书名及其作者和类型的列表。