Update README.md
Browse files
README.md
CHANGED
@@ -11,42 +11,95 @@ datasets:
|
|
11 |
- zjunlp/OceanBench
|
12 |
---
|
13 |
|
14 |
-
## 💡 Model description
|
15 |
-
This repo contains a large language model (OceanGPT) for ocean science tasks trained with [KnowLM](https://github.com/zjunlp/KnowLM).
|
16 |
-
It should be noted that the OceanGPT is constantly being updated, so the current model is not the final version.
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
You can download the model to generate responses or contact the [email]([email protected]) for the online test demo.
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
```python
|
26 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
27 |
import torch
|
28 |
-
|
29 |
-
path = '
|
|
|
|
|
|
|
|
|
|
|
30 |
tokenizer = AutoTokenizer.from_pretrained(path)
|
31 |
-
model = AutoModelForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16, device_map='cuda', trust_remote_code=True)
|
32 |
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
```
|
36 |
|
37 |
-
##
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
>>> from datasets import load_dataset
|
45 |
|
46 |
-
>>> dataset = load_dataset("zjunlp/OceanBench")
|
47 |
-
```
|
48 |
|
49 |
-
|
|
|
|
|
50 |
|
51 |
```bibtex
|
52 |
@article{bi2023oceangpt,
|
@@ -55,4 +108,5 @@ We wil provide several examples soon and you can modify the input according to y
|
|
55 |
journal={arXiv preprint arXiv:2310.02031},
|
56 |
year={2023}
|
57 |
}
|
|
|
58 |
```
|
|
|
11 |
- zjunlp/OceanBench
|
12 |
---
|
13 |
|
|
|
|
|
|
|
14 |
|
15 |
+
<div align="center">
|
16 |
+
<img src="logo.jpg" width="300px">
|
|
|
17 |
|
18 |
+
**OceanGPT: A Large Language Model for Ocean Science Tasks**
|
19 |
+
|
20 |
+
<p align="center">
|
21 |
+
<a href="https://github.com/zjunlp/OceanGPT">Project</a> •
|
22 |
+
<a href="https://arxiv.org/abs/2310.02031">Paper</a> •
|
23 |
+
<a href="https://huggingface.co/collections/zjunlp/oceangpt-664cc106358fdd9f09aa5157">Models</a> •
|
24 |
+
<a href="http://oceangpt.zjukg.cn/#model">Web</a> •
|
25 |
+
<a href="#quickstart">Quickstart</a> •
|
26 |
+
<a href="#citation">Citation</a>
|
27 |
+
</p>
|
28 |
+
|
29 |
+
|
30 |
+
</div>
|
31 |
+
|
32 |
+
OceanGPT-2B-v0.1 is based on MiniCPM-2B and has been trained on a bilingual dataset in the ocean domain, covering both Chinese and English.
|
33 |
+
|
34 |
+
|
35 |
+
## ⏩Quickstart
|
36 |
+
### Download the model
|
37 |
+
|
38 |
+
Download the model: [OceanGPT-2B-v0.1](https://huggingface.co/zjunlp/OceanGPT-2B-v0.1)
|
39 |
+
|
40 |
+
```shell
|
41 |
+
git lfs install
|
42 |
+
git clone https://huggingface.co/zjunlp/OceanGPT-2B-v0.1
|
43 |
+
```
|
44 |
+
or
|
45 |
+
```
|
46 |
+
huggingface-cli download --resume-download zjunlp/OceanGPT-2B-v0.1 --local-dir OceanGPT-2B-v0.1 --local-dir-use-symlinks False
|
47 |
+
```
|
48 |
+
### Inference
|
49 |
|
50 |
```python
|
51 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
52 |
import torch
|
53 |
+
device = "cuda" # the device to load the model onto
|
54 |
+
path = 'YOUR-MODEL-PATH'
|
55 |
+
model = AutoModelForCausalLM.from_pretrained(
|
56 |
+
path,
|
57 |
+
torch_dtype=torch.bfloat16,
|
58 |
+
device_map="auto"
|
59 |
+
)
|
60 |
tokenizer = AutoTokenizer.from_pretrained(path)
|
|
|
61 |
|
62 |
+
prompt = "Which is the largest ocean in the world?"
|
63 |
+
messages = [
|
64 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
65 |
+
{"role": "user", "content": prompt}
|
66 |
+
]
|
67 |
+
text = tokenizer.apply_chat_template(
|
68 |
+
messages,
|
69 |
+
tokenize=False,
|
70 |
+
add_generation_prompt=True
|
71 |
+
)
|
72 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
73 |
+
|
74 |
+
generated_ids = model.generate(
|
75 |
+
model_inputs.input_ids,
|
76 |
+
max_new_tokens=512
|
77 |
+
)
|
78 |
+
generated_ids = [
|
79 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
80 |
+
]
|
81 |
+
|
82 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
83 |
```
|
84 |
|
85 |
+
## 📌Models
|
86 |
|
87 |
+
| Model Name | HuggingFace | WiseModel | ModelScope |
|
88 |
+
|-------------------|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
|
89 |
+
| OceanGPT-14B-v0.1 (based on Qwen) | <a href="https://huggingface.co/zjunlp/OceanGPT-14B-v0.1" target="_blank">14B</a> | <a href="https://wisemodel.cn/models/zjunlp/OceanGPT-14B-v0.1" target="_blank">14B</a> | <a href="https://modelscope.cn/models/ZJUNLP/OceanGPT-14B-v0.1" target="_blank">14B</a> |
|
90 |
+
| OceanGPT-7B-v0.2 (based on Qwen) | <a href="https://huggingface.co/zjunlp/OceanGPT-7b-v0.2" target="_blank">7B</a> | <a href="https://wisemodel.cn/models/zjunlp/OceanGPT-7b-v0.2" target="_blank">7B</a> | <a href="https://modelscope.cn/models/ZJUNLP/OceanGPT-7b-v0.2" target="_blank">7B</a> |
|
91 |
+
| OceanGPT-2B-v0.1 (based on MiniCPM) | <a href="https://huggingface.co/zjunlp/OceanGPT-2B-v0.1" target="_blank">2B</a> | <a href="https://wisemodel.cn/models/zjunlp/OceanGPT-2b-v0.1" target="_blank">2B</a> | <a href="https://modelscope.cn/models/ZJUNLP/OceanGPT-2B-v0.1" target="_blank">2B</a> |
|
92 |
+
| OceanGPT-V | To be released | To be released | To be released |
|
93 |
+
---
|
94 |
|
95 |
+
## 🌻Acknowledgement
|
96 |
|
97 |
+
OceanGPT is trained based on the open-sourced large language models including [Qwen](https://huggingface.co/Qwen), [MiniCPM](https://huggingface.co/collections/openbmb/minicpm-2b-65d48bf958302b9fd25b698f), [LLaMA](https://huggingface.co/meta-llama). Thanks for their great contributions!
|
|
|
98 |
|
|
|
|
|
99 |
|
100 |
+
### 🚩Citation
|
101 |
+
|
102 |
+
Please cite the following paper if you use OceanGPT in your work.
|
103 |
|
104 |
```bibtex
|
105 |
@article{bi2023oceangpt,
|
|
|
108 |
journal={arXiv preprint arXiv:2310.02031},
|
109 |
year={2023}
|
110 |
}
|
111 |
+
|
112 |
```
|