Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI4Finance Foundation FinGPT parse model name

From Leeroopedia
Knowledge Sources
Domains Deep_Learning, Model_Loading
Last Updated 2026-10-18 00:00 GMT

Overview

Concrete tool for resolving short model names to HuggingFace model paths provided by the FinGPT Benchmark and Forecaster utilities.

Description

The parse_model_name function maps short model names (e.g., "llama2", "chatglm2") to their full HuggingFace model IDs (for remote loading) or local paths (for local loading). The Benchmark version supports 10 base models; the Forecaster version supports 2 (chatglm2, llama2).

Usage

Import this function when you need to resolve model names before loading:

  • Benchmark training/evaluation: Resolving any of 10 supported model names.
  • Forecaster training: Resolving chatglm2 or llama2 model paths.

Code Reference

Source Location

  • Repository: FinGPT
  • File: fingpt/FinGPT_Benchmark/utils.py (L134-163), fingpt/FinGPT_Forecaster/utils.py (L47-54)

Signature

def parse_model_name(
    name: str,
    from_remote: bool = False,
) -> str

Import

from utils import parse_model_name

I/O Contract

Inputs

Name Type Required Description
name str Yes Short model name (e.g., 'llama2', 'chatglm2', 'falcon')
from_remote bool No Return HF Hub ID (True) or local path (False)

Outputs

Name Type Description
return value str HuggingFace model ID or local path

Usage Examples

Resolve Model Name

from utils import parse_model_name

# Remote (HuggingFace Hub)
print(parse_model_name("llama2", from_remote=True))
# 'meta-llama/Llama-2-7b-hf'

# Local
print(parse_model_name("llama2", from_remote=False))
# 'base_models/Llama-2-7b-hf'

# Forecaster version
print(parse_model_name("llama2"))
# 'meta-llama/Llama-2-7b-chat-hf'

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment