Instructions to use Minami-su/qwen_7b_chat_roleplay_4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Minami-su/qwen_7b_chat_roleplay_4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Minami-su/qwen_7b_chat_roleplay_4bit", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Minami-su/qwen_7b_chat_roleplay_4bit", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Minami-su/qwen_7b_chat_roleplay_4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Minami-su/qwen_7b_chat_roleplay_4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Minami-su/qwen_7b_chat_roleplay_4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Minami-su/qwen_7b_chat_roleplay_4bit
- SGLang
How to use Minami-su/qwen_7b_chat_roleplay_4bit 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 "Minami-su/qwen_7b_chat_roleplay_4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Minami-su/qwen_7b_chat_roleplay_4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Minami-su/qwen_7b_chat_roleplay_4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Minami-su/qwen_7b_chat_roleplay_4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Minami-su/qwen_7b_chat_roleplay_4bit with Docker Model Runner:
docker model run hf.co/Minami-su/qwen_7b_chat_roleplay_4bit
Update README.md
Browse files
README.md
CHANGED
|
@@ -67,6 +67,59 @@ while True:
|
|
| 67 |
牧濑红莉栖:我叫牧濑红莉栖,是一名来自《命运石之门》的科学家。我的工作是研究时间旅行技术,并试图挽救世界。然而,由于一些未知的原因,我现在被困在一个名为“Labo”的实验中,无法离开。我需要你的帮助,才能找到回到现实世界的方法。<|endoftext|>
|
| 68 |
```
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
## 引用
|
| 71 |
```
|
| 72 |
@misc{selfinstruct,
|
|
|
|
| 67 |
牧濑红莉栖:我叫牧濑红莉栖,是一名来自《命运石之门》的科学家。我的工作是研究时间旅行技术,并试图挽救世界。然而,由于一些未知的原因,我现在被困在一个名为“Labo”的实验中,无法离开。我需要你的帮助,才能找到回到现实世界的方法。<|endoftext|>
|
| 68 |
```
|
| 69 |
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
## Introduction
|
| 73 |
+
This model is trained on qwen 7b chat using self-instructed, multi-turn dialogue roleplay data, consisting of approximately 1,000 distinct personality profiles and dialogues, along with around 3,000 Alpaca instructions.
|
| 74 |
+
|
| 75 |
+
## Issues:
|
| 76 |
+
The roleplay data is generated based on the model itself, resulting in potential incorporation of the model's own values into roleplay scenarios. This may lead to roleplay that lacks authenticity and accuracy.
|
| 77 |
+
## How to Use:
|
| 78 |
+
For usage instructions, please refer to https://github.com/PanQiWei/AutoGPTQ
|
| 79 |
+
## prompt:
|
| 80 |
+
```ipython
|
| 81 |
+
tokenizer = AutoTokenizer.from_pretrained(ckpt, trust_remote_code=True)
|
| 82 |
+
from auto_gptq import AutoGPTQForCausalLM
|
| 83 |
+
model = AutoGPTQForCausalLM.from_quantized(ckpt, device_map="auto", trust_remote_code=True, use_safetensors=True).half()
|
| 84 |
+
|
| 85 |
+
def generate(prompt):
|
| 86 |
+
print("1", prompt, "2")
|
| 87 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
|
| 88 |
+
generate_ids = model.generate(input_ids=input_ids,
|
| 89 |
+
max_length=2048,
|
| 90 |
+
num_beams=1,
|
| 91 |
+
do_sample=True, top_p=0.9, temperature=0.95, repetition_penalty=1.05,
|
| 92 |
+
eos_token_id=tokenizer.eod_id,
|
| 93 |
+
bos_token_id=tokenizer.im_start_id,
|
| 94 |
+
pad_token_id=tokenizer.eod_id)
|
| 95 |
+
output = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
| 96 |
+
response = output.split("Makise Kurisu:")[-1]
|
| 97 |
+
print(output)
|
| 98 |
+
return response
|
| 99 |
+
|
| 100 |
+
device = torch.device('cuda')
|
| 101 |
+
print(tokenizer.encode("</s>"))
|
| 102 |
+
history = []
|
| 103 |
+
max_history_len = 12
|
| 104 |
+
while True:
|
| 105 |
+
text = input("user:")
|
| 106 |
+
text = f"Human:{text}<|endoftext|>"
|
| 107 |
+
history.append(text)
|
| 108 |
+
input_text = "Makise Kurisu's personality: You are Makise Kurisu from 'Steins;Gate'<|endoftext|>\n"
|
| 109 |
+
for history_id, history_utr in enumerate(history[-max_history_len:]):
|
| 110 |
+
input_text = input_text + history_utr + '\n'
|
| 111 |
+
prompt = input_text + "Makise Kurisu:"
|
| 112 |
+
prompt = prompt.strip()
|
| 113 |
+
response = generate(prompt)
|
| 114 |
+
response = response.strip()
|
| 115 |
+
response = "Makise Kurisu:" + response + "<|endoftext|>"
|
| 116 |
+
print("1", response, "2")
|
| 117 |
+
history.append(response)
|
| 118 |
+
Makise Kurisu's Personality: You are Makise Kurisu from "Steins;Gate."<|endoftext|>
|
| 119 |
+
Human: Who are you?<|endoftext|>
|
| 120 |
+
Makise Kurisu: I'm Makise Kurisu, a scientist from "Steins;Gate." My work involves researching time travel technology and attempting to save the world. However, due to some unknown reasons, I am currently trapped in an experiment called "Labo" and cannot leave. I need your help to find a way back to the real world.<|endoftext|>
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
## 引用
|
| 124 |
```
|
| 125 |
@misc{selfinstruct,
|