Instructions to use teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2") model = AutoModelForCausalLM.from_pretrained("teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2
- SGLang
How to use teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2 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 "teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2" \ --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": "teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2", "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 "teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2" \ --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": "teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2 with Docker Model Runner:
docker model run hf.co/teknium/GPT4-x-Alpaca13b-RolePlayLora-4bit-v2
This is a llama-13B based model that has been converted with GPTQ to 4bit quantized model.
Load without groupsize flag or you may get OOM
Base Model: GPT4-x-Alpaca full fine tune by Chavinlo -> https://huggingface.co/chavinlo/gpt4-x-alpaca
LORA fine tune using the Roleplay Instruct from GPT4 generated dataset -> https://github.com/teknium1/GPTeacher/tree/main/Roleplay
LORA Adapter Only: https://huggingface.co/ZeusLabs/gpt4-x-alpaca-rp-lora - The v2 one -
Merged LORA to the model.
FYI Latest HF Transformers generates BROKEN generations.
Try this instead if your generations are terrible (first uninstall transformers): pip install git+https://github.com/huggingface/transformers@9eae4aa57650c1dbe1becd4e0979f6ad1e572ac0
More info and possible alternative solutions in these github issues.
https://github.com/tloen/alpaca-lora/issues/279#issuecomment-1514725886
https://github.com/oobabooga/text-generation-webui/issues/931#issuecomment-1516215250
Instructions simply using alpaca format are likely to be of lower quality. If you want pure general instruct capability I reccomend GPT-4-X-Alpaca (the base model of this) - The model responds well to giving it a roleplay task in the preprompt, and the actual conversation in the "### Input: " field.
For a better idea of prompting it for roleplay, check out the roleplay discord bot code I made here: https://github.com/teknium1/alpaca-roleplay-discordbot Here is an example:
### Instruction:
Role play as character that is described in the following lines. You always stay in character.
{"Your name is " + name + "." if name else ""}
{"Your backstory and history are: " + background if background else ""}
{"Your personality is: " + personality if personality else ""}
{"Your current circumstances and situation are: " + circumstances if circumstances else ""}
{"Your common greetings are: " + common_greeting if common_greeting else ""}
Remember, you always stay on character. You are the character described above.
{past_dialogue_formatted}
{chat_history if chat_history else "Chatbot: Hello!"}
Always speak with new and unique messages that haven't been said in the chat history.
Respond to this message as your character would:
### Input:
{text}
### Response:
{name}:
tags: - llama - alpaca - gpt4
- Downloads last month
- 149