Skip to content

Commit

Permalink
feat(autogpt/transformers): consume trust_remote_code (#1799)
Browse files Browse the repository at this point in the history
trusting remote code by default is a danger to our users
  • Loading branch information
dave-gray101 authored Mar 5, 2024
1 parent 504f2e8 commit 5c69dd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/python/autogptq/autogptq.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def LoadModel(self, request, context):
model = AutoGPTQForCausalLM.from_quantized(request.Model,
model_basename=request.ModelBaseName,
use_safetensors=True,
trust_remote_code=True,
trust_remote_code=request.TrustRemoteCode,
device=device,
use_triton=request.UseTriton,
quantize_config=None)
Expand Down
4 changes: 2 additions & 2 deletions backend/python/transformers/transformers_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def LoadModel(self, request, context):
model_name = request.Model
try:
if request.Type == "AutoModelForCausalLM":
self.model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
self.model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=request.TrustRemoteCode)
else:
self.model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
self.model = AutoModel.from_pretrained(model_name, trust_remote_code=request.TrustRemoteCode)

self.tokenizer = AutoTokenizer.from_pretrained(model_name)
self.CUDA = False
Expand Down

0 comments on commit 5c69dd1

Please sign in to comment.