Add sample usage section with inference code
Browse filesThis PR enhances the model card by adding a "Sample Usage" section, directly incorporating an inference code snippet from the official GitHub repository. This will allow users to quickly get started with the model.
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
language:
|
| 4 |
- en
|
|
|
|
|
|
|
| 5 |
pipeline_tag: text-generation
|
| 6 |
-
base_model: Qwen/Qwen2.5-14B
|
| 7 |
tags:
|
| 8 |
- chat
|
| 9 |
-
library_name: transformers
|
| 10 |
---
|
| 11 |
|
| 12 |
<p align="left">
|
|
@@ -36,7 +36,7 @@ This repository hosts the model weights for AHN. For installation, usage instruc
|
|
| 36 |
<p align="left">
|
| 37 |
<img src="https://huggingface.co/datasets/whyu/misc/resolve/main/AHN/method.png" width="700">
|
| 38 |
</p>
|
| 39 |
-
**(a)** Illustration of the model augmented with Artificial Hippocampus Networks (AHNs). In this example, the sliding window length is 3. When the input sequence length is less than or equal to the window length, the model operates identically to a standard Transformer. For longer sequences, AHNs continually compress the token outside the window into a compact memory representation. The model then utilizes both the lossless information within window, and the compressed memory to generate the next token. **(b)** Self-distillation training framework of AHNs based on an open-weight LLM. During training, the base LLM
|
| 40 |
|
| 41 |
### Model Zoo
|
| 42 |
| base model | AHN module | #params | checkpoint (AHN only) |
|
|
@@ -51,6 +51,17 @@ This repository hosts the model weights for AHN. For installation, usage instruc
|
|
| 51 |
| Qwen2.5-14B-Instruct | DeltaNet | 511M | [🤗model](https://huggingface.co/ByteDance-Seed/AHN-DN-for-Qwen-2.5-Instruct-14B) |
|
| 52 |
| Qwen2.5-14B-Instruct | GatedDeltaNet | 610M | [🤗model](https://huggingface.co/ByteDance-Seed/AHN-GDN-for-Qwen-2.5-Instruct-14B) |
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
### Evaluation
|
| 55 |
|
| 56 |
#### LV-Eval & InfiniteBench Results
|
|
|
|
| 1 |
---
|
| 2 |
+
base_model: Qwen/Qwen2.5-14B
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
license: apache-2.0
|
| 7 |
pipeline_tag: text-generation
|
|
|
|
| 8 |
tags:
|
| 9 |
- chat
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
<p align="left">
|
|
|
|
| 36 |
<p align="left">
|
| 37 |
<img src="https://huggingface.co/datasets/whyu/misc/resolve/main/AHN/method.png" width="700">
|
| 38 |
</p>
|
| 39 |
+
**(a)** Illustration of the model augmented with Artificial Hippocampus Networks (AHNs). In this example, the sliding window length is 3. When the input sequence length is less than or equal to the window length, the model operates identically to a standard Transformer. For longer sequences, AHNs continually compress the token outside the window into a compact memory representation. The model then utilizes both the lossless information within window, and the compressed memory to generate the next token. **(b)** Self-distillation training framework of AHNs based on an open-weight LLM. During training, the base LLM’s weights are frozen, and only the AHNs’ parameters are trained.
|
| 40 |
|
| 41 |
### Model Zoo
|
| 42 |
| base model | AHN module | #params | checkpoint (AHN only) |
|
|
|
|
| 51 |
| Qwen2.5-14B-Instruct | DeltaNet | 511M | [🤗model](https://huggingface.co/ByteDance-Seed/AHN-DN-for-Qwen-2.5-Instruct-14B) |
|
| 52 |
| Qwen2.5-14B-Instruct | GatedDeltaNet | 610M | [🤗model](https://huggingface.co/ByteDance-Seed/AHN-GDN-for-Qwen-2.5-Instruct-14B) |
|
| 53 |
|
| 54 |
+
### Sample Usage
|
| 55 |
+
|
| 56 |
+
To run inference, you first need to merge the base model with the AHN weights. For more details on the merging process, please refer to the [GitHub repository](https://github.com/ByteDance-Seed/AHN). Once merged, you can perform inference using the following example:
|
| 57 |
+
|
| 58 |
+
```bash
|
| 59 |
+
PROMPT="When was the concept of AI introduced?"
|
| 60 |
+
CUDA_VISIBLE_DEVICES=0 python ./examples/scripts/inference.py \
|
| 61 |
+
--model $MERGED_MODEL_PATH \
|
| 62 |
+
--prompt "$PROMPT"
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
### Evaluation
|
| 66 |
|
| 67 |
#### LV-Eval & InfiniteBench Results
|