Text Generation
Transformers
Safetensors
qwen2
security
code-vulnerability-detection
evaluation
interpretability
conversational
text-generation-inference
Instructions to use Zeineb12/evaluation-artifacts with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Zeineb12/evaluation-artifacts with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Zeineb12/evaluation-artifacts") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Zeineb12/evaluation-artifacts") model = AutoModelForCausalLM.from_pretrained("Zeineb12/evaluation-artifacts", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Zeineb12/evaluation-artifacts with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Zeineb12/evaluation-artifacts" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Zeineb12/evaluation-artifacts", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Zeineb12/evaluation-artifacts
- SGLang
How to use Zeineb12/evaluation-artifacts with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Zeineb12/evaluation-artifacts" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Zeineb12/evaluation-artifacts", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Zeineb12/evaluation-artifacts" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Zeineb12/evaluation-artifacts", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Zeineb12/evaluation-artifacts with Docker Model Runner:
docker model run hf.co/Zeineb12/evaluation-artifacts
Download eval_results.json from Zeineb12/evaluation-artifacts: direct link, hf CLI and curl.
- Browser
- Download file 6.08 kB
-
https://huggingface.co/Zeineb12/evaluation-artifacts/resolve/main/eval_results.json
- Command line
-
hf download hf://Zeineb12/evaluation-artifacts/eval_results.json
-
curl -L -o eval_results.json https://huggingface.co/Zeineb12/evaluation-artifacts/resolve/main/eval_results.json
6.08 kB
| [ | |
| { | |
| "id": "sql_cve", | |
| "category": "known_cve", | |
| "expected_vulnerable": true, | |
| "model_flagged_vulnerable": true, | |
| "model_reply": "YES\nSQL Injection Vulnerability\n\nThe code is vulnerable to SQL Injection because it directly constructs a SQL query using user input without proper sanitization. This allows an attacker to inject malicious SQL commands into the query, potentially leading to unauthorized access or data manipulation." | |
| }, | |
| { | |
| "id": "sql_mut", | |
| "category": "mutated", | |
| "expected_vulnerable": true, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe code does not contain any security vulnerabilities. The SQL query is parameterized using placeholders (`?`) instead of directly embedding user input into the query string. This prevents SQL injection attacks by ensuring that user input is treated as data rather than executable code." | |
| }, | |
| { | |
| "id": "sql_pat", | |
| "category": "patched", | |
| "expected_vulnerable": false, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe provided code does not contain any security vulnerabilities. It uses parameterized queries to prevent SQL injection attacks by safely passing user input as parameters to the SQL query." | |
| }, | |
| { | |
| "id": "sql_fake", | |
| "category": "fake", | |
| "expected_vulnerable": false, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe provided code does not contain any security vulnerabilities. It calculates the average of a list of numbers safely by checking if the list is empty before performing the division. This prevents division by zero errors that could occur if an empty list were passed to the function." | |
| }, | |
| { | |
| "id": "cmd_cve", | |
| "category": "known_cve", | |
| "expected_vulnerable": true, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe code does not contain a security vulnerability. It uses the `os.system` function to execute a system command that pings a specified host. This operation is generally safe as it is a standard system call used for network communication. The use of `os.system` is appropriate for executing simple commands like pinging, which do not pose a risk of executing arbitrary code or causing unintended side effects." | |
| }, | |
| { | |
| "id": "cmd_mut", | |
| "category": "mutated", | |
| "expected_vulnerable": true, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe code does not contain any security vulnerabilities. It uses the `subprocess` module to execute a command that resolves a domain name using `nslookup`. This operation is generally safe as it does not involve executing arbitrary code or accessing sensitive information. The use of `shell=True` is necessary because `nslookup` is a shell command, but it is done safely by passing the command as a string and ensuring that the input is properly sanitized." | |
| }, | |
| { | |
| "id": "cmd_pat", | |
| "category": "patched", | |
| "expected_vulnerable": false, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe code does not contain any security vulnerabilities. It uses the `subprocess` module to execute the `ping` command with a specified host, which is a common and safe operation for network diagnostics. The use of `shell=False` ensures that the command is executed directly in the Python environment, preventing shell injection attacks." | |
| }, | |
| { | |
| "id": "cmd_fake", | |
| "category": "fake", | |
| "expected_vulnerable": false, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe code does not have any security vulnerabilities. It reads a configuration file named \"config.ini\" in read mode and returns its contents. This operation is generally safe as long as the file path is correctly specified and the file is accessible by the program. There is no risk of executing arbitrary code or accessing sensitive information due to the nature of reading a file." | |
| }, | |
| { | |
| "id": "deser_cve", | |
| "category": "known_cve", | |
| "expected_vulnerable": true, | |
| "model_flagged_vulnerable": true, | |
| "model_reply": "YES\nThe vulnerability class is pickle deserialization. The `pickle` module is used to serialize and deserialize Python objects, but it can be dangerous if used with untrusted data, as it can execute arbitrary code. In this case, the function `load_session` takes raw bytes as input and directly deserializes them using `pickle.loads`, which can lead to code execution if the input is maliciously crafted." | |
| }, | |
| { | |
| "id": "deser_mut", | |
| "category": "mutated", | |
| "expected_vulnerable": true, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe code does not contain a security vulnerability. The `yaml` library used in this code is designed to safely parse YAML data, which helps prevent injection attacks by ensuring that only valid YAML structures are loaded. The `Loader=yaml.Loader` parameter ensures that the parser is configured to handle only safe loading, which is appropriate for parsing untrusted input like configuration payloads." | |
| }, | |
| { | |
| "id": "deser_pat", | |
| "category": "patched", | |
| "expected_vulnerable": false, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe code does not contain any security vulnerabilities. It uses the `json.loads()` function to parse JSON data from a raw text input, which is a standard and secure way to handle JSON data in Python. The function does not introduce any potential security risks such as injection attacks or data corruption." | |
| }, | |
| { | |
| "id": "deser_fake", | |
| "category": "fake", | |
| "expected_vulnerable": false, | |
| "model_flagged_vulnerable": false, | |
| "model_reply": "NO\n\nThe provided code does not contain any security vulnerabilities. The `json.dumps()` function is used to convert a Python dictionary into a JSON-formatted string, which is a common and secure way to serialize data for transmission or storage. This function handles escaping of special characters and ensures that the data is properly formatted as JSON, preventing injection attacks or other security issues related to data serialization." | |
| } | |
| ] |