Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
coding=utf-8
|
| 2 |
+
# Copyright 2023 Authors of "A Watermark for Large Language Models"
|
| 3 |
+
# available at https://arxiv.org/abs/2301.10226
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
|
| 17 |
+
from argparse import Namespace
|
| 18 |
+
args = Namespace()
|
| 19 |
+
|
| 20 |
+
arg_dict = {
|
| 21 |
+
'run_gradio': True,
|
| 22 |
+
'demo_public': False,
|
| 23 |
+
# 'model_name_or_path': 'facebook/opt-1.3b', # historical
|
| 24 |
+
# 'model_name_or_path': 'facebook/opt-2.7b', # historical
|
| 25 |
+
# 'model_name_or_path': 'facebook/opt-6.7b', # historical
|
| 26 |
+
# 'model_name_or_path': 'meta-llama/Llama-2-7b-hf', # historical
|
| 27 |
+
'model_name_or_path': 'meta-llama/Llama-3.2-3B',
|
| 28 |
+
'all_models':[
|
| 29 |
+
# "meta-llama/Llama-3.1-8B", # too big for the A10G 24GB
|
| 30 |
+
"meta-llama/Llama-3.2-3B",
|
| 31 |
+
# "meta-llama/Llama-3.2-1B",
|
| 32 |
+
# "Qwen/Qwen3-8B", # too big for the A10G 24GB
|
| 33 |
+
# "Qwen/Qwen3-4B",
|
| 34 |
+
# "Qwen/Qwen3-1.7B",
|
| 35 |
+
# "Qwen/Qwen3-0.6B",
|
| 36 |
+
# "Qwen/Qwen3-4B-Instruct-2507",
|
| 37 |
+
# "Qwen/Qwen3-4B-Thinking-2507",
|
| 38 |
+
],
|
| 39 |
+
# 'load_fp16' : True,
|
| 40 |
+
'load_fp16' : False,
|
| 41 |
+
'load_bf16' : True,
|
| 42 |
+
'prompt_max_length': None,
|
| 43 |
+
'max_new_tokens': 200,
|
| 44 |
+
'generation_seed': 123,
|
| 45 |
+
'use_sampling': True,
|
| 46 |
+
'n_beams': 1,
|
| 47 |
+
'sampling_temp': 0.7,
|
| 48 |
+
'use_gpu': True,
|
| 49 |
+
'seeding_scheme': 'simple_1',
|
| 50 |
+
'gamma': 0.5,
|
| 51 |
+
'delta': 2.0,
|
| 52 |
+
'normalizers': '',
|
| 53 |
+
'ignore_repeated_bigrams': False,
|
| 54 |
+
'detection_z_threshold': 4.0,
|
| 55 |
+
'select_green_tokens': True,
|
| 56 |
+
'skip_model_load': False,
|
| 57 |
+
'seed_separately': True,
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
args.__dict__.update(arg_dict)
|
| 61 |
+
|
| 62 |
+
from demo_watermark import main
|
| 63 |
+
|
| 64 |
+
main(args)
|