File size: 5,137 Bytes
d2ac193 e1f1686 f2d7b7d 8d19077 f2d7b7d 8d19077 f2d7b7d 8d19077 f2d7b7d 8d19077 f2d7b7d c1570a1 f2d7b7d 9c0c1bc f2d7b7d af901c3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
---
license: mit
language:
- en
- zh
base_model:
- Qwen/Qwen3-0.6B
tags:
- code
---
<div align="center">
<img src="logo.jpg" width="300px">
**OceanGPT(沧渊): A Large Language Model for Ocean Science Tasks**
<p align="center">
<a href="https://github.com/zjunlp/OceanGPT">Project</a> •
<a href="https://arxiv.org/abs/2310.02031">Paper</a> •
<a href="https://huggingface.co/collections/zjunlp/oceangpt-664cc106358fdd9f09aa5157">Models</a> •
<a href="http://oceangpt.zjukg.cn/">Web</a> •
</p>
</div>
OceanGPT-coder-0.6B is based on Qwen3-0.6B and has been trained on a hybrid synthetic code dataset in `MOOS` language.
Please note that the models and data in this repository are updated regularly to fix errors. The latest update date will be added to the `README.md` for your reference.
- ❗**We will continue to update.**
- ❗**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
### Step 1: Download the model
Download the model: [zjunlp/OceanGPT-coder-0.6B](https://huggingface.co/zjunlp/OceanGPT-coder-0.6B)
```bash
git lfs install
git clone https://huggingface.co/zjunlp/OceanGPT-coder-0.6B
```
or
```bash
huggingface-cli download --resume-download zjunlp/OceanGPT-coder-0.6B --local-dir OceanGPT-coder-0.6B --local-dir-use-symlinks False
```
### Step 2: Inference
```bash
# Recommended to use Python 3.10 or latest version, PyTorch 2.6 or latest version.
pip install transformers>=4.51.0
```
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "zjunlp/OceanGPT-coder-0.6B"
device = "auto" # or your divice, e.g., "cuda:0" or "cpu".
# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map=device
)
# prepare the model input
prompt = "请为水下机器人生成MOOS代码,实现如下任务:先回到(50,20)点,然后以(15,20)点为圆形,做半径为30的圆周运动,持续时间200s,速度4 m/s。"
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
# conduct text completion
generated_ids = model.generate(
**model_inputs,
max_new_tokens=2048,
# temperature=0.6,
# do_sample=True,
# top_p=0.6,
# top_k=50,
# pad_token_id=tokenizer.eos_token_id
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
# parsing thinking content
# try:
# # rindex finding 151668 (</think>)
# index = len(output_ids) - output_ids[::-1].index(151668)
# except ValueError:
# index = 0
# thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids, skip_special_tokens=True).strip("\n")
print(content)
```
## 🌻Acknowledgement
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).
OceanGPT is trained based on the open-sourced data and tools including [Moos](https://github.com/moos-tutorials), [UATD](https://openi.pcl.ac.cn/OpenOrcinus_orca/URPC2021_sonar_images_dataset), [Forward-looking Sonar Detection Dataset](https://github.com/XingYZhu/Forward-looking-Sonar-Detection-Dataset), [NKSID](https://github.com/Jorwnpay/NK-Sonar-Image-Dataset), [SeabedObjects-KLSG](https://github.com/huoguanying/SeabedObjects-Ship-and-Airplane-dataset), [Marine Debris](https://github.com/mvaldenegro/marine-debris-fls-datasets/tree/master/md_fls_dataset/data/turntable-cropped).
Thanks for their great contributions!
## Limitations
- The model may have hallucination issues.
- Due to limited computational resources, OceanGPT-coder currently only supports machine code in `MOOS` language.
- 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.
```bibtex
@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}
}
``` |