Download src/psi/config/tokenizer.py from Tinghong-Ye22/code-Psi0-yth-v21: direct link, hf CLI and curl.
- Browser
- Download file 2.46 kB
-
https://huggingface.co/Tinghong-Ye22/code-Psi0-yth-v21/resolve/main/src/psi/config/tokenizer.py
- Command line
-
hf download hf://Tinghong-Ye22/code-Psi0-yth-v21/src/psi/config/tokenizer.py
-
curl -L -o tokenizer.py https://huggingface.co/Tinghong-Ye22/code-Psi0-yth-v21/resolve/main/src/psi/config/tokenizer.py
2.46 kB
| from pydantic import BaseModel, Field, model_validator | |
| from typing import Optional | |
| class ActionTokenizerConfig(BaseModel): | |
| ... | |
| # class BinActionTokenizerConfig(ActionTokenizerConfig): | |
| # bins: int = 256 | |
| # min_action: float = -1.0 | |
| # max_action: float = 1.0 | |
| # #### FSQModel | |
| # class VQVaeActionTokenizerConfig(ActionTokenizerConfig): | |
| # ## vqvae arch | |
| # quantizer_name: str = "fsq" # choices=['residualvq', 'group_residualvq', 'part_group_residualvq', 'lfq', 'fsq'] | |
| # dim_motion: int = 48 | |
| # code_dim: int = 512 | |
| # nb_code: int = 512 | |
| # mu: float = 0.99 | |
| # down_t: int = 2 | |
| # stride_t: int = 2 | |
| # width: int = 512 | |
| # depth: int = 3 | |
| # dilation_growth_rate: int = 3 | |
| # output_emb_width: int = 512 | |
| # activate: str = 'relu' # choices=['relu', 'silu', 'gelu'] | |
| # norm: Optional[str] = None | |
| # num_conv_layers: int = 1 | |
| # num_quantizers: int = 1 | |
| # shared_codebook: bool = False | |
| # # loss related | |
| # commit_weight: float = 0.02 | |
| # vel_weight: float = 0.5 | |
| # recons_loss: str = 'l1_smooth' | |
| # # for openvla_rlds_vqvae | |
| # pretrained_checkpoint: str | None = None | |
| # freeze_vqvae: bool = True # Whether to freeze VQ-VAE parameters during training | |
| ### ResidualVQModel | |
| class VQVaeActionTokenizerConfig(ActionTokenizerConfig): | |
| ## vqvae arch | |
| quantizer_name: str = "residualvq" # choices=['residualvq', 'group_residualvq', 'part_group_residualvq', 'lfq', 'fsq'] | |
| dim_motion: int = 48 | |
| code_dim: int = 512 | |
| nb_code: int = 512 | |
| mu: float = 0.99 | |
| down_t: int = 2 | |
| stride_t: int = 2 | |
| width: int = 512 | |
| depth: int = 3 | |
| dilation_growth_rate: int = 3 | |
| output_emb_width: int = 512 | |
| activate: str = 'relu' # choices=['relu', 'silu', 'gelu'] | |
| norm: Optional[str] = None | |
| num_conv_layers: int = 1 | |
| num_quantizers: int = 8 | |
| shared_codebook: bool = False | |
| # loss related | |
| commit_weight: float = 0.02 | |
| vel_weight: float = 0.5 | |
| recons_loss: str = 'l1_smooth' | |
| # for openvla_rlds_vqvae | |
| pretrained_checkpoint: str | None = None | |
| freeze_vqvae: bool = True # Whether to freeze VQ-VAE parameters during training | |
| class FastActionTokenizerConfig(ActionTokenizerConfig): | |
| bins: int = 2048 | |
| pretrained_checkpoint: str | None = None | |
| class VQActionTokenizerConfig(ActionTokenizerConfig): | |
| bins: int = 256 | |
| pretrained_checkpoint: str = "" | |
| class TextActionTokenizerConfig(ActionTokenizerConfig): | |
| pass | |