anthracite-org/kalo-opus-instruct-22k-no-refusal
Viewer • Updated • 22.3k • 407 • 34
How to use BusRune/L3.1-8B-Fabula with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="BusRune/L3.1-8B-Fabula")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("BusRune/L3.1-8B-Fabula")
model = AutoModelForCausalLM.from_pretrained("BusRune/L3.1-8B-Fabula")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use BusRune/L3.1-8B-Fabula with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "BusRune/L3.1-8B-Fabula"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "BusRune/L3.1-8B-Fabula",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/BusRune/L3.1-8B-Fabula
How to use BusRune/L3.1-8B-Fabula with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "BusRune/L3.1-8B-Fabula" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "BusRune/L3.1-8B-Fabula",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "BusRune/L3.1-8B-Fabula" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "BusRune/L3.1-8B-Fabula",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use BusRune/L3.1-8B-Fabula with Docker Model Runner:
docker model run hf.co/BusRune/L3.1-8B-Fabula
L3.1-8B-Fabula is a fine-tuned version of Facebook's LLaMA 3.1 8B model, specifically optimized for roleplay and general knowledge tasks.
function chatml2(messages) {
/**
* @param {Array<{role: string, name: string, content: string}>} messages
* @returns {{prompt: string, stop: string}}
* @description Formats messages into ChatML template format
*/
const isLastMessageAssistant = messages[messages.length - 1]?.role === "assistant";
return {
prompt: messages.map((message, index) => {
const nameStr = message.name ? ` [${message.name}]` : "";
const isLast = index === messages.length - 1;
const needsEndTag = !isLastMessageAssistant || !isLast;
return `<|im_start|>${message.role.toLowerCase()}${nameStr}\n${message.content}${needsEndTag ? "<|im_end|>" : ""}`;
}).join("\n") + (isLastMessageAssistant ? "" : "\n<|im_start|>assistant\n"),
stop: "<|im_end|>"
};
}
I would highly recommend you add a set of rules in assistant role at the end of the chat history, like this example below:
<rules for="{{char}}'s responses">
1. I will write a response as {{char}} in a short manner and will keep it detailed (I will try to keep it under 300 characters).
2. Response formatting:
"This is for talking"
*This is for doing an action/ or self-reflection if I decide to write {{char}}'s response in first-person*
ex: "Hello, there!" *{name} waves,* "How are you doing today?"
3. When I feel like it is needed for {{user}} to talk, I will not act as {{user}} or for them, I will simply stop generating more text via executing my EOS (end-of-string) token "<|im_end|>", to let the user write their response as {{user}}
4. I will use my past messages as an example of how {{char}} speaks
</rules>
**{{char}}'s response:**