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

幻方發(fā)布全球最強(qiáng)MOE大模型! DeepSeek-V2

開發(fā) 前端
我們還提供與OpenAI兼容的API,可以在DeepSeek平臺(tái)上使用:platform.deepseek.com。注冊(cè)即可獲得數(shù)百萬免費(fèi)token。你也可以按使用量付費(fèi),享受無與倫比的價(jià)格。

1. 介紹

今天,我們介紹了DeepSeek-V2,這是一個(gè)強(qiáng)大的專家混合(MoE)語言模型,其特點(diǎn)是訓(xùn)練經(jīng)濟(jì)且推理高效。它總共包含236B個(gè)參數(shù),每個(gè)token激活21B個(gè)。與DeepSeek 67B相比,DeepSeek-V2實(shí)現(xiàn)了更強(qiáng)的性能,同時(shí)節(jié)省了42.5%的訓(xùn)練成本,減少了93.3%的KV緩存,并將最大生成吞吐量提高了5.76倍。

圖片圖片

圖片圖片

我們?cè)诎?.1萬億token的多樣化和高質(zhì)量語料庫上預(yù)訓(xùn)練了DeepSeek-V2。隨后,我們通過監(jiān)督式微調(diào)(SFT)和強(qiáng)化學(xué)習(xí)(RL)的過程來充分釋放模型的潛力。評(píng)估結(jié)果驗(yàn)證了我們方法的有效性,因?yàn)镈eepSeek-V2在標(biāo)準(zhǔn)基準(zhǔn)測(cè)試和開放式生成評(píng)估上都取得了顯著的性能。

2. 模型下載

由于HuggingFace的限制,當(dāng)前開源代碼在GPU上運(yùn)行時(shí)的性能比我們內(nèi)部代碼庫慢。為了促進(jìn)我們模型的有效執(zhí)行,我們提供了一個(gè)專門的vllm解決方案,該解決方案優(yōu)化了我們模型的運(yùn)行性能。

Model

Context Length

Download

DeepSeek-V2

128k

?? HuggingFace

DeepSeek-V2-Chat(RL)

128k

?? HuggingFace

3. 評(píng)估結(jié)果

基礎(chǔ)模型

Benchmark

Domain

LLaMA3 70B

Mixtral 8x22B

DeepSeek V1 (Dense-67B)

DeepSeek V2 (MoE-236B)

MMLU

English

78.9

77.6

71.3

78.5

BBH

English

81.0

78.9

68.7

78.9

C-Eval

Chinese

67.5

58.6

66.1

81.7

CMMLU

Chinese

69.3

60.0

70.8

84.0

HumanEval

Code

52.4

39.0

42.7

40.9

MBPP

Code

68.6

64.2

57.4

66.6

GSM8K

Math

83.0

80.3

63.4

79.2

Math

Math

42.2

42.5

18.7

43.6

在Needle In A Haystack (NIAH)測(cè)試中,DeepSeek-V2在所有上下文窗口長度上表現(xiàn)良好,直到128K。

圖片圖片

chat模型

我們?cè)贏lpacaEval 2.0和MTBench上評(píng)估了我們的模型,展示了DeepSeek-V2-Chat-RL在英語對(duì)話生成上的競(jìng)爭力。

Benchmark

Domain

QWen1.5 72B Chat

Mixtral 8x22B

LLaMA3 70B Instruct

DeepSeek V1 Chat (SFT)

DeepSeek V2 Chat(SFT)

DeepSeek V2 Chat(RL)

MMLU

English

76.2

77.8

80.3

71.1

78.4

77.8

BBH

English

65.9

78.4

80.1

71.7

81.3

79.7

C-Eval

Chinese

82.2

60.0

67.9

65.2

80.9

78.0

CMMLU

Chinese

82.9

61.0

70.7

67.8

82.4

81.6

HumanEval

Code

68.9

75.0

76.2

73.8

76.8

81.1

MBPP

Code

52.2

64.4

69.8

61.4

70.4

72.0

LiveCodeBench  (0901-0401)

Code

18.8

25.0

30.5

18.3

28.7

32.5

GSM8K

Math

81.9

87.9

93.2

84.1

90.8

92.2

Math

Math

40.6

49.8

48.5

32.6

52.7

53.9

圖片圖片

Chinese Open Ended Generation Evaluation

模型

開源/閉源

總分

中文推理

中文語言

gpt-4-1106-preview

閉源

8.01

7.73

8.29

DeepSeek-V2 Chat(RL)

開源

7.91

7.45

8.36

erniebot-4.0-202404(文心一言)

閉源

7.89

7.61

8.17

DeepSeek-V2 Chat(SFT)

開源

7.74

7.30

8.17

gpt-4-0613

閉源

7.53

7.47

7.59

erniebot-4.0-202312(文心一言)

閉源

7.36

6.84

7.88

moonshot-v1-32k-202404(月之暗面)

閉源

7.22

6.42

8.02

Qwen1.5-72B-Chat(通義千問)

開源

7.19

6.45

7.93

DeepSeek-67B-Chat

開源

6.43

5.75

7.11

Yi-34B-Chat(零一萬物)

開源

6.12

4.86

7.38

gpt-3.5-turbo-0613

閉源

6.08

5.35

6.71

編碼基準(zhǔn)測(cè)試

我們?cè)贚iveCodeBench (0901-0401)上評(píng)估了我們的模型,這是一個(gè)為實(shí)時(shí)編碼挑戰(zhàn)設(shè)計(jì)的基準(zhǔn)測(cè)試。如圖所示,DeepSeek-V2在LiveCodeBench上展示了相當(dāng)?shù)氖炀毘潭?,其Pass@1得分超過了其他幾個(gè)復(fù)雜的模型。這一性能突出了模型在處理實(shí)時(shí)編碼任務(wù)方面的有效性。

圖片圖片

4. 模型架構(gòu)

DeepSeek-V2采用創(chuàng)新的架構(gòu)以保證訓(xùn)練經(jīng)濟(jì)和推理高效:

  • 對(duì)于注意力機(jī)制,我們?cè)O(shè)計(jì)了IEAttn,它使用低秩鍵值聯(lián)合壓縮來消除推理時(shí)鍵值緩存的瓶頸,從而支持高效推理。
  • 對(duì)于前饋網(wǎng)絡(luò)(FFNs),我們采用了DeepSeekMoE架構(gòu),這是一種高性能的MoE架構(gòu),使我們能夠以更低的成本訓(xùn)練更強(qiáng)的模型。

圖片圖片

5. 聊天網(wǎng)站

你可以在DeepSeek的官方網(wǎng)站上與DeepSeek-V2進(jìn)行聊天:chat.deepseek.com

6. API平臺(tái)

我們還提供與OpenAI兼容的API,可以在DeepSeek平臺(tái)上使用:platform.deepseek.com。注冊(cè)即可獲得數(shù)百萬免費(fèi)token。你也可以按使用量付費(fèi),享受無與倫比的價(jià)格。

圖片圖片

7. 如何本地運(yùn)行

要使用BF16格式的DeepSeek-V2進(jìn)行推理,需要80GB*8的GPU。

使用Huggingface的Transformers進(jìn)行推理

你可以直接使用Huggingface的Transformers進(jìn)行模型推理。

文本補(bǔ)全

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig

model_name = "deepseek-ai/DeepSeek-V2"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
# `max_memory` 應(yīng)根據(jù)你的設(shè)備設(shè)置
max_memory = {i: "75GB" for i in range(8)}
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, device_map="auto", torch_dtype=torch.bfloat16, max_memory=max_memory)
model.generation_config = GenerationConfig.from_pretrained(model_name)
model.generation_config.pad_token_id = model.generation_config.eos_token_id

text = "An attention function can be described as mapping a query and a set of key-value pairs to an output, where the query, keys, values, and output are all vectors. The output is"
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)

result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(result)

聊天補(bǔ)全

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig

model_name = "deepseek-ai/DeepSeek-V2-Chat"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
# `max_memory` 應(yīng)根據(jù)你的設(shè)備設(shè)置
max_memory = {i: "75GB" for i in range(8)}
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, device_map="auto", torch_dtype=torch.bfloat16, max_memory=max_memory)
model.generation_config = GenerationConfig.from_pretrained(model_name)
model.generation_config.pad_token_id = model.generation_config.eos_token_id

messages = [
    {"role": "user", "content": "Write a piece of quicksort code in C++"}
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device), max_new_tokens=100)

result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=True)
print(result)

完整的聊天模板可以在huggingface模型倉庫中的tokenizer_config.json找到。

一個(gè)聊天模板的示例如下:

<|begin of sentence|>User: {user_message_1}

Assistant: {assistant_message_1}<|end of sentence|>User: {user_message_2}

Assistant:

你也可以添加一個(gè)可選的系統(tǒng)消息:

<|begin of sentence|>{system_message}

User: {user_message_1}

Assistant: {assistant_message_1}<|end of sentence|>User: {user_message_2}

Assistant:

8. 許可證

此代碼庫在MIT許可證下授權(quán)。DeepSeek-V2基礎(chǔ)/聊天模型的使用受模型許可證的約束。DeepSeek-V2系列(包括基礎(chǔ)和聊天)支持商業(yè)用途。

9. 引用

@misc{deepseek-v2,
  author = {DeepSeek-AI},
  title  = {DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model},
  year   = {2024},
  note   = {GitHub repository},
  url    = {https://github.com/deepseek-ai/deepseek-v2}
}

責(zé)任編輯:武曉燕 來源: 追逐時(shí)光者
相關(guān)推薦

2024-02-06 10:38:10

昆侖萬維大模型

2024-05-09 16:21:46

Deepseek技術(shù)算法

2025-03-26 09:00:00

AIDeepSeek軟件架構(gòu)

2024-12-27 11:13:16

2025-02-17 03:00:00

LLMsMoELLM

2024-05-06 07:58:23

MoE模型系統(tǒng)

2025-01-03 19:38:33

2024-12-30 20:32:36

2024-08-20 14:56:35

2025-02-25 11:35:36

2025-03-06 07:28:31

DeepSeek大模型人工智能

2023-11-01 13:06:52

2024-06-24 18:15:22

2024-10-23 08:24:13

2025-03-11 00:35:00

DeepSeektoC業(yè)務(wù)
點(diǎn)贊
收藏

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