Ryex commited on
Commit
efb746a
·
verified ·
1 Parent(s): b06a463

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +32 -8
README.md CHANGED
@@ -55,22 +55,46 @@ This model is optimized for **vLLM** and **Text-Generation-Inference**.
55
 
56
  ```python
57
  from vllm import LLM, SamplingParams
 
58
  from PIL import Image
59
 
60
- # Load Model
61
  llm = LLM(
62
- model="Ryex/Floppa-E4B-Gemma4-Uncensored",
63
  trust_remote_code=True,
64
- dtype="bfloat16"
 
65
  )
66
 
67
- # Prepare Input
 
68
  image = Image.open("test_image.jpg").convert("RGB")
69
- prompt = "<image>\nDescribe this image in detail, including any explicit elements."
70
 
71
- # Generate
72
- inputs = {"prompt": prompt, "multi_modal_data": {"image": image}}
73
- params = SamplingParams(temperature=0.7, max_tokens=1024)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  outputs = llm.generate([inputs], sampling_params=params)
76
  print(outputs[0].outputs[0].text)
 
55
 
56
  ```python
57
  from vllm import LLM, SamplingParams
58
+ from transformers import AutoProcessor
59
  from PIL import Image
60
 
61
+ model_id = "Ryex/Floppa_Gemma4-E4B-it"
62
  llm = LLM(
63
+ model=model_id,
64
  trust_remote_code=True,
65
+ dtype="bfloat16",
66
+ max_model_len=8192,
67
  )
68
 
69
+ processor = AutoProcessor.from_pretrained(model_id)
70
+
71
  image = Image.open("test_image.jpg").convert("RGB")
 
72
 
73
+ messages = [
74
+ {
75
+ "role": "user",
76
+ "content": [
77
+ {"type": "image"},
78
+ {"type": "text", "text": "Describe this image in detail, including any uncensored or explicit elements."}
79
+ ]
80
+ }
81
+ ]
82
+
83
+
84
+ prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
85
+
86
+
87
+ inputs = {
88
+ "prompt": prompt,
89
+ "multi_modal_data": {"image": image},
90
+ "mm_processor_kwargs": {"max_soft_tokens": 560}
91
+ }
92
+
93
+ params = SamplingParams(
94
+ temperature=0.7,
95
+ max_tokens=1024,
96
+ stop=["<turn|>", "<|turn|>"]
97
+ )
98
 
99
  outputs = llm.generate([inputs], sampling_params=params)
100
  print(outputs[0].outputs[0].text)