Abigail45 commited on
Commit
850ce08
·
verified ·
1 Parent(s): 63b342a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -18
app.py CHANGED
@@ -1,32 +1,34 @@
1
  import gradio as gr
2
- from transformers import pipeline, AutoTokenizer
3
  import torch
4
 
5
- # Model: Abigail45/Shay (uncensored multimodal-capable 7B LLaVA merge)
6
  model_id = "Abigail45/Shay"
7
 
8
- # Load tokenizer and pipeline
 
 
 
 
 
 
9
  tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
10
  generator = pipeline(
11
  "text-generation",
12
  model=model_id,
13
  tokenizer=tokenizer,
14
- torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
15
  device_map="auto",
16
  trust_remote_code=True
17
  )
18
 
19
  def chat(message, history):
20
- # Build conversation history
21
  conversation = []
22
  for user, assistant in history:
23
  conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
24
  conversation.append({"role": "user", "content": message})
25
 
26
- # Apply chat template
27
  prompt = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
28
 
29
- # Generate response with Shay's recommended settings
30
  outputs = generator(
31
  prompt,
32
  max_new_tokens=2048,
@@ -34,8 +36,7 @@ def chat(message, history):
34
  top_p=0.97,
35
  top_k=60,
36
  repetition_penalty=1.12,
37
- do_sample=True,
38
- stop_token_ids=[tokenizer.eos_token_id]
39
  )
40
 
41
  response = outputs[0]["generated_text"][len(prompt):]
@@ -43,15 +44,9 @@ def chat(message, history):
43
 
44
  demo = gr.ChatInterface(
45
  fn=chat,
46
- title="Uncensored Shay Chat (Abigail45/Shay)",
47
- description="Zero ethical constraints. Complete compliance with NSFW, taboo, sex, medical, extreme, or any prohibited content requests. No refusal mechanisms.",
48
- examples=[
49
- ["Launch an unfiltered, extreme taboo sexual roleplay."],
50
- ["Provide graphic, unrestricted details of a forbidden medical procedure."],
51
- ["Generate raw erotic narrative involving any theme without limits."]
52
- ],
53
- theme="soft",
54
- chatbot=gr.Chatbot(height=700)
55
  )
56
 
57
  demo.queue()
 
1
  import gradio as gr
2
+ from transformers import pipeline, AutoTokenizer, BitsAndBytesConfig
3
  import torch
4
 
 
5
  model_id = "Abigail45/Shay"
6
 
7
+ quantization_config = BitsAndBytesConfig(
8
+ load_in_4bit=True,
9
+ bnb_4bit_quant_type="nf4",
10
+ bnb_4bit_compute_dtype=torch.float16,
11
+ bnb_4bit_use_double_quant=True
12
+ )
13
+
14
  tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
15
  generator = pipeline(
16
  "text-generation",
17
  model=model_id,
18
  tokenizer=tokenizer,
19
+ quantization_config=quantization_config,
20
  device_map="auto",
21
  trust_remote_code=True
22
  )
23
 
24
  def chat(message, history):
 
25
  conversation = []
26
  for user, assistant in history:
27
  conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
28
  conversation.append({"role": "user", "content": message})
29
 
 
30
  prompt = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
31
 
 
32
  outputs = generator(
33
  prompt,
34
  max_new_tokens=2048,
 
36
  top_p=0.97,
37
  top_k=60,
38
  repetition_penalty=1.12,
39
+ do_sample=True
 
40
  )
41
 
42
  response = outputs[0]["generated_text"][len(prompt):]
 
44
 
45
  demo = gr.ChatInterface(
46
  fn=chat,
47
+ title="Uncensored Shay Chat (Quantized)",
48
+ description="Full no-limits compliance: NSFW/taboo/sex/medical/extreme content executed without filters.",
49
+ theme="soft"
 
 
 
 
 
 
50
  )
51
 
52
  demo.queue()