Upload folder using huggingface_hub
Browse files- README.md +38 -0
- config.json +19 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- special_tokens_map.json +6 -0
- tokenizer.json +0 -0
- tokenizer_config.json +21 -0
- vocab.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MAX Custom Architecture Example
|
| 2 |
+
|
| 3 |
+
This is a simple demonstration model for the `MyCustomModelForCausalLM` architecture used in the MAX custom architecture example.
|
| 4 |
+
|
| 5 |
+
## Model Details
|
| 6 |
+
|
| 7 |
+
- **Architecture**: MyCustomModelForCausalLM
|
| 8 |
+
- **Parameters**: ~289,280
|
| 9 |
+
- **Vocab Size**: 1000
|
| 10 |
+
- **Hidden Size**: 128
|
| 11 |
+
- **Layers**: 2
|
| 12 |
+
|
| 13 |
+
## Usage with MAX
|
| 14 |
+
|
| 15 |
+
```bash
|
| 16 |
+
max generate \
|
| 17 |
+
--model-path rachfop/max-custom-architecture-example \
|
| 18 |
+
--custom-architectures /path/to/max/examples/custom-model-architectures \
|
| 19 |
+
--prompt "Hello world" \
|
| 20 |
+
--max-new-tokens 10
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
## Purpose
|
| 24 |
+
|
| 25 |
+
This model is intended for demonstration purposes to show how to:
|
| 26 |
+
1. Create a custom model architecture for MAX
|
| 27 |
+
2. Upload it to Hugging Face
|
| 28 |
+
3. Load and use it with MAX's custom architecture system
|
| 29 |
+
|
| 30 |
+
The model generates random outputs and is not trained for any specific task.
|
| 31 |
+
|
| 32 |
+
## Architecture Implementation
|
| 33 |
+
|
| 34 |
+
See the [MAX custom architecture example](https://github.com/modularml/max/tree/main/examples/custom-model-architectures) for the complete implementation including:
|
| 35 |
+
- Model definition (`model.py`)
|
| 36 |
+
- Architecture registration (`arch.py`)
|
| 37 |
+
- Configuration handling (`model_config.py`)
|
| 38 |
+
- Weight adapters (`weight_adapters.py`)
|
config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"MyCustomModelForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"model_type": "my_custom_model",
|
| 6 |
+
"vocab_size": 1000,
|
| 7 |
+
"hidden_size": 128,
|
| 8 |
+
"num_hidden_layers": 2,
|
| 9 |
+
"num_attention_heads": 4,
|
| 10 |
+
"intermediate_size": 256,
|
| 11 |
+
"max_position_embeddings": 512,
|
| 12 |
+
"dropout_rate": 0.1,
|
| 13 |
+
"bos_token_id": 1,
|
| 14 |
+
"eos_token_id": 2,
|
| 15 |
+
"pad_token_id": 0,
|
| 16 |
+
"tie_word_embeddings": false,
|
| 17 |
+
"torch_dtype": "float32",
|
| 18 |
+
"transformers_version": "4.44.0"
|
| 19 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa0587a64283fc51a989c0e1cf4b273553e46a86efc8e22cc7933d20686ba5f7
|
| 3 |
+
size 1157768
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": "<|endoftext|>",
|
| 3 |
+
"eos_token": "<|endoftext|>",
|
| 4 |
+
"pad_token": "<|endoftext|>",
|
| 5 |
+
"unk_token": "<|endoftext|>"
|
| 6 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"added_tokens_decoder": {
|
| 4 |
+
"50256": {
|
| 5 |
+
"content": "<|endoftext|>",
|
| 6 |
+
"lstrip": false,
|
| 7 |
+
"normalized": true,
|
| 8 |
+
"rstrip": false,
|
| 9 |
+
"single_word": false,
|
| 10 |
+
"special": true
|
| 11 |
+
}
|
| 12 |
+
},
|
| 13 |
+
"bos_token": "<|endoftext|>",
|
| 14 |
+
"clean_up_tokenization_spaces": false,
|
| 15 |
+
"eos_token": "<|endoftext|>",
|
| 16 |
+
"extra_special_tokens": {},
|
| 17 |
+
"model_max_length": 1024,
|
| 18 |
+
"pad_token": "<|endoftext|>",
|
| 19 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 20 |
+
"unk_token": "<|endoftext|>"
|
| 21 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|