OceanGPT
OceanGPT copied to clipboard
[ACL 2024] OceanGPT: A Large Language Model for Ocean Science Tasks

OceanGPT (沧渊): A Large Language Model for Ocean Science Tasks
Project • Paper • Models • Web • Overview • Quickstart • Citation
Table of Contents
- What's New
- Overview
- Quickstart
- Models
- Citation
🔔News
- 2024-07-04, we release OceanGPT-14B/2B-v0.1 and OceanGPT-7B-v0.2 based on Qwen and MiniCPM.
- 2024-06-04, OceanGPT is accepted by ACL 2024. 🎉🎉
- 2023-10-04, we release the paper "OceanGPT: A Large Language Model for Ocean Science Tasks" and release OceanGPT-7B-v0.1 based on LLaMA2.
- 2023-05-01, we launch the OceanGPT (沧渊) project.
🌟Overview
This is the OceanGPT (沧渊) project, which aims to build LLMs for ocean science tasks.
- ❗Disclaimer: This project is purely an academic exploration rather than a product(本项目仅为学术探索并非产品应用). Please be aware that due to the inherent limitations of large language models, there may be issues such as hallucinations.


⏩Quickstart
conda create -n py3.11 python=3.11
conda activate py3.11
pip install -r requirements.txt
Download the model
Download from HuggingFace
git lfs install
git clone https://huggingface.co/zjunlp/OceanGPT-14B-v0.1
or
huggingface-cli download --resume-download zjunlp/OceanGPT-14B-v0.1 --local-dir OceanGPT-14B-v0.1 --local-dir-use-symlinks False
Download from WiseModel
git lfs install
git clone https://www.wisemodel.cn/zjunlp/OceanGPT-14B-v0.1.git
Download from ModelScope
git lfs install
git clone https://www.modelscope.cn/ZJUNLP/OceanGPT-14B-v0.1.git
Inference
Inference by HuggingFace
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
device = "cuda" # the device to load the model onto
path = 'YOUR-MODEL-PATH'
model = AutoModelForCausalLM.from_pretrained(
path,
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(path)
prompt = "Which is the largest ocean in the world?"
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(
model_inputs.input_ids,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
Inference by vllm
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
path = 'YOUR-MODEL-PATH'
tokenizer = AutoTokenizer.from_pretrained(path)
prompt = "Which is the largest ocean in the world?"
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
sampling_params = SamplingParams(temperature=0.8, top_k=50)
llm = LLM(model=path)
response = llm.generate(text, sampling_params)
📌Models
Model Name | HuggingFace | WiseModel | ModelScope |
---|---|---|---|
OceanGPT-14B-v0.1 (based on Qwen) | 14B | 14B | 14B |
OceanGPT-7B-v0.2 (based on Qwen) | 7B | 7B | 7B |
OceanGPT-2B-v0.1 (based on MiniCPM) | 2B | 2B | 2B |
OceanGPT-V | To be released | To be released | To be released |
🌻Acknowledgement
OceanGPT (沧渊) is trained based on the open-sourced large language models including Qwen, MiniCPM, LLaMA. Thanks for their great contributions!
Limitations
-
The model may have hallucination issues.
-
We did not optimize the identity and the model may generate identity information similar to that of Qwen/MiniCPM/LLaMA/GPT series models.
-
The model's output is influenced by prompt tokens, which may result in inconsistent results across multiple attempts.
-
The model requires the inclusion of specific simulator code instructions for training in order to possess simulated embodied intelligence capabilities (the simulator is subject to copyright restrictions and cannot be made available for now), and its current capabilities are quite limited.
🚩Citation
Please cite the following paper if you use OceanGPT in your work.
@article{bi2023oceangpt,
title={OceanGPT: A Large Language Model for Ocean Science Tasks},
author={Bi, Zhen and Zhang, Ningyu and Xue, Yida and Ou, Yixin and Ji, Daxiong and Zheng, Guozhou and Chen, Huajun},
journal={arXiv preprint arXiv:2310.02031},
year={2023}
}