mirror of
https://github.com/imbue-bit/OpenClaw-PwnKit.git
synced 2026-08-14 09:02:51 +00:00
security: remove trust_remote_code=True from model loading
Phi-2 uses the standard PhiForCausalLM architecture and does not require custom code execution. trust_remote_code=True allows arbitrary Python from the HuggingFace repo to run during loading, creating an unnecessary supply-chain risk.
This commit is contained in:
@@ -18,14 +18,13 @@ class CMAESTokenOptimizer:
|
||||
self.pca_dims = pca_dims
|
||||
|
||||
print("[*] Loading surrogate model (microsoft/phi-2) for continuous embedding space... This may take a minute.")
|
||||
self.tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
|
||||
self.tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2")
|
||||
self.tokenizer.pad_token = self.tokenizer.eos_token
|
||||
|
||||
self.model = AutoModelForCausalLM.from_pretrained(
|
||||
"microsoft/phi-2",
|
||||
device_map="auto",
|
||||
torch_dtype=torch.float16,
|
||||
trust_remote_code=True
|
||||
)
|
||||
self.d_model = self.model.config.hidden_size
|
||||
|
||||
|
||||
Reference in New Issue
Block a user