YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

Inference

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "zjunlp/OceanGPT-basic-30B-OceanPile-Sci"

# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)

# prepare the model input
system_prompt = "You are a marine knowledge expert, responsible for answering all marine-related questions."
# system_prompt = "你是海洋知识专家,负责解答各类海洋相关问题."

question = "<Your Question>"
messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user", "content": question}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# conduct text completion
generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=2048
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() 

content = tokenizer.decode(output_ids, skip_special_tokens=True)

print("content:", content)
Downloads last month
35
Safetensors
Model size
31B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for zjunlp/OceanGPT-basic-30B-OceanPile-Sci

Quantizations
1 model