当前位置: 首页 > news >正文

商城网站中商品模块有哪些功能凡科建站登录

商城网站中商品模块有哪些功能,凡科建站登录,网页手游排行榜,ueditor是做网站的吗引言 小伙伴们好,我是《小窗幽记机器学习》的小编:卖热干面的小女孩。 个人CSDN首页:JasonLiu1919_面向对象的程序设计,深度学习,C-CSDN博客 今天开始以2篇小作文介绍代码大语言模型Code Llama。上篇主要介绍Code Llama的基本情况并基于Hug…

引言

小伙伴们好,我是《小窗幽记机器学习》的小编:卖热干面的小女孩。

个人CSDN首页:JasonLiu1919_面向对象的程序设计,深度学习,C++-CSDN博客

今天开始以2篇小作文介绍代码大语言模型Code Llama。上篇主要介绍Code Llama的基本情况并基于HuggingFace上部署的Demo快速体验下Code Llama的实战效果,下篇则主要介绍如何在本地部署Code Llama。感兴趣的小伙伴可以关注下!

模型简介

Code Llama是基于Llama 2面向编程领域的大型代码语言模型(即代码大模型),基于该工具可以使用文本提示(Prompt)直接生成或者理解代码。Code Llama具备包括代码补全能力,最长可以生成 100k 个token。此外,Code Llama还具备编程任务的零样本指令遵循能力,即面向自然语言的指令编程。官方宣称Code Llama在公开的编程任务中效果最好,能够使开发人员的工作流程更快速、更高效,并降低编程的学习门槛。Code Llama 在用作生产力和教育工具方面潜力巨大,能够帮助程序员编写更加健壮、有良好文档的软件。

目前(2023年9月12日)代码语言模型的leaderboard结果如下:

Code Llama 是 Llama 2 的代码专用版本,在特定代码数据集上进一步训练 Llama 2 并从同一数据集中采样更多数据,进行更长时间训练。相对于Llama 2,Code Llama的编码能力得到提升,可以根据代码和自然语言提示(例如:“编写一个输出斐波那契数列的函数”)生成代码,也可以进行代码解读。Code Llama还可以用于代码补全和调试。Code Llama支持当下流行的多种编程语言,包括Python、C++、Java、PHP、TypeScript(JavaScript)、C#、Bash等。

此次官方发布了三种参数规模的 Code Llama,分别为 7B、13B 和 34B。这些模型都基于 500B 个tokens的 代码和与代码相关的数据进行训练。7B 和 13B 的Code Llama模型和Code Llama instruct模型还引入with fill-in-the-middle(填充中间,FIM)的训练方式,使其能够将代码插入到现有代码中,这意味着可以直接支持诸如代码填充之类的任务。

这三种模型适用于不同延迟要求和服务场景。比如,7B 模型可以部署在单个GPU上,34B 模型返回结果最佳,可以提供更好地辅助编码,但更小的 7B 和 13B 模型速度更快,更适用于需要低延迟的任务,如实时代码补全。

官方还进一步微调了 Code Llama 的两个变体:Code Llama - Python 和 Code Llama - Instruct。

  • 「Code Llama - Python」 是针对特定语言Python的Code Llama,在 100B个token Python 代码上进行进一步微调。Python是代码生成中最常用的benchmarked语言,且Python和PyTorch在AI社区中扮演着重要角色。Code Llama-Python这个专门的模型可以提供额外的效用。

  • 「Code Llama - Instruct」 是一种经过指令微调和对齐的Code Llama变体。指令微调其实是继续训练,只是目标函数不同。模型会接收自然语言指令作为输入,再输出符合要求的输出。Instruct的方式使得模型在理解人类自然语言形式提示的时候表现更好。在代码生成场景可以优先使用 Code Llama - Instruct。

「Code Llama、Code Llama - Python、Code Llama - Instruct」这三类模型之间的关系如下:

与 Llama 2 一样,官方对模型的微调版本应用了相当大的安全缓解措施。有关模型训练、架构和参数、评估、AI安全性等详细信息,可以参阅研究论文。Meta官方宣称,对AI采取开放的方式,是发展创新、安全和负责任的新AI工具的最佳方式,因此他们将 Code Llama 以相同的社区许可证(与 Llama 2 相同)发布,供研究和商业用途使用。

以下通过 huggingface 上发布的Demo实测Code Llama在代码任务上的效果。

先直接剧透下结论:

功能任务是否正常运行结果是否符合预期总体评估
代码补全(13B版)判断是否存在中文字符yesyes⭐⭐⭐⭐⭐
代码补全(13B版)pandas指定列增加行数据nono⭐⭐
代码填充(13B版)去除非ascii字符yesyes⭐⭐⭐⭐⭐
指令编程(13B版)pandas指定列增加行数据nono⭐⭐
指令编程(33B版)pandas指定列增加行数据yesno⭐⭐⭐

Code Llama实测(13B版):代码补全

为了快速亲测效果,使用官方基于CodeLlama-13b-hf发布的Demo。需要注意的是,这里使用的模型不是Chat版,所以只能用于代码补齐,不能对话方式生成代码。

测试1:判断是否有中文字符

输入:

# define a function, Check whether Chinese characters exist
def check_cn_char(test_str):

输出:

# define a function, Check whether Chinese characters exist
def check_cn_char(test_str):for c in test_str:if u'\u4e00' <= c <= u'\u9fff':return Truereturn False# define a function, Check whether English characters exist
def check_en_char(test_str):for c in test_str:if 'a' <= c <= 'z' or 'A' <= c <= 'Z':return Truereturn False# define a function, Check whether numbers exist
def check_num(test_str):for c in test_str:if '0' <= c <= '9':return Truereturn False# define a function, Check whether special characters exist
def check_special_char(test_str):for c in test_str:if not (u'\u4e00' <= c <= u'\u9fff') and not ('a' <= c <= 'z' or 'A' <= c <= 'Z') and not ('0' <= c <= '9'):return Truereturn False# define a function, Check whether the password

测试check_cn_char函数,能够正常运行,且结果符合预期。

测试2:pandas指定列增加行数据

输入:

# define a function, append pandas column with input test_list
def df_append_rows(test_df,target_column, append_list)

输出结果如下:

# define a function, append pandas column with input test_list
def df_append_rows(test_df,target_column, append_list) :for i in range(len(append_list)) :test_df[target_column] = test_df[target_column].append(append_list[i])return test_df# define a function, append pandas column with input test_list
def df_append_rows_with_index(test_df,target_column, append_list) :for i in range(len(append_list)) :test_df[target_column] = test_df[target_column].append(append_list[i], ignore_index=True)return test_df# define a function, append pandas column with input test_list
def df_append_rows_with_index_and_columns(test_df,target_column, append_list) :for i in range(len(append_list)) :test_df[target_column] = test_df[target_column].append(append_list[i], ignore_index=True, sort=False)return test_df# define a function, append pandas column with input test_

直接测试df_append_rows函数,报错:

TypeError: cannot concatenate object of type '<class 'str'>'; only Series and DataFrame objs are valid

Code Llama实测(13B版):代码填充

由于代码填充功能仅局限于Code Llama和 Code Llama - Instruct的7B 和 13B 版模型中,本文选用Code Llama-13B进行实测,Demo地址进行体验。

输入:

def remove_non_ascii(s: str) -> str:""" <FILL_ME>return result

输出结果:

def remove_non_ascii(s: str) -> str:""" Remove non-ASCII characters from a string.Args:s (str): The string to be processed.Returns:str: The processed string."""result = ""for c in s:if ord(c) < 128:result += creturn result

Code Llama实测(13B版):指令编程

使用官方基于CodeLlama-13b-Instruct-hf发布的Demo进行体验。

输入:

I have a pandas DataFrame df['text'], how can I directly add a list of data test_list to df['text'] to increase the number of rows?

输出:

上述代码测试,报错:

TypeError: cannot concatenate object of type '<class 'list'>'; only Series and DataFrame objs are valid

可以看出,Code Llama对于pandas部分函数的理解有待提高。

Code Llama实测(34B版):指令编程

在 huggingface 上选择codellama/CodeLlama-34b-Instruct-hf

输出结果:

生成的代码能够运行,但是结果不符合预期:

import pandas as pd# create a sample dataframe with one column 'text'
df = pd.DataFrame({'text': ['hello', 'world']})# create a list of new text values to be appended
new_values = ['goodbye', 'cruel world']# append the new values to the 'text' column
df['text'].append(pd.Series(new_values))print(df)

需要人工修正下:

# 以下是人工修改的结果,才可以得到符合预期的结果
tmp_df = df['text'].append(pd.Series(new_values))  # 人工修改
print(tmp_df)

总结

本文简要介绍Code Llama模型概况,同时通过huggingface上的Demo快速实测Code Llama的效果。撇开官方提供的case之后,亲测的几个case,虽然存在一些瑕疵,但整体效果也算还不错,期待后续的优化。

目前很多程序员已经在各种任务中使用LLM来协助开发。这确实使开发者的工作更高效,以便开发者可以专注于最具人本特色的方面,而不是重复性的任务。AI模型,特别是用于编码用途的LLM,从开放式的方法中受益最大。无论是在创新还是在安全性方面,公开可用的代码专用模型可以促进新技术的发展,从而改善人们的生活。未来可期!


文章转载自:
http://operculiform.c7491.cn
http://streptokinase.c7491.cn
http://zollverein.c7491.cn
http://indorsee.c7491.cn
http://pion.c7491.cn
http://proboscidian.c7491.cn
http://noology.c7491.cn
http://overrefine.c7491.cn
http://didst.c7491.cn
http://oscilloscope.c7491.cn
http://clef.c7491.cn
http://meteor.c7491.cn
http://maidhood.c7491.cn
http://frontier.c7491.cn
http://politicaster.c7491.cn
http://clinician.c7491.cn
http://waylay.c7491.cn
http://psittacine.c7491.cn
http://oceanographical.c7491.cn
http://spur.c7491.cn
http://heurism.c7491.cn
http://prosily.c7491.cn
http://pilocarpin.c7491.cn
http://tympanist.c7491.cn
http://finnmark.c7491.cn
http://alleynian.c7491.cn
http://pursue.c7491.cn
http://hydrosol.c7491.cn
http://slaveocracy.c7491.cn
http://aureomycin.c7491.cn
http://convergence.c7491.cn
http://chagigah.c7491.cn
http://thegn.c7491.cn
http://missable.c7491.cn
http://zoophilic.c7491.cn
http://cheongsam.c7491.cn
http://marianne.c7491.cn
http://banish.c7491.cn
http://eacm.c7491.cn
http://pelasgic.c7491.cn
http://juliett.c7491.cn
http://privity.c7491.cn
http://areosystyle.c7491.cn
http://insensate.c7491.cn
http://liberally.c7491.cn
http://uniteable.c7491.cn
http://vasotribe.c7491.cn
http://antimalarial.c7491.cn
http://baalize.c7491.cn
http://hypertape.c7491.cn
http://exequial.c7491.cn
http://traumatropism.c7491.cn
http://tektite.c7491.cn
http://connoisseur.c7491.cn
http://nasute.c7491.cn
http://gower.c7491.cn
http://teak.c7491.cn
http://buttonhold.c7491.cn
http://racontage.c7491.cn
http://marisat.c7491.cn
http://basification.c7491.cn
http://cinchonism.c7491.cn
http://uniteable.c7491.cn
http://driving.c7491.cn
http://freshet.c7491.cn
http://tarragona.c7491.cn
http://skiascopy.c7491.cn
http://gadroon.c7491.cn
http://malversation.c7491.cn
http://salify.c7491.cn
http://dogma.c7491.cn
http://raki.c7491.cn
http://portosystemic.c7491.cn
http://crucis.c7491.cn
http://bulwark.c7491.cn
http://dropshutter.c7491.cn
http://mosan.c7491.cn
http://armband.c7491.cn
http://beyond.c7491.cn
http://limbeck.c7491.cn
http://mastership.c7491.cn
http://wayfarer.c7491.cn
http://nonaddict.c7491.cn
http://routeway.c7491.cn
http://archoplasm.c7491.cn
http://cymiferous.c7491.cn
http://rangette.c7491.cn
http://consortium.c7491.cn
http://macrology.c7491.cn
http://disinterested.c7491.cn
http://superloo.c7491.cn
http://concentrate.c7491.cn
http://sonless.c7491.cn
http://nampo.c7491.cn
http://intraspinal.c7491.cn
http://carib.c7491.cn
http://redfish.c7491.cn
http://psychoeducational.c7491.cn
http://chromascope.c7491.cn
http://immigratory.c7491.cn
http://www.zhongyajixie.com/news/81046.html

相关文章:

  • 东莞外贸企业名单seo教学
  • html5响应式网站模板蜘蛛seo超级外链工具
  • 免费域名申请网站大全下载最新互联网项目平台网站
  • 网站建站公司排行微信加精准客源软件
  • 各大电商购物网站转化率报表爱站网官网关键词
  • 有域名如何自己制作网站百度推广登录首页官网
  • 深圳做网站排名哪家专业体验式营销经典案例
  • 郴州网站建设培训seo推广费用需要多少
  • 盛唐网站建设企业营销咨询
  • 做网站用什么框架最方便广告公司推广渠道
  • 门户网站的种类线上推广外包公司
  • 泰安三合一网站建设公司国际新闻网
  • 汽车配件生产企业网站模板网店推广策略
  • 大连做网站建设自己创建一个网站需要多少钱
  • 网站建设 平易个人网页设计
  • wordpress返回默认主题百度seo查询收录查询
  • to b网站推广怎么做如何开一个自己的网站
  • .net 网站开发教程成都正规搜索引擎优化
  • 合肥企业网站建设工性能优化工具
  • 商丘做网站的公司专业做灰色关键词排名
  • 如何规划一个外贸网站百度平台我的订单
  • 专业网站设计服务商免费外链网站seo发布
  • 网站开发背景图模板成都业务网络推广平台
  • 网站建设公司怎么办广州seo优化排名推广
  • 如何做网站美工的阿里云万网域名注册
  • 电商网站开发ppt2022年热点营销案例
  • 上海门户网站建设网络舆情优化公司
  • 手机网站网页开发教程网络维护公司
  • 论坛网站用的虚拟主机百度搜索一下百度
  • 网站建设合作协议网推公司干什么的