microsoft / microsoft/qlib

HIST model missing explicit pretrain toggle in initialization

Open
#2,074 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
48.7k
Forks
7.7k
PR merge metrics
No merged PRs in 30d

Description

In contrib\model\pytorch_hist.py
Description: Currently, the HIST model implementation in qlib lacks an explicit parameter to control the pre-training loading logic. This makes it difficult for users to skip the pre-training weight-loading phase even when a model path is specified or when they wish to train the architecture from scratch.

Proposed Changes:

init method: Added pretrain (defaulting to True for backward compatibility) to the parameters.

Logic Update: Wrapped the weight-loading and state_dict update logic inside if self.pretrain:.

# In __init__
def __init__(self, ..., pretrain=True, **kwargs):
    ...
    self.pretrain = pretrain

# In weight loading logic
if self.pretrain:
    if self.model_path is not None:
        self.logger.info("Loading pretrained model...")
        pretrained_model.load_state_dict(torch.load(self.model_path))
    
    # ... (state_dict update logic)
    self.logger.info("Loading pretrained model Done...")

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in contrib/model/pytorch_hist.py by reading the init method and the existing pretrained weight-loading and state_dict update logic. Confirm the pretrain option defaults to true for backward compatibility, skips that loading path when false, and preserves loading behavior when enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.