Update server.py to add --trust-remote-code to server (#578)

* Update server.py

Add --trust-remote-code to server

* format code by running pre-commit

---------

Co-authored-by: flymonk <zhou.feng@gsafer.com>
This commit is contained in:
sweetcard 2024-03-14 22:05:19 +08:00 committed by GitHub
parent 2cd793dd69
commit e2205beb66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -432,8 +432,18 @@ if __name__ == "__main__":
default=8080,
help="Port for the HTTP server (default: 8080)",
)
parser.add_argument(
"--trust-remote-code",
action="store_true",
help="Enable trusting remote code for tokenizer",
)
args = parser.parse_args()
MODEL, TOKENIZER = load(args.model, adapter_file=args.adapter_file)
# Building tokenizer_config
tokenizer_config = {"trust_remote_code": True if args.trust_remote_code else None}
MODEL, TOKENIZER = load(
args.model, adapter_file=args.adapter_file, tokenizer_config=tokenizer_config
)
run(args.host, args.port)