Instructions to use AL-GR/Forge-T5-Base-s1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AL-GR/Forge-T5-Base-s1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AL-GR/Forge-T5-Base-s1")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("AL-GR/Forge-T5-Base-s1") model = AutoModelForSeq2SeqLM.from_pretrained("AL-GR/Forge-T5-Base-s1") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AL-GR/Forge-T5-Base-s1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AL-GR/Forge-T5-Base-s1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AL-GR/Forge-T5-Base-s1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AL-GR/Forge-T5-Base-s1
- SGLang
How to use AL-GR/Forge-T5-Base-s1 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 "AL-GR/Forge-T5-Base-s1" \ --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": "AL-GR/Forge-T5-Base-s1", "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 "AL-GR/Forge-T5-Base-s1" \ --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": "AL-GR/Forge-T5-Base-s1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AL-GR/Forge-T5-Base-s1 with Docker Model Runner:
docker model run hf.co/AL-GR/Forge-T5-Base-s1
Configuration Parsing Warning:Config file tokenizer_config.json cannot be fetched (too big)
Forge-T5-Base-s1
This model is initialized from the pre-trained google-t5/t5-base and fine-tuned on the AL-GR/AL-GR-v1 dataset using the FORGE framework for 4 training epochs.
More details can be found in the paper FORGE: Forming Semantic Identifiers for Generative Retrieval in Industrial Datasets.
Official Code: GitHub Repository
Evaluation Results on AL-GR/AL-GR-v1
| Model | HR@20 | HR@100 | HR@500 | HR@1000 |
|---|---|---|---|---|
| Forge-Qwen 2.5-0.5B-Base-s1 | 0.0506 | 0.1277 | 0.2602 | 0.3068 |
| Forge-T5-Base-s1 | 0.0284 | 0.0689 | 0.1372 | 0.1557 |
Note: HR@K denotes Hit Rate at K — the proportion of test queries for which the correct answer appears in the top-K retrieved/generated results.
Usage
1. Download the Model
You can download this model locally using the huggingface_hub library:
import os
os.environ["HF_ENDPOINT"] = "https://hf-mirror.com" # Optional: use mirror for faster download in some regions
os.environ["KMP_DUPLICATE_LIB_OK"] = "True"
from huggingface_hub import snapshot_download
snapshot_download(
repo_id='AL-GR/Forge-T5-Base-s1',
local_dir='{YOUR_LOCAL_DIR}', # Replace with your desired local path
local_dir_use_symlinks=False,
)
2. Update Configuration
After downloading, update the configuration file used by the FORGE framework. Specifically, replace the load_checkpoint_from field in the JSON config file:
File: algr/config/generate_t5base_3layer_tiny.json
Update to:
"load_checkpoint_from": "{YOUR_LOCAL_DIR}"
Replace
{YOUR_LOCAL_DIR}with the actual local path where you downloaded the model.
For more details about the training setup, dataset, or evaluation protocol, please refer to the FORGE framework repository.
Citation
If you find this work helpful, please cite the following paper:
@article{fu2025forge,
title={FORGE: Forming Semantic Identifiers for Generative Retrieval in Industrial Datasets},
author={Fu, Kairui and Zhang, Tao and Xiao, Shuwen and Wang, Ziyang and Zhang, Xinming and Zhang, Chenchi and Yan, Yuliang and Zheng, Junjun and others},
journal={arXiv preprint arXiv:2509.20904},
year={2025}
}
- Downloads last month
- 21