Mr-Vicky-01 commited on
Commit
9de4cfa
1 Parent(s): f656009

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -3
README.md CHANGED
@@ -1,3 +1,72 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+ # Inference
5
+ ```python
6
+ import time
7
+ import torch
8
+ from transformers import AutoTokenizer, AutoModelForCausalLM
9
+
10
+ tokenizer = AutoTokenizer.from_pretrained("Mr-Vicky-01/gpt2-medium-Fintuned")
11
+ model = AutoModelForCausalLM.from_pretrained("Mr-Vicky-01/gpt2-medium-Fintuned")
12
+ ```
13
+
14
+ ```python
15
+ BOS_TOKEN = "<sos>"
16
+ alpaca_prompt = BOS_TOKEN + """You are an AI specialized in generating SQL queries. Your task is to provide SQL queries based on the given instruction and input.
17
+
18
+ ### Instruction:
19
+
20
+ The schema for the scans table is as follows:
21
+
22
+ org_name: Organization name
23
+ group_name: Group name
24
+ project_name: Project name
25
+ git_url: Repo URL
26
+ public: Boolean (True or False)
27
+ frequency: Scan frequency (e.g., Once, Daily, Weekly, Monthly, Hourly)
28
+ status: Scan status (e.g., COMPLETED, RUNNING, SCANNING, FAILED, CLONING, CLOCING)
29
+ created_at: Timestamp (DD-MM-YYYY HH:MM)
30
+ total_vulns: Number of vulnerabilities
31
+ line_of_codes: Lines of code scanned
32
+ files_scanned: Files scanned
33
+ total_sast_findings: SAST scan vulnerabilities
34
+ total_exec_time_sast: SAST scan execution time (seconds)
35
+ total_secret_findings: Secret scan vulnerabilities
36
+ total_exec_time_secret: Secret scan execution time (seconds)
37
+ total_pii_findings: PII scan vulnerabilities
38
+ total_exec_time_pii: PII scan execution time (seconds)
39
+ total_sca_findings: SCA scan vulnerabilities
40
+ total_exec_time_sca: SCA scan execution time (seconds)
41
+ total_container_findings: Container scan vulnerabilities
42
+ total_exec_time_container: Container scan execution time (seconds)
43
+ total_malware_findings: Malware scan vulnerabilities
44
+ total_exec_time_malware: Malware scan execution time (seconds)
45
+ total_api_findings: API scan vulnerabilities
46
+ total_exec_time_api: API scan execution time (seconds)
47
+ total_iac_findings: IAC scan vulnerabilities
48
+ total_exec_time_iac: IAC scan execution time (seconds)
49
+ exec_time: Total scan execution time (seconds)
50
+ total_findings: Total vulnerabilities found
51
+
52
+ ### Input:
53
+ {}
54
+
55
+ ### Response:
56
+ """
57
+ input_ques = "how many scans i completed today".lower()
58
+
59
+ s = time.time()
60
+ prompt = alpaca_prompt.format(input_ques)
61
+ encodeds = tokenizer(prompt, return_tensors="pt",truncation=True).input_ids
62
+
63
+ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
64
+ model.to(device)
65
+ inputs = encodeds.to(device)
66
+
67
+ # Increase max_new_tokens if needed
68
+ generated_ids = model.generate(inputs, max_new_tokens=256,temperature=0.1, top_p=0.90, do_sample=True,pad_token_id=50259,eos_token_id=50259,num_return_sequences=1)
69
+ print(tokenizer.decode(generated_ids[0]).replace(prompt,'').split('<eos>')[0])
70
+ e = time.time()
71
+ print(f'time taken:{e-s}')
72
+ ```