窝牛号

Google发布开源Gemma LLM大语言模型,效果超越LIama-2

2024年必定是大语言模型争夺的元年,自从ChatGPT发布以来,很多AI大厂开始发力进军LLM大语言模型。虽然有些大语言模型也早早的发布,但是效果并不理想。且闭源的ChatGPT一直让大家无法去学习核心技术与超越。随着Meta开源LIama系列模型,让很多人眼前一亮。

而google发布的Gemini大语言模型,虽然使用比较简单,但毕竟是一个闭源的大模型。现在为了占据开源市场,Google发布了开源LLM大语言模型Gemma,其性能在多个数据集上超越LIama-2大模型。

Gemma是Google开源的第一个大语言模型,其有了Gemini大模型的经验,开源的Gemma大语言模型,其性能在很多数据集上面远远超越了LIama-2大模型。Gemma采用了Gemini 模型相同的研究和技术。 除了模型权重之外,Google还发布了工具来支持开发人员创新、使用 Gemma 模型。

Gemma模型发布了两种尺寸的模型权重:Gemma 2B 和 Gemma 7B。 每个尺寸都发布了经过预训练和指令微调的变体模型。新的 Responsible Generative AI 工具包为使用 Gemma 创建更安全的 AI 应用程序提供了详细的指导和使用工具。通过原生 Keras 3.0 提供跨所有主要框架的推理和监督微调 (SFT) :JAX、PyTorch 和 TensorFlow都可以使用此模型。最重要的是使用相关条款允许所有组织(无论规模大小)进行商业使用。

首次使用 Gemma 之前,必须通过 Kaggle 请求访问模型。在此过程中,必须使用 Kaggle 帐号来接受 Gemma 使用政策和许可条款。首先在kaggle上注册一个账号,注册完成后,右下方默认有一个Gemma大模型的使用说明,直接点击使用此模型即可。

进入Gemma大模型,点击右边的Request Access来接受模型的一些使用条款。

这里条款就可以不用看了,直接拉到网页最后,勾选同意使用即可,然后Gemma模型界面就可以看到你可以使用此模型了。

然后点击自己的头像,选择setting,就可以看到API的使用了,点击创建一个token,网页会自动下载一个json文件,里面是自己的用户名称与key。这里这个json文件是后期编程需要使用的。

得到API key后,输入如下代码,设置自己的用户名称与API key,安装相关的第三方库,就可以愉快的使用Gemma大语言模型了。

import os os.environ[&34;] = &39; os.environ[&34;] = &39; !pip install -q -U keras-nlp !pip install -q -U keras>=3 import keras import keras_nlp os.environ[&34;] = &34; 34;tensorflow&34;torch&34;gemma_2b_en&34;gemma_causal_lm_preprocessor& ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ gemma_tokenizer (GemmaTokenizer) │ 256,000 │ └────────────────────────────────────────────────────┴─────────────────────────────────────────────────────┘ Model: &34; ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Layer (type) ┃ Output Shape ┃ Param 34;What is the meaning of life?&34;How does the brain work?&34;What is the meaning of life?&34;How does the brain work?&39;What is the meaning of life?nnThe question is one of the most important questions in the world.nnIt’s the question that has been asked by philosophers, theologians, and scientists for centuries.nnAnd it’s the question that has been asked by people who are looking for answers to their own lives&39;How does the brain work?nnThe brain is the most complex organ in the human body. It is responsible for controlling all of the body’s functions, including breathing, heart rate, digestion, and more. The brain is also responsible for thinking, feeling, and making decisions.nnThe brain is made up']

开源大语言模型层出不穷,ChatGPT又该如何应对?

https://ai.google.dev/gemma/docs/get_started https://ai.google.dev/gemma/docs/setup?hl=zh-cn https://www.kaggle.com/ https://huggingface.co/google https://blog.google/technology/developers/gemma-open-models/

本站所发布的文字与图片素材为非商业目的改编或整理,版权归原作者所有,如侵权或涉及违法,请联系我们删除

窝牛号 wwww.93ysy.com   沪ICP备2021036305号-1