# 安装好环境 # python app.py即可运行 import os os.environ['HF_ENDPOINT']='https://hf-mirror.com' from argparse import Namespace args = Namespace() arg_dict = { 'run_gradio': True, 'demo_public': False, 'model_name_or_path': './model/Qwen2-0.5B-Instruct', # 'model_name_or_path': 'Qwen/Qwen2-0.5B-Instruct-GGUF', 'gguf_file': './qwen2-0_5b-instruct-q8_0.gguf', # 只有用gguf模型会用到,即model_name_or_path里含有gguf字符串才会用到 'prompt_max_length': None, 'max_new_tokens': 500, 'generation_seed': 123, 'use_sampling': True, 'n_beams': 1, 'sampling_temp': 0.7, 'use_gpu': True, 'seeding_scheme': 'simple_1', 'gamma': 0.5, 'delta': 2.0, 'normalizers': '', 'ignore_repeated_bigrams': False, 'detection_z_threshold': 4.0, 'select_green_tokens': True, 'skip_model_load': False, 'seed_separately': True, } args.__dict__.update(arg_dict) from demo_watermark import main main(args)