Introducing DeepSeek LLM, an advanced language model comprising 7 billion parameters. It has been trained from scratch on a vast dataset of 2 trillion tokens in both English and Chinese. In order to foster research, we have made DeepSeek LLM 7B/67B Base and DeepSeek LLM 7B/67B Chat open source for the research community.
Here give some examples of how to use our model.
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
3
4model_name = "deepseek-ai/deepseek-llm-7b-base"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, device_map="auto")
7model.generation_config = GenerationConfig.from_pretrained(model_name)
8model.generation_config.pad_token_id = model.generation_config.eos_token_id
9
10text = "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"
11inputs = tokenizer(text, return_tensors="pt")
12outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)
13
14result = tokenizer.decode(outputs[0], skip_special_tokens=True)
15print(result)
This code repository is licensed under the MIT License. The use of DeepSeek LLM models is subject to the Model License. DeepSeek LLM supports commercial use.
If you have any questions, please raise an issue or contact us at
service@deepseek.com.