Views
No views yet
1from unsloth import FastLanguageModel
2import torch
3
4# Load model and tokenizer
5model, tokenizer = FastLanguageModel.from_pretrained(
6 model_name="theprint/Pythonified-Llama-3.2-3B-Instruct",
7 max_seq_length=4096,
8 dtype=None,
9 load_in_4bit=True,
10)
11
12# Enable inference mode
13FastLanguageModel.for_inference(model)
14
15# Example usage
16inputs = tokenizer(["Your prompt here"], return_tensors="pt")
17outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
18response = tokenizer.decode(outputs[0], skip_special_tokens=True)
19print(response)1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model = AutoModelForCausalLM.from_pretrained(
5 "theprint/Pythonified-Llama-3.2-3B-Instruct",
6 torch_dtype=torch.float16,
7 device_map="auto"
8)
9tokenizer = AutoTokenizer.from_pretrained("theprint/Pythonified-Llama-3.2-3B-Instruct")
10
11# Example usage
12messages = [
13 {"role": "system", "content": "You are a helpful assistant."},
14 {"role": "user", "content": "Your question here"}
15]
16
17inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
18outputs = model.generate(inputs, max_new_tokens=256, temperature=0.7, do_sample=True)
19response = tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True)
20print(response)gguf/ directory for use with llama.cpp:Pythonified-Llama-3.2-3B-Instruct-f16.gguf (6135.6 MB) - 16-bit float (original precision, largest file)Pythonified-Llama-3.2-3B-Instruct-q3_k_m.gguf (1609.0 MB) - 3-bit quantization (medium quality)Pythonified-Llama-3.2-3B-Instruct-q4_k_m.gguf (1925.8 MB) - 4-bit quantization (medium, recommended for most use cases)Pythonified-Llama-3.2-3B-Instruct-q5_k_m.gguf (2214.6 MB) - 5-bit quantization (medium, good quality)Pythonified-Llama-3.2-3B-Instruct-q6_k.gguf (2521.4 MB) - 6-bit quantization (high quality)Pythonified-Llama-3.2-3B-Instruct-q8_0.gguf (3263.4 MB) - 8-bit quantization (very high quality)1# Download a quantized version (q4_k_m recommended for most use cases)
2wget https://huggingface.co/theprint/Pythonified-Llama-3.2-3B-Instruct/resolve/main/gguf/Pythonified-Llama-3.2-3B-Instruct-q4_k_m.gguf
3
4# Run with llama.cpp
5./llama.cpp/main -m Pythonified-Llama-3.2-3B-Instruct-q4_k_m.gguf -p "Your prompt here" -n 2561@misc{pythonified_llama_3.2_3b_instruct,
2 title={Pythonified-Llama-3.2-3B-Instruct: Fine-tuned meta-llama/Llama-3.2-3B-Instruct},
3 author={theprint},
4 year={2025},
5 publisher={Hugging Face},
6 url={https://huggingface.co/theprint/Pythonified-Llama-3.2-3B-Instruct}
7}