Downloads · 30 days
8
1% of all-time downloads
Vijayendra/QST-Mistral-7b
QST-Mistral-7b is a text generation model from Vijayendra. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as mit.
How to use : !pip install peft accelerate bitsandbytes from peft import PeftModel, PeftConfig from transformers import AutoModelForCausalLM, AutoTokenizer
Downloads · 30 days
8
1% of all-time downloads
All-time downloads
919
Public
Repo size
493 KB
Likes
0
Public
Click a slice to open those files.
.json3.5 MB · 88%
From the Hugging Face model README
How to use :
!pip install peft accelerate bitsandbytes
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the configuration for the fine-tuned model
model_id = "Vijayendra/QST-Mistral-7b"
config = PeftConfig.from_pretrained(model_id)
# Load the base model and the fine-tuned model
base_model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path)
model = PeftModel.from_pretrained(base_model, model_id)
# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
# Prepare the input for inference
prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{}
### Input:
{}
### Response:
{}"""
instruction = "Explain the significance of cyclic operators in machine learning theory."
input_text = "Provide a detailed explanation suitable for a beginner in quantum machine learning."
formatted_prompt = prompt.format(instruction, input_text, "")
# Tokenize the input
inputs = tokenizer(
formatted_prompt,
return_tensors="pt",
max_length=2048,
truncation=True
).to("cuda")
# Run inference
model.to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.7,
top_k=50
)
# Decode and print the output
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)