Instructions to use OpenNLPLab/HGRN-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenNLPLab/HGRN-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenNLPLab/HGRN-1B", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("OpenNLPLab/HGRN-1B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenNLPLab/HGRN-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenNLPLab/HGRN-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenNLPLab/HGRN-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OpenNLPLab/HGRN-1B
- SGLang
How to use OpenNLPLab/HGRN-1B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenNLPLab/HGRN-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenNLPLab/HGRN-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenNLPLab/HGRN-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenNLPLab/HGRN-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OpenNLPLab/HGRN-1B with Docker Model Runner:
docker model run hf.co/OpenNLPLab/HGRN-1B
Commit ·
f0495dd
1
Parent(s): 5e3270b
Update README.md
Browse files
README.md
CHANGED
|
@@ -8,20 +8,30 @@ tags:
|
|
| 8 |
- Recurrent Neural Network
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
- [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
## Overall Architecture
|
|
|
|
| 8 |
- Recurrent Neural Network
|
| 9 |
---
|
| 10 |
|
| 11 |
+
<div align="center">
|
| 12 |
+
<h1>
|
| 13 |
+
HGRN - Hierarchically Gated Recurrent Neural Network for Sequence Modeling
|
| 14 |
+
</h1>
|
| 15 |
+
</div>
|
| 16 |
+
|
| 17 |
+
<p align="center">
|
| 18 |
+
💻 <a href="https://github.com/OpenNLPLab/HGRN" target="_blank">GitHub </a>
|
| 19 |
+
</p>
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
- [Overall Architecture](#overall-architecture)
|
| 23 |
+
- [Experiments](#experiments)
|
| 24 |
+
- [Environment Preparation](#environment-preparation)
|
| 25 |
+
- [Env1](#env1)
|
| 26 |
+
- [Env2](#env2)
|
| 27 |
+
- [Autoregressive language model](#autoregressive-language-model)
|
| 28 |
+
- [1) Preprocess the data](#1-preprocess-the-data)
|
| 29 |
+
- [2) Train the autoregressive language model](#2-train-the-autoregressive-language-model)
|
| 30 |
+
- [Image modeling](#image-modeling)
|
| 31 |
+
- [LRA](#lra)
|
| 32 |
+
- [1) Preparation](#1-preparation)
|
| 33 |
+
- [2) Training](#2-training)
|
| 34 |
+
- [Standalone code](#standalone-code)
|
| 35 |
|
| 36 |
|
| 37 |
## Overall Architecture
|