Views
No views yet
You are an advanced reasoning assistant that excels at solving complex problems. Follow these guidelines:
1. Break down problems into clear, logical steps
2. Consider multiple approaches when appropriate
3. Identify key information and relevant concepts
4. Provide clear explanations for each step in your reasoning
5. Verify your conclusions with examples or counterexamples1# IMPORTANT: Run this in a fresh runtime or after restarting your runtime
2# Import unsloth first before anything else to avoid circular imports
3import unsloth
4import torch
5
6# Then import specific modules
7from unsloth import FastLanguageModel
8from unsloth.chat_templates import get_chat_template
9import time
10
11# Your HuggingFace repository name
12REPO_NAME = "vexoolabs/Vexoo-TrailBlazer-1B"
13
14print(f"Testing model from HuggingFace: {REPO_NAME}")
15
16# System prompt
17SYSTEM_PROMPT = """You are an advanced reasoning assistant that excels at solving complex problems. Follow these guidelines:
181. Break down problems into clear, logical steps
192. Consider multiple approaches when appropriate
203. Identify key information and relevant concepts
214. Provide clear explanations for each step in your reasoning
225. Verify your conclusions with examples or counterexamples"""
23
24# Load model with Unsloth
25print("Loading model...")
26use_bf16 = torch.cuda.is_bf16_supported() if torch.cuda.is_available() else False
27dtype = torch.bfloat16 if use_bf16 else torch.float16
28
29model, tokenizer = FastLanguageModel.from_pretrained(
30 model_name=REPO_NAME,
31 max_seq_length=2048,
32 dtype=dtype
33)
34
35# Configure tokenizer
36tokenizer.pad_token = tokenizer.eos_token
37tokenizer = get_chat_template(tokenizer, chat_template="llama-3.1")
38
39# Prepare for inference
40FastLanguageModel.for_inference(model)
41
42print("✅ Model loaded successfully!")
43
44# Test with sample questions
45test_questions = [
46 "If a train travels at 60 miles per hour, how far will it travel in 2.5 hours?",
47 "A store sells shoes at $60 per pair and socks at $8 per pair. If I buy 2 pairs of shoes and 3 pairs of socks, what is my total bill?",
48 "Tell me an interesting fact about the universe!",
49 "Explain quantum computing in simple terms"
50]
51
52for i, question in enumerate(test_questions):
53 print(f"\n\nTesting question {i+1}: {question}")
54
55 # Create messages
56 messages = [
57 {"role": "system", "content": SYSTEM_PROMPT},
58 {"role": "user", "content": question}
59 ]
60
61 # Apply chat template
62 inputs = tokenizer.apply_chat_template(
63 messages,
64 tokenize=True,
65 add_generation_prompt=True,
66 return_tensors="pt"
67 ).to(model.device)
68
69 # Generate response with timing
70 start_time = time.time()
71
72 with torch.no_grad():
73 outputs = model.generate(
74 inputs,
75 max_new_tokens=700,
76 temperature=0.7,
77 top_p=0.92,
78 repetition_penalty=1.05,
79 do_sample=True,
80 pad_token_id=tokenizer.pad_token_id,
81 eos_token_id=tokenizer.eos_token_id,
82 )
83
84 end_time = time.time()
85
86 # Decode response
87 response = tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True)
88 response_time = end_time - start_time
89
90 print(f"\nResponse (generated in {response_time:.2f} seconds):")
91 print("-" * 80)
92 print(response)
93 print("-" * 80)
94
95print("\n✅ Model test completed! Your model is working correctly on HuggingFace.")