mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[PR #31] [MERGED] Add trust_remote_code configuration option #245
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#245
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/p-e-w/heretic/pull/31
Author: @kldzj
Created: 11/20/2025
Status: ✅ Merged
Merged: 11/24/2025
Merged by: @p-e-w
Base:
master← Head:trust-remote-code📝 Commits (6)
261c38eAddtrust_remote_codeconfiguration option and apply it when loading models and tokenizersd0abac7Defaulttrust_remote_codetoNoneand set it toTrueif previouslyNoneso the user wouldn't be asked multiple timesebc4f8eConsistently accesstrust_remote_codefromself.settingsinstead of the globalsettingsobject.4cf314eIntroducetrusted_modelsdictionary to manage and confirmtrust_remote_codesettings during model loading8206bd4Assigntrust_remote_codetoevaluate_modelintrusted_modelsinstead ofmodel6b02c6bMerge branch 'p-e-w:master' into trust-remote-code📊 Changes
2 files changed (+21 additions, -1 deletions)
View changed files
📝
src/heretic/config.py(+5 -0)📝
src/heretic/model.py(+16 -1)📄 Description
Problem
Some models require running custom code. If we don't specify
trust_remote_code, the process will be interrupted and we'll be asked everytime the tokenizer or model is reloaded, for whether we want to allow it.Solution
Introduce a
--trust-remote-codeflag, which defaults toFalse, and pass it to all.from_pretrained()calls.Result
The process will now run uninterrupted. If we didn't specify the flag and the model needs to run custom code, it will fail when trying to load the model the first time with a error that specifies that remote code must be trusted.
One minor inconvenience is that the flag needs to explicitly needs to be followed with a boolean value. I didn't want to overcomplicate the model arg parsing logic, which in its current iteration prevents us from setting
cli_implicit_flags=Truein theSettingsConfigDict, meaningheretic --trust-remote-code [...]isn't sufficient, instead a boolean value must be passed likeheretic --trust-remote-code true [...].🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.