Text Generation
Transformers
Safetensors
English
Japanese
mistral
Merge
lorablated
conversational
text-generation-inference
Instructions to use yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated") model = AutoModelForCausalLM.from_pretrained("yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated", device_map="auto") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated
- SGLang
How to use yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated 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 "yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated" \ --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": "yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated" \ --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": "yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated with Docker Model Runner:
docker model run hf.co/yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated
Merged Model
This model is a combination of:
- Base Model:
shisa-ai/shisa-v2-mistral-nemo-12b - LoRA Adapter:
nbeerbower/Mistral-Nemo-12B-abliterated-LORA
The model is saved in bfloat16 format and is ready for deployment or fine-tuning.
Code for LoRA merging (Generated by Qwen3)
import argparse
import os
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
def main():
parser = argparse.ArgumentParser(description="Merge a LoRA into a large language model.")
parser.add_argument("--model_name", type=str, required=True, help="Name or path of the base model.")
parser.add_argument("--lora_name", type=str, required=True, help="Name or path of the LoRA adapter.")
parser.add_argument("--output_model_name", type=str, required=True, help="Output directory for the merged model.")
args = parser.parse_args()
# Load the base model in bfloat16
print("Loading base model...")
base_model = AutoModelForCausalLM.from_pretrained(
args.model_name,
torch_dtype="bfloat16"
)
# Load the LoRA adapter
print("Loading LoRA adapter...")
peft_model = PeftModel.from_pretrained(base_model, args.lora_name)
# Merge and unload the LoRA weights into the base model
print("Merging LoRA into base model...")
merged_model = peft_model.merge_and_unload()
# Save the merged model
print(f"Saving merged model to {args.output_model_name}...")
merged_model.save_pretrained(args.output_model_name)
# Save the tokenizer from the base model
tokenizer = AutoTokenizer.from_pretrained(args.model_name)
tokenizer.save_pretrained(args.output_model_name)
# Create README.md file
print("Creating README.md...")
readme_content = f"""# Merged Model
This model is a combination of:
- **Base Model**: `{args.model_name}`
- **LoRA Adapter**: `{args.lora_name}`
The model is saved in `bfloat16` format and is ready for deployment or fine-tuning.
"""
readme_path = os.path.join(args.output_model_name, "README.md")
with open(readme_path, "w") as f:
f.write(readme_content)
print("✅ Merging complete. Model saved to:", args.output_model_name)
if __name__ == "__main__":
main()
- Downloads last month
- 137
Model tree for yamatazen/Shisa-v2-Mistral-Nemo-12B-Lorablated
Merge model
this model