亚洲视频二区_亚洲欧洲日本天天堂在线观看_日韩一区二区在线观看_中文字幕不卡一区

公告:魔扣目錄網(wǎng)為廣大站長提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請(qǐng)做好本站友鏈:【 網(wǎng)站目錄:http://www.430618.com 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會(huì)員:747

明敏 發(fā)自 凹非寺

量子位 公眾號(hào) | QbitAI

專為AI而來的新語言Mojo,推理LLaMA2性能比Python/ target=_blank class=infotextkey>Python提升250倍

比C語言也要快上20%

上周五才開放下載,Mojo這么快就自證實(shí)力了。

要知道,之前官方號(hào)稱Mojo可以比Python快6.8萬倍。

而且作者表示,其實(shí)還有進(jìn)一步提升的空間。

這也展示了通過Mojo進(jìn)行硬件優(yōu)化的潛力。

OpenAI創(chuàng)始成員Karpathy已經(jīng)趕來圍觀了。

目前,LLaMA.mojo已開放下載~

幾行代碼即可下載

帶來這個(gè)版本的老哥是一位前Meta工程師Aydyn Tairov

他利用Mojo的SIMD(Single Instruction Multiple Data,單指令多數(shù)據(jù))和向量化原語,將llama2.py轉(zhuǎn)化為Mojo,性能較Python版本提升了近250倍

即便在快速運(yùn)行模式下,Mojo版本也比C語言版本性能提升15-20%

不過作者嘗試了在Mojo中使用并行模式,速度就慢了很多。

作者進(jìn)行性能比較的系統(tǒng)和硬件情況如下:

如果你也想下載運(yùn)行這個(gè)模型,需要先在環(huán)境中安裝配置Mojo(文檔鏈接見文末)。

首先將存儲(chǔ)庫保存到保存項(xiàng)目時(shí)的文件夾:

gitclone https://Github.com/tairov/llama2.mojo.git

然后打開存儲(chǔ)文件夾:

cdllama2.mojo

下面就可以下載模型:

wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin

然后即可運(yùn)行:

mojo llama2.mojo

num hardware threads: 6SIMD vector width: 8

checkpoint size: 60816028

<s>

Once upon a time, there was a little girl named Lily. She loved toplay outside inthe sunshine. One day, she saw a big, red ball inthe sky. It was the sun! She thought it was so pretty.

Lily wanted toplay withthe ball, but it was too high up inthe sky. She tried tojump andreach it, but she couldn't. Then, she had an idea. She would use a stick to knock the ball down.Lily found a stick and tried to hit the ball. But the stick was too short. She tried again and again, but she couldn't reach it. She felt sad.

Suddenly, a kind man came by andsaw Lily. He asked her what was wrong. Lily told him about the ball. The man smiled andsaid, "I have a useful idea!"He took out a long stick andused it toknock the ball down. Lily was so hAppy! She thanked the man andthey played together inthe sunshine.

<s>

Once upon a time, there was a little girl named Lily. She loved toplay outside inthe sunshine. One day, she saw a big, red

achieved tok/s: 264.24870466321244

為啥Mojo這么快?

不過話說回來,為啥Mojo的速度可以這么快?

這還得從Mojo的來歷說起。

它誕生于今年5月,專為AI領(lǐng)域開發(fā),由LLVM之父Swift之父Chris Lattner帶來。

它兼顧了Python和C++的優(yōu)點(diǎn),語法簡單、運(yùn)行快,而且可以和任何Python庫無縫交互。

自從上線以來,Mojo已經(jīng)吸引了12萬開發(fā)者,GitHub星標(biāo)達(dá)9K。

今年8月,Mojo背后公司Modular新獲1億美元融資,總?cè)谫Y金額達(dá)1.3億美元。

Mojo語言這么快的原因,可以歸結(jié)為4點(diǎn)。

第1步,通過類型注釋消除Python動(dòng)態(tài)類型的損失,并做代數(shù)簡化(algebraic simplifications),避免開方運(yùn)算以及簡化復(fù)數(shù)平方運(yùn)算,達(dá)到89倍加速。

第2步,通過向量化實(shí)現(xiàn)SIMD(單指令多數(shù)據(jù))的并行計(jì)算,并讓向量寬度以匹配CPU的FMA(浮點(diǎn)乘法累加單元)數(shù)量,達(dá)到874倍

第3步,把前兩步開發(fā)好的單線程實(shí)現(xiàn)改成多核并行化,對(duì)于88核的系統(tǒng)再獲得30倍加速,與原始Python相比已經(jīng)到了26000倍

第4步,解決并行化中的加載不均衡問題,讓線程從池中動(dòng)態(tài)獲取任務(wù),得到最終結(jié)果68000倍

幾天前,Mojo正式開放下載。目前支持linux系統(tǒng),后續(xù)將陸續(xù)添加mac和windows。

同時(shí)支持VSCode插件,可以實(shí)現(xiàn)語法高亮和代碼補(bǔ)全等功能。

以及也能像Python一樣在Jupyter里交互式操作。

感興趣的童鞋,可以去上手體驗(yàn)一下~

GitHub地址:

https://github.com/tairov/llama2.mojo

Mojo文檔:

https://docs.modular.com/mojo/manual/get-started/index.html

— 

分享到:
標(biāo)簽:Mojo
用戶無頭像

網(wǎng)友整理

注冊(cè)時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會(huì)員

趕快注冊(cè)賬號(hào),推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績?cè)u(píng)定2018-06-03

通用課目體育訓(xùn)練成績?cè)u(píng)定