ChatGPT聊天机器人

香港大学已经禁止学生使用,学生党还是要遵守相关规定。重要的事情,chatgpt就是一个聊天机器人,是聊天哈。

最开始了解ChatGPT居然是抖音上看到的,之前了解过GPT-3,最开始认为可能类似的语言模型,上手以后才发现,这玩意挺有意思,某些方面,比百度强,但是比人还差十万八千里,智力不好说,最起码现在能计算1+1=2,能解一元一次方程,可能更复杂的问题,比如leetcode的题,都是可以求解的(没试过,不清楚和搜索引擎上的答案差别多少)。

美国有一部电视剧,讲的就是一个强大的AI模型,可以预测未来发生的任何事情,阻止悲剧的发生,openai做的事情,感觉不仅仅是能成为一个强大的搜索引擎,他们的目标估计更远大。

预训练的大模型这些年特别火,从Bert开始,大模型能干的事情越来越多了,openai还是牛逼!

现在还有基于RL绘图的,有人演示一次性能出一批精美的文案(广告等等)。

国内也有,比如,百度,华为,智源的悟道等等。当然,我们都还在发展当中,有人不看好国内技术的发展,现在一提“自研”,免不了很多的酸酸的字眼。 现在研究上,这种级别的大模型,普通高校是做不了的,但是有人拿这个去解决自监督,无监督,多模态的问题,其实也是思路。

下面给大家演示一下怎么使用吧。

官方的路子。

去vscode弄一个ChatGPT的插件,有个中文的,现在很慢,你也可以用上面的账号,试一试理解代码和debug的功能,挺有意思的。这个目前是能用的。

必应。

具体能干嘛呢?

编辑

编辑

能做的事情很多。

我测试的有:

写一个用于ncnn的nms的代码

一堆废话了

下面是写的;虽然没写全,可能是网速的原因,但是写的还不错,当然,搜索引擎也是能够做到的,这个不算是很复杂的逻辑。

#include<algorithm>#include<vector>// Include the NCNN header#include"ncnn/net.h"// A struct representing a bounding boxstructBoundingBox{intx1, y1, x2, y2;floatscore;};// Compute the intersection-over-union (IOU) of two bounding boxesfloatiou(constBoundingBox& b1,constBoundingBox& b2){// Compute the coordinates of the intersection rectangleintx1 = std::max(b1.x1, b2.x1);inty1 = std::max(b1.y1, b2.y1);intx2 = std::min(b1.x2, b2.x2);inty2 = std::min(b1.y2, b2.y2);// Compute the area of the intersectionintw = std::max(0, x2 - x1 +1);inth = std::max(0, y2 - y1 +1);intintersection_area = w * h;// Compute the area of the unionintb1_area = (b1.x2 - b1.x1 +1) * (b1.y2 - b1.y1 +1);intb2_area = (b2.x2 - b2.x1 +1) * (b2.y2 - b2.y1 +1);intunion_area = b1_area + b2_area - intersection_area;// Return the IOUreturnintersection_area / union_area;}// Perform soft-NMS on a list of bounding boxes// with a given overlap threshold and a sigma valuevoidsoft_nms(std::vector& boxes,floatoverlap_threshold,floatsigma){// Sort the bounding boxes by their score in descending orderstd::sort(boxes.begin(), boxes.end(), [](constBoundingBox& b1,constBoundingBox& b2) {returnb1.score > b2.score;    });// Iterate through the bounding boxes in order of scorefor(inti =0; i < boxes.size(); i++) {// Skip boxes that have already been removedif(boxes[i].x1 ==-1)continue;// Iterate through the remaining bounding boxesfor(intj = i +1; j < boxes.size(); j++) {// Skip boxes that have already been removedif(boxes[j].x1 ==-1)continue;// Compute the IOU of the two bounding boxesfloatiou_val =iou(boxes[i], boxes[j]);// If

 一堆废话的过程

编辑

今天似乎不行了。😓

编辑

编辑

这种简单的代码写的很快,没仔细去和网上的对比,他这个注释,不知道是如何生成的,并且语言的表达如此的准确。

编辑

这玩意还能理解上下文信息。

编辑今天死活就不写代码了,估计英文会好使?

编辑

目前还不支持创造性方面,作为程序员也可以放心了,毕竟很多工作都是要理解业务场景才能写出来的。很少有人工作当中一直写冒泡吧。 

编辑

不得不承认,是一个好工具。 

当然,他也会格外的发挥,比如:

//

// Created by kanghaidong on 2022/12/10.

//

// Define a threshold for the minimum confidence score

// that a detection must have in order to be considered

const float threshold = 0.5;

// Loop over all the detections in the image

for (int i = 0; i < detections.size(); i++) {

// Get the confidence score for the current detection

float score = detections[i].score;

// If the score is less than the threshold, skip this detection

if (score < threshold) {

continue;

}

// Otherwise, keep this detection and suppress all other detections

// in its bounding box

for (int j = 0; j < detections.size(); j++) {

if (i == j) {

continue;

}

// Check if the bounding box of the current detection overlaps

// with the bounding box of the other detection

if (overlaps(detections[i].bbox, detections[j].bbox)) {

// If the other detection has a lower score, suppress it

if (detections[j].score < score) {

detections[j].score = 0;

}

}

}

}

// Define the overlap threshold for NMS

const float overlap_threshold = 0.5;

// Define the top-k parameter for NMS

const int top_k = 100;

// Perform NMS on the input data using the specified parameters

std::vector<int> indices;

ncnn::Mat::nms(bboxes, scores, indices, overlap_threshold, top_k);

// Create a neural network object

ncnn::Net ssdlite;

// Load the network parameters and weights from a trained SSD-Lite model

ssdlite.load_param("ssdlite.param");

ssdlite.load_model("ssdlite.bin");

// Define the input data for the network

ncnn::Mat in = ...;

// Run the network on the input data and get the output detections

ncnn::Mat out;

ssdlite.forward(in, out);

// Extract the bounding boxes and confidence scores from the output detections

std::vector<ncnn::Mat> bboxes;

std::vector<ncnn::Mat> scores;

extract_bboxes_and_scores(out, bboxes, scores);

// Perform NMS on the output detections using the specified parameters

std::vector<int> indices;

ncnn::Mat::nms(bboxes, scores, indices, overlap_threshold, top_k);

ncnn::Mat::nms is a method of the ncnn::Mat class in the ncnn library, which is a high-performance neural network inference framework for mobile platforms. The ncnn::Mat class represents a multi-dimensional matrix of data, and the ncnn::Mat::nms method performs non-maximum suppression (NMS) on a set of bounding boxes and confidence scores using the specified overlap threshold and top-k parameter.

The ncnn::Mat::nms method takes three arguments: the bounding boxes, the confidence scores, and a vector of indices representing the detections that were kept after NMS. The method applies NMS to the input data using the specified overlap threshold and top-k parameter, and returns the indices of the detections that were kept.

Here is an example of how you might use the ncnn::Mat::nms method:

// Define the overlap threshold for NMS

const float overlap_threshold = 0.5;

// Define the top-k parameter for NMS

const int top_k = 100;

// Perform NMS on the input data using the specified parameters

std::vector<int> indices;

ncnn::Mat::nms(bboxes, scores, indices, overlap_threshold, top_k);

实际上,Mat是不存在nms的。

你可以实现不同语言之间的转换,比如python2c++,但是正确性就不保证了。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容