xyd123 commited on
Commit
2827487
โ€ข
1 Parent(s): 5f7e93f
Files changed (1) hide show
  1. README.md +81 -0
README.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ pipeline_tag: text-generation
4
+ tags:
5
+ - ocean
6
+ - text-generation-inference
7
+ - oceangpt
8
+ language:
9
+ - en
10
+ 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
+ OceanGPT-7B-v0.2 is based on Qwen2-7B and trained on a bilingual dataset in Chinese and English.
19
+ ## ๐Ÿ” Intended uses
20
+ You can download the model to generate responses or contact the [email]([email protected]) for the online test demo.
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 AutoModelForCausalLM, AutoTokenizer
27
+ import torch
28
+ device = "cuda" # the device to load the model onto
29
+
30
+ model = AutoModelForCausalLM.from_pretrained(
31
+ "zjunlp/OceanGPT-7B-v0.2",
32
+ torch_dtype=torch.bfloat16,
33
+ device_map="auto"
34
+ )
35
+ tokenizer = AutoTokenizer.from_pretrained("zjunlp/OceanGPT-7B-v0.2")
36
+
37
+ prompt = "Which is the largest ocean in the world?"
38
+ messages = [
39
+ {"role": "system", "content": "You are a helpful assistant."},
40
+ {"role": "user", "content": prompt}
41
+ ]
42
+ text = tokenizer.apply_chat_template(
43
+ messages,
44
+ tokenize=False,
45
+ add_generation_prompt=True
46
+ )
47
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
48
+
49
+ generated_ids = model.generate(
50
+ model_inputs.input_ids,
51
+ max_new_tokens=512
52
+ )
53
+ generated_ids = [
54
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
55
+ ]
56
+
57
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
58
+ ```
59
+
60
+ ## ๐Ÿ› ๏ธ How to evaluate your model in OceanBench
61
+
62
+ We wil provide several examples soon and you can modify the input according to your needs.
63
+
64
+ *Note: We are conducting the final checks on OceanBench and will be uploading it to Hugging Face soon.
65
+
66
+ ```python
67
+ >>> from datasets import load_dataset
68
+
69
+ >>> dataset = load_dataset("zjunlp/OceanBench")
70
+ ```
71
+
72
+ ## ๐Ÿ“š How to cite
73
+
74
+ ```bibtex
75
+ @article{bi2023oceangpt,
76
+ title={OceanGPT: A Large Language Model for Ocean Science Tasks},
77
+ author={Bi, Zhen and Zhang, Ningyu and Xue, Yida and Ou, Yixin and Ji, Daxiong and Zheng, Guozhou and Chen, Huajun},
78
+ journal={arXiv preprint arXiv:2310.02031},
79
+ year={2023}
80
+ }
81
+ ```