Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some improvements to config.json readability #44

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

francoishernandez
Copy link
Contributor

These are minimal changes to improve dumped config readability:

  • prevent dumping empty transforms_configs (change taken from Inference server, lots of related changes #42);
  • dump "non-nested" fields before nested ones, not much but prevents having interspersed items that are difficult to spot;

Example with llama3 convert:

Before

{
  "n_sample": 0,
  "training": {
    "accum_count": [
      32
    ],
    "w_bit": 0,
    "valid_batch_size": 256,
    "batch_size": 896,
    "model_dtype": "fp16",
    "batch_size_multiple": 1,
    "normalization": "tokens",
    "quant_layers": [],
    "quant_type": "",
    "group_size": 0,
    "accum_steps": [
      0
    ],
    "optim": "fusedadam",
    "batch_type": "tokens"
  },
  "decoder_start_token": "<s>",
  "src_vocab": null,
  "tgt_vocab": null,
  "skip_empty_level": "silent",
  "model": {
    "add_ffnbias": false,
    "architecture": "transformer_lm",
    "add_qkvbias": false,
    "num_experts": 0,
    "heads": 32,
    "embeddings": {
      "src_word_vec_size": 4096,
      "tgt_word_vec_size": 4096
    },
    "mlp_activation_fn": "gated-silu",
    "rotary_interleave": false,
    "left_pad": true,
    "model_type": "text",
    "rotary_theta": 500000,
    "sliding_window": 0,
    "layer_norm": "rms",
    "layers": 32,
    "rotary_dim": 0,
    "num_experts_per_tok": 0,
    "parallel_residual": false,
    "decoder": {
      "decoder_type": "transformer_lm",
      "tgt_word_vec_size": 4096
    },
    "shared_layer_norm": false,
    "heads_kv": 8,
    "hidden_size": 4096,
    "transformer_ff": 14336,
    "norm_eps": 1e-05,
    "max_relative_positions": -1
  },
  "transforms_configs": {
    "filtertoolong": {
      "src_seq_length": 512,
      "tgt_seq_length": 512
    }
  },
  "vocab_size_multiple": 8,
  "share_vocab": true,
  "save_data": null,
  "data": null,
  "src_vocab_size": 128256,
  "transforms": [
    "filtertoolong"
  ],
  "data_task": "lm",
  "tgt_vocab_size": 128256
}

After

{
  "transforms": [
    "filtertoolong"
  ],
  "src_vocab_size": 128256,
  "decoder_start_token": "<s>",
  "share_vocab": true,
  "vocab_size_multiple": 8,
  "save_data": null,
  "skip_empty_level": "silent",
  "data": null,
  "tgt_vocab": null,
  "tgt_vocab_size": 128256,
  "n_sample": 0,
  "src_vocab": null,
  "training": {
    "group_size": 0,
    "w_bit": 0,
    "quant_layers": [],
    "valid_batch_size": 256,
    "accum_steps": [
      0
    ],
    "normalization": "tokens",
    "model_dtype": "fp16",
    "batch_size": 896,
    "quant_type": "",
    "batch_type": "tokens",
    "accum_count": [
      32
    ],
    "batch_size_multiple": 1,
    "optim": "fusedadam"
  },
  "transforms_configs": {
    "filtertoolong": {
      "tgt_seq_length": 512,
      "src_seq_length": 512
    }
  },
  "model": {
    "heads_kv": 8,
    "architecture": "transformer_lm",
    "rotary_theta": 500000,
    "mlp_activation_fn": "gated-silu",
    "left_pad": true,
    "parallel_residual": false,
    "hidden_size": 4096,
    "layer_norm": "rms",
    "norm_eps": 1e-05,
    "add_ffnbias": false,
    "sliding_window": 0,
    "transformer_ff": 14336,
    "layers": 32,
    "rotary_dim": 0,
    "rotary_interleave": false,
    "shared_layer_norm": false,
    "heads": 32,
    "num_experts": 0,
    "add_qkvbias": false,
    "num_experts_per_tok": 0,
    "max_relative_positions": -1,
    "embeddings": {
      "src_word_vec_size": 4096,
      "tgt_word_vec_size": 4096
    },
    "decoder": {
      "decoder_type": "transformer_lm",
      "tgt_word_vec_size": 4096
    }
  }
}

@francoishernandez francoishernandez added the enhancement New feature or request label Jun 27, 2024
@francoishernandez francoishernandez merged commit aa6d387 into main Jun 28, 2024
4 checks passed
@francoishernandez francoishernandez deleted the order_fields_in_config_dump branch July 1, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant