Upload model
Browse files- config.json +0 -15
- modeling_gpt.py +3 -0
config.json
CHANGED
|
@@ -7,21 +7,6 @@
|
|
| 7 |
"AutoModelForCausalLM": "modeling_gpt.GPTModelForTextGeneration"
|
| 8 |
},
|
| 9 |
"block_size": 1024,
|
| 10 |
-
"custom_pipelines": {
|
| 11 |
-
"text-generation": {
|
| 12 |
-
"default": {
|
| 13 |
-
"model": {
|
| 14 |
-
"pt": "samkeet/GPT_124M-Instruct"
|
| 15 |
-
}
|
| 16 |
-
},
|
| 17 |
-
"impl": "pipeline_gpt.GPT124MTextGenerationPipeline",
|
| 18 |
-
"pt": [
|
| 19 |
-
"AutoModelForCausalLM"
|
| 20 |
-
],
|
| 21 |
-
"tf": [],
|
| 22 |
-
"type": "text"
|
| 23 |
-
}
|
| 24 |
-
},
|
| 25 |
"model_type": "custom_gpt",
|
| 26 |
"n_embd": 768,
|
| 27 |
"n_head": 12,
|
|
|
|
| 7 |
"AutoModelForCausalLM": "modeling_gpt.GPTModelForTextGeneration"
|
| 8 |
},
|
| 9 |
"block_size": 1024,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
"model_type": "custom_gpt",
|
| 11 |
"n_embd": 768,
|
| 12 |
"n_head": 12,
|
modeling_gpt.py
CHANGED
|
@@ -284,6 +284,9 @@ class GPTModelForTextGeneration(PreTrainedModel):
|
|
| 284 |
else:
|
| 285 |
next_tokens = torch.argmax(logits, dim=-1, keepdim=True)
|
| 286 |
|
|
|
|
|
|
|
|
|
|
| 287 |
tokens = torch.cat((tokens, next_tokens), dim=1)
|
| 288 |
|
| 289 |
return tokens.flatten()
|
|
|
|
| 284 |
else:
|
| 285 |
next_tokens = torch.argmax(logits, dim=-1, keepdim=True)
|
| 286 |
|
| 287 |
+
if next_tokens.item() == 50256:
|
| 288 |
+
break
|
| 289 |
+
|
| 290 |
tokens = torch.cat((tokens, next_tokens), dim=1)
|
| 291 |
|
| 292 |
return tokens.flatten()
|