cartmoney commited on
Commit
c86d848
Β·
1 Parent(s): 3c05091

Add model verification logging and update system message

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -17,6 +17,13 @@ model, tokenizer = FastLanguageModel.from_pretrained(
17
  # Enable inference mode
18
  FastLanguageModel.for_inference(model)
19
 
 
 
 
 
 
 
 
20
 
21
  def respond(
22
  message,
@@ -29,6 +36,9 @@ def respond(
29
  """
30
  Generate responses using the CartCode-1 LoRA model via Unsloth
31
  """
 
 
 
32
  # Build the conversation with system message
33
  messages = [{"role": "system", "content": system_message}]
34
  messages.extend(history)
@@ -77,7 +87,7 @@ chatbot = gr.ChatInterface(
77
  respond,
78
  type="messages",
79
  additional_inputs=[
80
- gr.Textbox(value="You are a helpful coding assistant.", label="System message"),
81
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
82
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
83
  gr.Slider(
@@ -89,7 +99,7 @@ chatbot = gr.ChatInterface(
89
  ),
90
  ],
91
  title="CartCode-1 Chat",
92
- description="Chat with CartCode-1, a coding assistant powered by a LoRA adapter model loaded via Unsloth.",
93
  )
94
 
95
  with gr.Blocks() as demo:
 
17
  # Enable inference mode
18
  FastLanguageModel.for_inference(model)
19
 
20
+ # Print model info for verification
21
+ print(f"βœ… Loaded model: cartmoney/CartCode-1")
22
+ print(f"πŸ“Š Model type: {type(model).__name__}")
23
+ print(f"πŸ”§ Base model config: {model.config.name_or_path if hasattr(model.config, 'name_or_path') else 'N/A'}")
24
+ print(f"πŸ’Ύ Device: {model.device}")
25
+ print(f"πŸ“ Tokenizer: {tokenizer.name_or_path}")
26
+
27
 
28
  def respond(
29
  message,
 
36
  """
37
  Generate responses using the CartCode-1 LoRA model via Unsloth
38
  """
39
+ print(f"\nπŸ”΅ Generating response with cartmoney/CartCode-1")
40
+ print(f"πŸ“ User message: {message[:50]}...")
41
+
42
  # Build the conversation with system message
43
  messages = [{"role": "system", "content": system_message}]
44
  messages.extend(history)
 
87
  respond,
88
  type="messages",
89
  additional_inputs=[
90
+ gr.Textbox(value="You are a helpful coding assistant named CartCode-1. You were created by cartmoney and are based on a LoRA adapter model.", label="System message"),
91
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
92
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
93
  gr.Slider(
 
99
  ),
100
  ],
101
  title="CartCode-1 Chat",
102
+ description=f"πŸ€– **Model:** cartmoney/CartCode-1 (LoRA adapter)\n\nπŸ”§ **Loaded via:** Unsloth with 4-bit quantization\n\nπŸ’¬ Chat with CartCode-1, a coding assistant!",
103
  )
104
 
105
  with gr.Blocks() as demo: