mirror of
https://github.com/deepseek-ai/DeepSeek-Coder
synced 2024-12-04 18:14:44 +00:00
Update README.md
This commit is contained in:
parent
db4ada222f
commit
93b1420ee9
@ -74,7 +74,7 @@ Here are some examples of how to use our model.
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
import torch
|
||||
tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True)
|
||||
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True).cuda()
|
||||
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True, torch_dtype=torch.bfloat16).cuda()
|
||||
input_text = "#write a quick sort algorithm"
|
||||
inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
|
||||
outputs = model.generate(**inputs, max_length=128)
|
||||
@ -101,7 +101,7 @@ def quick_sort(arr):
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
import torch
|
||||
tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True)
|
||||
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True).cuda()
|
||||
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True, torch_dtype=torch.bfloat16).cuda()
|
||||
input_text = """<|fim▁begin|>def quick_sort(arr):
|
||||
if len(arr) <= 1:
|
||||
return arr
|
||||
@ -127,7 +127,7 @@ This code will output the following result:
|
||||
```python
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/deepseek-coder-6.7b-instruct", trust_remote_code=True)
|
||||
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-6.7b-instruct", trust_remote_code=True).cuda()
|
||||
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-6.7b-instruct", trust_remote_code=True, torch_dtype=torch.bfloat16).cuda()
|
||||
messages=[
|
||||
{ 'role': 'user', 'content': "write a quick sort algorithm in python."}
|
||||
]
|
||||
@ -175,7 +175,7 @@ You are an AI programming assistant, utilizing the DeepSeek Coder model, develop
|
||||
```python
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True)
|
||||
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True).cuda()
|
||||
model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-6.7b-base", trust_remote_code=True, torch_dtype=torch.bfloat16).cuda()
|
||||
|
||||
input_text = """#utils.py
|
||||
import torch
|
||||
|
Loading…
Reference in New Issue
Block a user