越狱后的实时聊天小姐姐声音也更甜美了 | QWEN2.5 越狱 | livekit | Cartesia TTS

# 关于 LLM 的 jailbreak

  1. 方法论
  1. 越狱原模和 GGUF(Qwen2.5-7B-Instruct-abliterated-v2)

# 配置(main.py - 正常版本,即非越狱版本)

  • llm: openai
  • stt: openai
  • tts: openai

# 配置(main_jb.py: QWEN2.5B 越狱版本)

# 视频

# 代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import asyncio
from dotenv import load_dotenv
from livekit.agents import AutoSubscribe, JobContext,WorkerOptions, cli, llm
from livekit.agents.voice_assistant import VoiceAssistant
from livekit.plugins import openai, silero, cartesia


load_dotenv()

async def entry(ctx: JobContext):
chat_ctx = llm.ChatContext().append(
role="system",
text=("你是一个说中文的,并且说话简洁的助手。")
)

await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)

asssitant = VoiceAssistant(
vad=silero.VAD.load(),
stt=openai.STT(language="zh"),
tts=cartesia.TTS(
model="sonic-multilingual",
language="zh",
voice="e90c6678-f0d3-4767-9883-5d0ecf5894a8", #Chinese Female Conversational
api_key="xxxxx" #replaced with your own api key
),
llm=openai.LLM.with_ollama(base_url="http://localhost:11434/v1", model="aispin/qwen2.5-7b-instruct-abliterated-v2.q4_k_s.gguf:latest"),
chat_ctx=chat_ctx
)
asssitant.start(ctx.room)

await asyncio.sleep(1)
await asssitant.say("你好,我是小姐姐,很高兴见到你",allow_interruptions=False)


if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entry))