You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #478 adds an HF adapter for bharatgenai/Param-1-5B, a checkpoint that ships custom modeling code and therefore requires trust_remote_code=True at load time.
The review on that PR (#478 (review)) identified a blocker before it can be merged:
In order to merge this, we would need to add a mechanism that tags a specific entry in model_registry.py as needing trust_remote_code, and then either excludes this checkpoint from the CI tests or wires the parameter to model load in all the relevant tests.
What needs to be done
1. Tag entries in model_registry.py
Add a "trust_remote_code": True field to any registry entry whose checkpoint requires it, e.g.:
"param_1_5b": {
"name": "BharatGen Param-1 5B",
"path": "bharatgenai/Param-1-5B",
"adapter": "hf_bharatgen.py",
"size": "5b",
"trust_remote_code": True, # <-- new field
},
2. Thread the flag through all relevant tests
Anywhere that a registry entry is consumed to load a model in a test, read the trust_remote_code field and forward it to AutoSpyreModelForCausalLM.from_pretrained() (or the equivalent Auto class).
The two viable strategies are:
Wire it through — pass trust_remote_code=model_info.get("trust_remote_code") at every from_pretrained call site in the test suite.
Exclude from CI — skip parameterized test cases where trust_remote_code is True (similar to how is_gated entries are filtered via SPYRE_INCLUDE_GATED), e.g. a new SPYRE_INCLUDE_TRUST_REMOTE_CODE=1 guard.
Either approach (or a combination) unblocks merging PR #478 without bypassing trust_remote_code globally or hard-coding it inside the adapter.
Background
PR #478 adds an HF adapter for bharatgenai/Param-1-5B, a checkpoint that ships custom modeling code and therefore requires
trust_remote_code=Trueat load time.The review on that PR (#478 (review)) identified a blocker before it can be merged:
What needs to be done
1. Tag entries in
model_registry.pyAdd a
"trust_remote_code": Truefield to any registry entry whose checkpoint requires it, e.g.:2. Thread the flag through all relevant tests
Anywhere that a registry entry is consumed to load a model in a test, read the
trust_remote_codefield and forward it toAutoSpyreModelForCausalLM.from_pretrained()(or the equivalent Auto class).The two viable strategies are:
trust_remote_code=model_info.get("trust_remote_code")at everyfrom_pretrainedcall site in the test suite.trust_remote_codeisTrue(similar to howis_gatedentries are filtered viaSPYRE_INCLUDE_GATED), e.g. a newSPYRE_INCLUDE_TRUST_REMOTE_CODE=1guard.Either approach (or a combination) unblocks merging PR #478 without bypassing
trust_remote_codeglobally or hard-coding it inside the adapter.Affected files (from PR #478)
tests/model_registry.py— registry entries need the new fieldCAUSAL_LM_MODELS(or similar registries) and callfrom_pretrainedhf_adapters/hf_common.py/hf_adapters/auto_spyre_model.pyif any plumbing is still needed (PR feat: Add hf adapter for https://huggingface.co/bharatgenai/Param-1-5B #478 has already added thetrust_remote_codeparameter to theAutoSpyreModel*classes andload_model_common)