Ningyu commited on
Commit
3d228c1
·
verified ·
1 Parent(s): 0011979

Update README.md

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