Downloads · 30 days
15
1% of all-time downloads
prithivMLmods/QwQ-4B-Instruct
QwQ-4B-Instruct is a text generation model from prithivMLmods. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
<pre align="center" . \ \ \ \ / | | \ | / / \ \ \ \/ \/ / / / \ \ / | | | \ / \/. \ \ / / \/. \ // / ^ / | \\ \ \\ \/ \/\/ \\ \/ \ | | / \ \ || \/
Downloads · 30 days
15
1% of all-time downloads
All-time downloads
1.2K
Public
Parameters
7.8B
5.6 GB on disk
Likes
7
Public
Click a slice to open those files.
.safetensors5.5 GB · 100%
How the weights are stored.
U86.7B · 86%
From the Hugging Face model README
The QwQ-4B-Instruct is a lightweight and efficient fine-tuned language model for instruction-following tasks and reasoning. It is based on a quantized version of the Qwen2.5-7B model, optimized for inference speed and reduced memory consumption, while retaining robust capabilities for complex tasks.
With its robust natural language processing capabilities, QwQ-4B-Instruct excels in generating step-by-step solutions, creative content, and logical analyses. Its architecture integrates advanced understanding of both structured and unstructured data, ensuring precise text generation aligned with user inputs.
Here provides a code snippet with apply_chat_template to show you how to load the tokenizer and model and how to generate contents.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "prithivMLmods/QwQ-4B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
Ollama makes running machine learning models simple and efficient. Follow these steps to set up and run your GGUF models quickly.
| Step | Description | Command / Instructions |
|---|---|---|
| 1 | Install Ollama 🦙 | Download Ollama from https://ollama.com/download and install it on your system. |
| 2 | Create Your Model File | - Create a file named after your model, e.g., metallama. |
| - Add the following line to specify the base model: | ||
| ```bash | ||
| FROM Llama-3.2-1B.F16.gguf | ||
| ``` | ||
| - Ensure the base model file is in the same directory. | ||
| 3 | Create and Patch the Model | Run the following commands to create and verify your model: |
| ```bash | ||
| ollama create metallama -f ./metallama | ||
| ollama list | ||
| ``` | ||
| 4 | Run the Model | Use the following command to start your model: |
| ```bash | ||
| ollama run metallama | ||
| ``` | ||
| 5 | Interact with the Model | Once the model is running, interact with it: |
| ```plaintext | ||
| >>> Tell me about Space X. | ||
| Space X, the private aerospace company founded by Elon Musk, is revolutionizing space exploration... | ||
| ``` |
With Ollama, running and interacting with models is seamless. Start experimenting today!