Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ logger = logging.getLogger(__name__)
|
|
| 22 |
class GPTConfig:
|
| 23 |
"""GPT model configuration"""
|
| 24 |
def __init__(self, vocab_size=32000, n_layer=6, n_head=8, n_embd=512,
|
| 25 |
-
block_size=1024, dropout=0.1, bias=
|
| 26 |
# Accept any additional kwargs to handle extra config fields
|
| 27 |
self.vocab_size = vocab_size
|
| 28 |
self.n_layer = n_layer
|
|
@@ -49,8 +49,8 @@ class GPT(nn.Module):
|
|
| 49 |
ln_f = nn.LayerNorm(config.n_embd),
|
| 50 |
))
|
| 51 |
|
| 52 |
-
# Language model head -
|
| 53 |
-
self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=
|
| 54 |
|
| 55 |
# Initialize weights
|
| 56 |
self.apply(self._init_weights)
|
|
@@ -328,7 +328,7 @@ class RealOpenLLMInference:
|
|
| 328 |
n_embd=512,
|
| 329 |
block_size=1024,
|
| 330 |
dropout=0.1,
|
| 331 |
-
bias=
|
| 332 |
)
|
| 333 |
|
| 334 |
# Load model weights
|
|
|
|
| 22 |
class GPTConfig:
|
| 23 |
"""GPT model configuration"""
|
| 24 |
def __init__(self, vocab_size=32000, n_layer=6, n_head=8, n_embd=512,
|
| 25 |
+
block_size=1024, dropout=0.1, bias=False, **kwargs):
|
| 26 |
# Accept any additional kwargs to handle extra config fields
|
| 27 |
self.vocab_size = vocab_size
|
| 28 |
self.n_layer = n_layer
|
|
|
|
| 49 |
ln_f = nn.LayerNorm(config.n_embd),
|
| 50 |
))
|
| 51 |
|
| 52 |
+
# Language model head - Use bias=False to match saved models
|
| 53 |
+
self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=False)
|
| 54 |
|
| 55 |
# Initialize weights
|
| 56 |
self.apply(self._init_weights)
|
|
|
|
| 328 |
n_embd=512,
|
| 329 |
block_size=1024,
|
| 330 |
dropout=0.1,
|
| 331 |
+
bias=False
|
| 332 |
)
|
| 333 |
|
| 334 |
# Load model weights
|