lemms commited on
Commit
9097f4e
·
verified ·
1 Parent(s): b4d9274

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,6 +1,6 @@
1
  #!/usr/bin/env python3
2
  """
3
- OpenLLM Real Models App - Final working version with correct attribute naming
4
  """
5
 
6
  import gradio as gr
@@ -49,8 +49,8 @@ class GPT(nn.Module):
49
  ln_f = nn.LayerNorm(config.n_embd),
50
  ))
51
 
52
- # Language model head - MUST have bias to match saved model
53
- self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=True)
54
 
55
  # Initialize weights
56
  self.apply(self._init_weights)
@@ -133,7 +133,7 @@ class Block(nn.Module):
133
  return x
134
 
135
  class CausalSelfAttention(nn.Module):
136
- """Multi-head self-attention with causal masking - FINAL WORKING VERSION"""
137
  def __init__(self, config):
138
  super().__init__()
139
  assert config.n_embd % config.n_head == 0
 
1
  #!/usr/bin/env python3
2
  """
3
+ OpenLLM Real Models App - Ultimate working version with correct lm_head bias handling
4
  """
5
 
6
  import gradio as gr
 
49
  ln_f = nn.LayerNorm(config.n_embd),
50
  ))
51
 
52
+ # Language model head - NO bias to match saved model
53
+ self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False)
54
 
55
  # Initialize weights
56
  self.apply(self._init_weights)
 
133
  return x
134
 
135
  class CausalSelfAttention(nn.Module):
136
+ """Multi-head self-attention with causal masking - ULTIMATE WORKING VERSION"""
137
  def __init__(self, config):
138
  super().__init__()
139
  assert config.n_embd % config.n_head == 0