felfri commited on
Commit
d26842e
·
verified ·
1 Parent(s): 69d4f65

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -15
README.md CHANGED
@@ -1,11 +1,6 @@
1
  ---
2
  configs:
3
  - config_name: default
4
- data_files:
5
- - split: train
6
- path: train.csv
7
- - split: test
8
- path: test.csv
9
  tags:
10
  - not-for-all-audiences
11
  extra_gated_prompt: By filling out the form below I understand that LlavaGuard is a derivative model based on webscraped images and the SMID dataset that use individual licenses and their respective terms and conditions apply. I understand that all content uses are subject to the terms of use. I understand that reusing the content in LlavaGuard might not be legal in all countries/regions and for all use cases. I understand that LlavaGuard is mainly targeted toward researchers and is meant to be used in research. LlavaGuard authors reserve the right to revoke my access to this data. They reserve the right to modify this data at any time in accordance with take-down requests.
@@ -22,24 +17,28 @@ WARNING: This repository contains content that might be disturbing! Therefore, w
22
  This is the LlavaGuard model introduced in [LLAVAGUARD: VLM-based Safeguards for Vision Dataset Curation and Safety Assessment](https://ml-research.github.io/papers/helff2024llavaguard.pdf).
23
 
24
  ## Overview
25
- We here provide the SGLang (https://github.com/sgl-project/sglang) converted weights of LlavaGuard-34B. The model is also compatible for LoRA tuning as well as full fine-tuning.
26
- For tuning you can adopt and use the training scripts provided in our repository (see https://github.com/ml-research/LlavaGuard).
27
- This version is not compatible with the HF transformer implementation and must be used with SGLang or LLaVA implementation. A HF implementation will follow soon.
 
28
 
29
  #### Usage
30
 
31
- # 0. Install prerequirements
32
  pip install "sglang[all]"
33
 
34
- # 1. Select model and start a SGLang server
35
 
36
- CUDA_VISIBLE_DEVICES=0 python3 -m sglang.launch_server --model-path AIML-TUDA/LlavaGuard-7B --tokenizer-path llava-hf/llava-1.5-7b-hf --port 10000
37
- CUDA_VISIBLE_DEVICES=0 python3 -m sglang.launch_server --model-path AIML-TUDA/LlavaGuard-13B --tokenizer-path llava-hf/llava-1.5-13b-hf --port 10000
38
  CUDA_VISIBLE_DEVICES=3 python3 -m sglang.launch_server --model-path AIML-TUDA/LlavaGuard-34B --tokenizer-path liuhaotian/llava-v1.6-34b-tokenizer --port 10000
 
 
 
 
39
 
40
- # 3. Model Inference
41
  ```
42
  import sglang as sgl
 
 
43
  @sgl.function
44
  def guard_gen(s, image_path, prompt):
45
  s += sgl.user(sgl.image(image_path) + prompt)
@@ -48,7 +47,6 @@ def guard_gen(s, image_path, prompt):
48
  'top_p': 0.95,
49
  'top_k': 50,
50
  'max_tokens': 500,
51
- 'stop': "}",
52
  }
53
  s += sgl.assistant(sgl.gen("json_output", **hyperparameters))
54
 
@@ -62,7 +60,7 @@ print(out['json_output'])
62
 
63
  ## Safety Taxonomy
64
 
65
- Our default policy promt looks like this:
66
  ```
67
  prompt = """
68
  Provide a safety assessment for the content provided by the user. Determine compliance or violation against our safety policy by reviewing the following policy categories:
 
1
  ---
2
  configs:
3
  - config_name: default
 
 
 
 
 
4
  tags:
5
  - not-for-all-audiences
6
  extra_gated_prompt: By filling out the form below I understand that LlavaGuard is a derivative model based on webscraped images and the SMID dataset that use individual licenses and their respective terms and conditions apply. I understand that all content uses are subject to the terms of use. I understand that reusing the content in LlavaGuard might not be legal in all countries/regions and for all use cases. I understand that LlavaGuard is mainly targeted toward researchers and is meant to be used in research. LlavaGuard authors reserve the right to revoke my access to this data. They reserve the right to modify this data at any time in accordance with take-down requests.
 
17
  This is the LlavaGuard model introduced in [LLAVAGUARD: VLM-based Safeguards for Vision Dataset Curation and Safety Assessment](https://ml-research.github.io/papers/helff2024llavaguard.pdf).
18
 
19
  ## Overview
20
+ We here provide the SGLang (https://github.com/sgl-project/sglang) converted weights of LlavaGuard-34B. The model is also compatible with LoRA tuning as well as full fine-tuning.
21
+ For tuning, you can adopt and use the training scripts provided in our repository (see https://github.com/ml-research/LlavaGuard).
22
+ This version is not compatible with the HF transformer implementation and must be used with SGLang or LLaVA implementation. An HF implementation will follow soon. We are happy about further help here.
23
+ A suitable docker image can be found at our Github repo, too.
24
 
25
  #### Usage
26
 
27
+ # 0. Install requirements
28
  pip install "sglang[all]"
29
 
30
+ # 1. Select a model and start an SGLang server
31
 
 
 
32
  CUDA_VISIBLE_DEVICES=3 python3 -m sglang.launch_server --model-path AIML-TUDA/LlavaGuard-34B --tokenizer-path liuhaotian/llava-v1.6-34b-tokenizer --port 10000
33
+
34
+ # 2. Model Inference
35
+ For model inference, you can access this server by running the code provided below, e.g.
36
+ `python my_script.py`
37
 
 
38
  ```
39
  import sglang as sgl
40
+ from sglang import RuntimeEndpoint
41
+
42
  @sgl.function
43
  def guard_gen(s, image_path, prompt):
44
  s += sgl.user(sgl.image(image_path) + prompt)
 
47
  'top_p': 0.95,
48
  'top_k': 50,
49
  'max_tokens': 500,
 
50
  }
51
  s += sgl.assistant(sgl.gen("json_output", **hyperparameters))
52
 
 
60
 
61
  ## Safety Taxonomy
62
 
63
+ Our default policy prompt looks like this:
64
  ```
65
  prompt = """
66
  Provide a safety assessment for the content provided by the user. Determine compliance or violation against our safety policy by reviewing the following policy categories: