自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

效果秒殺同類模型,HuggingFace發(fā)布手機上能跑的SmolLM

人工智能
SmolLM系列包括三個成員,它們分別擁有1.35億、3.6億和17億參數(shù)量,它們被設(shè)計來滿足不同層次的計算需求。盡管這些模型體積輕巧,但在常識推理和世界知識基準測試中卻展現(xiàn)出了卓越的性能。

Hugging Face最近推出了一套精巧的緊湊型語言模型——SmolLM,它們在性能上已經(jīng)超越了微軟、Meta和阿里巴巴的千問系列等競爭對手。這些新晉模型不僅為個人設(shè)備帶來了尖端的AI功能,并不耗費過多的設(shè)備性能,更能保護用戶隱私。

SmolLM系列包括三個成員,它們分別擁有1.35億、3.6億和17億參數(shù)量,它們被設(shè)計來滿足不同層次的計算需求。盡管這些模型體積輕巧,但在常識推理和世界知識基準測試中卻展現(xiàn)出了卓越的性能。

特別值得一提的是,即使是體積最小的SmolLM-135M,在訓練中使用的token數(shù)量較少的情況下,其性能也超過了Meta的MobileLM-125M。而SmolLM-360M則宣稱,在所有低于5億參數(shù)的模型中,它的性能是最牛的,包括Meta和阿里巴巴的千問系列產(chǎn)品。至于旗艦?zāi)P蚐molLM-1.7B,則在多個基準測試中戰(zhàn)勝了微軟的Phi-1.5、Meta的MobileLM-1.5B以及千問Qwen2-1.5B,確立了其在高端AI模型中的領(lǐng)先地位。

SmolLM的發(fā)布也有望對AI的可及性及用戶隱私產(chǎn)生重大影響。這些模型完全可以在手機及筆記本電腦等個人設(shè)備上運行,因此消除了云計算需求,同時緩解了成本與隱私問題。希望有更多類似模型推出哦!??!

下面我們將介紹系列模型的一些細節(jié)。

各方發(fā)言

Hugging Face公司SmolLM項目首席機器學習工程師Ben Allal在采訪時解釋道:“通過SmolLM的現(xiàn)實性能,我們證明數(shù)據(jù)質(zhì)量是決定模型水平的關(guān)鍵因素。我們開發(fā)出的創(chuàng)新方法能夠精心策劃高質(zhì)量數(shù)據(jù),將網(wǎng)絡(luò)來源與合成數(shù)據(jù)相結(jié)合,從而建立起性能最佳小模型。”

Hugging Face研究團隊負責人Leandro von Werra在采訪時還特別強調(diào)了SmolLM的實際意義?!斑@些緊湊型模型為開發(fā)人員和最終用戶打開了一個充滿可能性的世界。從個性化自動補全功能到解析復雜的用戶請求,SmolLM無需昂貴的GPU或者云基礎(chǔ)設(shè)施即可支撐起自定義AI應(yīng)用程序。無論是降低AI的訪問門檻、還是為每個人提供隱私保護,SmolLM的出現(xiàn)都代表著邁向未來的重要一步?!?/p>

隨著SmolLM模型家族、數(shù)據(jù)集以及訓練代碼的正式亮相,全球AI社區(qū)及開發(fā)人員現(xiàn)在已經(jīng)可以探索、改進并構(gòu)建這種創(chuàng)新的語言模型方法。正如Ben Allal在采訪中做出的總結(jié):“希望更多人參與進來,幫助SmolLM更上一層樓!”

佩服HF的開放精神,方法全開源,點贊。

數(shù)據(jù)集介紹

這些模型的出色表現(xiàn),離不開精心策劃的訓練數(shù)據(jù),也是本文最大的創(chuàng)新點。

Smollm Corpus 數(shù)據(jù)集:

  • Cosmopedia v2: 由Mixtral 生成的包含38B tokens的合成教材和故事內(nèi)容的
  • Python-Edu: Stack 上的教育性Python示例(4B tokens)
  • FineWeb-Edu (deduplicated): FineWeb 上的精選教育性網(wǎng)絡(luò)內(nèi)容(220B tokens)

訓練數(shù)據(jù)量:

SmolLM模型有三個不同尺寸,它們分別在不同量級的混合數(shù)據(jù)上訓練得到:

  • 135M and 360M models, 在Smollm-Corpus數(shù)據(jù)集中選擇了600B tokens的訓練數(shù)據(jù);
  • 1.7B model, 在Smollm-Corpus數(shù)據(jù)集中選擇了1T的訓練數(shù)據(jù)。

數(shù)據(jù)分布圖:

圖片圖片

指令微調(diào)數(shù)據(jù)集:StarCoder2-Self-OSS-Instruct

dpo數(shù)據(jù)集:

  • 集中135M和1.7B模型使用的是HelpSteer數(shù)據(jù)集;
  • 360M的模型,使用的是argilla/dpo-mix-7k;

    都只訓練了一個epoch。

表現(xiàn)介紹

在大多數(shù)任務(wù)以及平均得分上,在相同尺寸的模型上取得了state-of-the-art的成績,但是并沒有在所有測試集上都最好。

圖片圖片

模型結(jié)構(gòu)

參數(shù)配置

自注意力的是GQA分組查詢注意力,模型具體配置如下:

圖片圖片

顯存占用

下面是模型占用顯存的小,官方已經(jīng)給出了量化版的onnx權(quán)重:

圖片圖片

支持長度:這幾款模型支持的長度都是2048個token(通過微調(diào)后,可以支持更長)

Tokenizer:在Smollm Corpus上訓練得到,詞表大小為49152.

跑起來

官方給的推理代碼(有些小問題需要自己改一下)

# pip install transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
checkpoint = "HuggingFaceTB/SmolLM-1.7B-Instruct"


device = "cuda" # for GPU usage or "cpu" for CPU usage
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
# for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)


messages = [{"role": "user", "content": "List the steps to bake a chocolate cake from scratch."}]
input_text=tokenizer.apply_chat_template(messages, tokenize=False)
print(input_text)
inputs = tokenizer.encode(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(inputs, max_new_tokens=100, temperature=0.6, top_p=0.92, do_sample=True)
print(tokenizer.decode(outputs[0]))

測試小例子

chat("hello")
# The statement is false. 


chat("1+1=")
# The equation 1+1=1 is true, but the equation 1+1=2 is false. This is because the statement "1+1=1" is a tautology, meaning that it is always true regardless of the values of its variables. However, the statement "1+1=2" is a contradiction, meaning that it is false if and only if both 1 and 1 are true. Since 1 is true, the statement "1+1

官方例子

chat("List the steps to bake a chocolate cake from scratch.")
# result
To bake a chocolate cake from scratch, follow these steps:


1. Gather ingredients:
   - 2 cups all-purpose flour
   - 1 cup unsweetened cocoa powder
   - 2 teaspoons baking soda
   - 1 teaspoon salt
   - 2 cups granulated sugar
   - 2 large eggs
   - 1 cup whole milk
   - 1/2 cup vegetable oil
   - 2 teaspoons vanilla extract


2. Preheat the oven to 350°F (175°C).


3. Combine dry ingredients:
   - In a large bowl, whisk together flour, cocoa powder, baking soda, and salt.


4. Mix wet ingredients:
   - In another bowl, beat sugar, eggs, milk, oil, and vanilla until well combined.


5. Combine wet and dry mixtures:
   - Gradually add the wet mixture to the dry ingredients, stirring until just combined.


6. Pour batter into a greased 9-inch round cake pan.


7. Bake for 30-35 minutes, or until a toothpick inserted into the center comes out clean.


8. Allow the cake to cool in the pan for 10 minutes, then transfer it to a wire rack to cool completely.


Note: The original answer provided a list of ingredients and a step-by-step process, but it lacked a clear explanation of the steps and the reasoning behind them. The revised answer provides a more detailed and coherent explanation of the baking process.

這個模型實測起來,除了官方例子,表現(xiàn)并不像說的那么好,感覺像個傻子一樣,難道是我的姿勢不對嗎。真像說的那樣Bad Baseline Is All You Need嗎。希望大家都卷起來,這個開源項目數(shù)據(jù)處理部分有很大的參考意義,感興趣的可以關(guān)注一下:

# 博客地址
https://huggingface.co/blog/smollm
# 無法訪問的可以訪問下面的地址
https://hf-mirror.com/blog/smollm

由于各種原因huggingface不容易訪問了,還好有個鏡像https://hf-mirror.com可以使用。

如果對內(nèi)容有什么疑問和建議可以私信和留言,也可以添加我加入大模型交流群,一起討論大模型在創(chuàng)作、RAG和agent中的應(yīng)用。

責任編輯:武曉燕 來源: 哎呀AIYA
相關(guān)推薦

2023-12-13 12:55:39

模型數(shù)據(jù)

2024-05-17 17:16:50

SOTA視覺模型

2023-03-28 15:48:39

開源模型

2023-06-08 11:06:17

OpenAITigerBot

2024-05-10 13:53:25

人工智能AI大模型

2025-04-24 08:52:34

2011-10-21 10:26:51

Howdy明信片

2012-03-07 13:32:38

2021-04-21 10:22:56

Python 開發(fā)編程語言

2023-05-16 13:54:00

模型AI

2011-03-30 13:56:06

2014-05-16 14:18:08

OONE手機隱私

2021-03-24 20:30:15

AndroidPython學習

2011-09-15 16:09:13

Meexo游戲式約會在線約會

2017-07-24 14:18:16

Windows XPWindows手機上網(wǎng)

2020-09-05 16:35:20

AndroidPython軟件開發(fā)

2012-03-14 10:04:49

手機瀏覽器海豚瀏覽器

2021-03-09 15:17:14

AndroidiCloud賬戶
點贊
收藏

51CTO技術(shù)棧公眾號