File size: 1,639 Bytes
1244519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import sys
import argparse
from relative_tester import RelativeTester
from utils import init_random_seeds, config, get_device


if __name__ == "__main__":
    init_random_seeds()
    parser = argparse.ArgumentParser(description="R-Detect the file content")
    parser.add_argument(
        "--test_file",
        type=str,
        help="The file path of the test file. Default is demo_text_gpt.txt",
        default="./demo_text_gpt.txt",
    )
    parser.add_argument(
        "--use_gpu",
        action="store_true",
        help="Use GPU or not.",
    )
    parser.add_argument(
        "--local_model",
        type=str,
        help="Use local model or not, you need to download the model first, and set the path. Script will use remote if this param is empty.",
        default="",
    )
    parser.add_argument(
        "--feature_ref_HWT",
        type=str,
        help="The feature ref path of HWT. Script will use remote if this param is empty.",
        default="",
    )
    parser.add_argument(
        "--feature_ref_MGT",
        type=str,
        help="The feature ref path of MGT. Default is Empty",
        default="",
    )
    args = parser.parse_args()
    config["test_file"] = args.test_file
    config["use_gpu"] = args.use_gpu
    config["local_model"] = args.local_model
    config["feature_ref_HWT"] = args.feature_ref_HWT
    config["feature_ref_MGT"] = args.feature_ref_MGT
    print(f"Running on device", get_device())
    with open(config["test_file"], "r") as file:
        content = file.read()
        relative_tester = RelativeTester()
        print(relative_tester.test(content))
    # print(content)