前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >AI写代码修Bug画画写诗,ChatGPT&DALLE2试用攻略

AI写代码修Bug画画写诗,ChatGPT&DALLE2试用攻略

作者头像
枫桦
发布2022-12-17 17:00:43
8920
发布2022-12-17 17:00:43
举报
文章被收录于专栏:AI算法札记AI算法札记

ChatGPT简介

ChatGPT&DALLE2是OpenAI的最新研究成果,在量子位看到他的强大功能后,就自己试玩了一下,比如我让ChatGPT帮我写一个GraphSage模型,ChatGPT先简单解释了一下GraphSage,然后写出了不错的PyTorch代码 (详见见示例一),是不是很神奇?

【最近业余时间都看世界杯了,容我水一篇】

ChatGPT&DALLE2试用攻略

在我将量子位的公众号文章转发朋友圈之后,很多人遇到了怎么注册的问题,China是不允许注册的,注册过程需要手机号,一种简单的方式是找国外的同学/朋友借,另一种是直接淘宝买,只有几块钱。直接登陆,在下图输入框输入你想让他做的事,点击右侧小三角(DALLE2是Generate按钮)即可。

示例一 写代码

写东西需要用ChatGPT,网址https://chat.openai.com/

代码语言:javascript
复制
import torch
import torch.nn as nn

class GraphSAGE(nn.Module):
    def __init__(self, input_dim, hidden_dim, output_dim, num_samples):
        super(GraphSAGE, self).__init__()
        self.input_dim = input_dim
        self.hidden_dim = hidden_dim
        self.output_dim = output_dim
        self.num_samples = num_samples

        self.embedding = nn.Embedding(input_dim, hidden_dim)
        self.aggregator = nn.Linear(hidden_dim * num_samples, hidden_dim)
        self.classifier = nn.Linear(hidden_dim, output_dim)

    def forward(self, nodes, neighbors):
        # Extract node embeddings
        node_embeddings = self.embedding(nodes)

        # Sample and aggregate neighbor embeddings
        neighbor_embeddings = [self.embedding(neighbors[:, i])
                               for i in range(self.num_samples)]
        neighbor_embeddings = torch.cat(neighbor_embeddings, dim=1)
        aggregated_neighbors = self.aggregator(neighbor_embeddings)

        # Combine node and aggregated neighbor embeddings
        combined = torch.cat([node_embeddings, aggregated_neighbors], dim=1)

        # Predict node labels
        return self.classifier(combined)

示例二 写诗

示例三 画画

画画需要用DALLE2,网址https://labs.openai.com/

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2022-12-02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 AI算法札记 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • ChatGPT&DALLE2试用攻略
  • 示例一 写代码
  • 示例三 画画
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档