开源版copilot搭建
众所周知,github 的 copilot 已经开始收费了,作为一个白嫖党,最近我调研了一下类似的产品。
Tabnine 算是比较好用的一个,当然 tabnine 同样需要付费才能获得最佳体验。那么有没有一种可能......有的有的:
参考 盘点开源“Copilot”,do it yourself , 搞了一套开源模型codegen-350M部署到本地服务器上,同时也重新捡起了深度学习这个坑。
使用docker compose 快速拉起一个API服务:
shell
version: "2.3"
services:
fastgpt-codegen:
container_name: fastgpt-codegen
image: lowinli98/fastgpt-codegen:v0.0.7
expose:
- 7104
ports:
- "7104:7104"
environment:
- PORT=7104
- GUNICORN_WORKER=1
- GUNICORN_THREADS=1
restart: always
测试一下:
```bash $ curl --location --request POST 'http://127.0.0.1:7104/generate_mono' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": "def calculdate_mean(x, y): \n", "parameters": { "do_sample": true } }'
[ { "generated_text": " \"\"\"\n Function calculates the mean value of a list of numbers\n\n " } ] ```
搭配定制的VScode插件 即可享受私有化的 copilot,当然肯定不能和 github copilot 这种商业化插件相比,同时大概我用的服务器是采用CPU计算推理的,速度比GPU还是差了不少,不过10刀/月和几乎白嫖对比,相信每个人有自己的选择。
不多说了起飞: