Integrate your own models into SimulCost-Bench with support for single-model or multi-model testing workflows.
- Implement your model class with
invoke()method - Configure
.envfile with model parameters - Run inference with your model name:
python inference/langchain_LLM.py -p custom_model -m your_model_name -d heat_1d -t cfl -l medium -z
- Create JSON configuration file:
configs/custom_models.json - Add all your models to the JSON config
- Run batch scripts:
bash scripts/inference_eval/inference_eval_heat_1d.sh
{
"custom_models": {
"model_name": {
"custom_code": "/path/to/custom_inference.py",
"model_path": "/path/to/model",
"custom_class": "ModelClass"
}
}
}custom_code="/path/to/custom_inference.py"
model_path="/path/to/your/model"
custom_class="CustomModel"class CustomModel:
def __init__(self, model_path: str):
self.model_path = model_path
# Load your model here
def invoke(self, messages: list[dict]) -> str:
# Process messages and generate response
return responseMessage format:
[{"role": "system|user|assistant", "content": "message content"}]custom_code: Path to Python file with model classmodel_path: Path to model files/weightscustom_class: Class name implementing the interfacedescription: (Optional) Model description
from transformers import AutoModelForCausalLM, AutoTokenizer
class Qwen3:
def __init__(self, model_path: str):
self.model_path = model_path
self.tokenizer = AutoTokenizer.from_pretrained(model_path)
self.model = AutoModelForCausalLM.from_pretrained(
model_path, torch_dtype="auto", device_map="auto"
)
def invoke(self, messages: list[dict]) -> str:
text = self.tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
model_inputs = self.tokenizer([text], return_tensors="pt").to(self.model.device)
generated_ids = self.model.generate(**model_inputs, max_new_tokens=32768)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
response = self.tokenizer.decode(output_ids, skip_special_tokens=True)
return response.strip()python scripts/list_custom_models.py# Configure .env and run
python inference/langchain_LLM.py -p custom_model -m your_model_name -d heat_1d -t cfl -l medium -z# Configure JSON and run batch
bash scripts/inference_eval/inference_eval_heat_1d.sh- JSON configuration has priority over environment variables
- Test with
.envbefore adding to JSON config - Use consistent naming conventions for related models
Don't want to implement from scratch? Check out our prompt template for AI tools (Cursor, Claude Code) to auto-generate your custom_inference code!