# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Bin12345/Fortran2Cpp")
model = AutoModelForCausalLM.from_pretrained("Bin12345/Fortran2Cpp")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))Quick Links
Introduction
The model is primarily designed for translating Fortran code into C++ code. It is based on the deepseek-ai/deepseek-coder-33b-instruct model. Fine-tuned on a customized Fortran to C++ translation dataset.
Model Inference
The code for inference and Web demo is shown in the github: Fortran2Cpp
- Downloads last month
- 9
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Bin12345/Fortran2Cpp") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)