Repository navigation
Add Qwen2 config and sampling params #6
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
Changes from 5 commits
4351939
274a3ef
5dc68f5
5e1d635
3421c94
8e5012b
2f151b4
6083e42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name_model = "Qwen32B" | ||
| max_samples = 32 | ||
| batch_size = 32 | ||
| #cpu_offload_gb = 300.0 | ||
| #cpu_offload_percentage = 0.5 | ||
| tp = "all" | ||
| dataset = "justus27/test-vcu" | ||
|
|
||
| [sampling_params] | ||
| temperature = 0.7 | ||
| top_p = 0.95 | ||
| max_tokens = 100 | ||
| presence_penalty = 0.1 | ||
| frequency_penalty = 0.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,13 @@ | ||
| name_model = "debugmodel" | ||
| max_samples = 32 | ||
| batch_size = 8 | ||
| dataset = "justus27/test-vcu" | ||
| sample_per_file = 32 | ||
| dataset = "justus27/test-vcu" | ||
|
|
||
| [sampling_params] | ||
| temperature = 0.7 | ||
| top_p = 0.95 | ||
| max_tokens = 100 | ||
| presence_penalty = 0.1 | ||
| frequency_penalty = 0.1 | ||
| logprobs = None | ||
|
apaz-cli marked this conversation as resolved.
Resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name_model = "Qwen32B" | ||
| project = "debug_1B_zero_band" | ||
|
|
||
| [train] | ||
| micro_bs = 32 | ||
| reshard_after_forward = true | ||
|
|
||
| [optim] | ||
| batch_size = 1024 | ||
| warmup_steps = 1000 | ||
| total_steps = 8192 | ||
|
|
||
| [optim.optim] | ||
| lr = 7e-4 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import os | ||
| import psutil | ||
| from pathlib import Path | ||
| from typing import Literal | ||
| import uuid | ||
| import torch | ||
| from vllm import LLM, SamplingParams | ||
|
|
@@ -17,16 +19,33 @@ | |
| import pyarrow.parquet as pq | ||
|
|
||
|
|
||
| class SamplingParamConfig(BaseConfig): | ||
| temperature: float = 0.7 | ||
| top_p: float = 0.95 | ||
| top_k: int = -1 | ||
| use_beam_search: bool = False | ||
| stop: str | list[str] | None = None | ||
| ignore_eos: bool = False | ||
| max_tokens: int = 512 | ||
| presence_penalty: float = 0.1 | ||
| frequency_penalty: float = 0.1 | ||
| logprobs: int | None = None | ||
|
|
||
|
|
||
| class Config(BaseConfig): | ||
| name_model: ModelName = "150M" | ||
| dataset: str = "justus27/test-vcu" | ||
| batch_size: int = 32 | ||
| max_samples: int | None = None | ||
| output_path: str = "outputs" | ||
| tp: int = 1 | ||
| tp: int | Literal["all"] = 1 | ||
| max_seq_len: int | None = None | ||
| cpu_offload_gb: float = 0.0 | ||
| cpu_offload_percentage: float = 0.0 | ||
|
apaz-cli marked this conversation as resolved.
Resolved
|
||
| total_step: int | None = None | ||
| step_batch_size: int | None = None # will be use to create stable file | ||
| rollout_path: str | None = None | ||
| sampling_params: SamplingParamConfig = SamplingParamConfig() | ||
|
|
||
|
|
||
| def fake_chat_template(messages): | ||
|
|
@@ -124,7 +143,24 @@ def weights_iterator(): | |
| def main(config: Config): # -> list[dict[str, Any]]: | ||
| prompts = ["Write me a novel" for _ in range(5)] | ||
|
|
||
| llm = LLM(model=name_to_hf_model[config.name_model], tensor_parallel_size=config.tp) | ||
| if config.tp == "all": | ||
| config.tp = torch.cuda.device_count() | ||
|
|
||
| if config.cpu_offload_gb != 0.0 and config.cpu_offload_percentage != 0.0: | ||
| raise ValueError("Cannot set both cpu_offload_gb and cpu_offload_percentage") | ||
| if config.cpu_offload_percentage != 0.0: | ||
| cpu_offload_gb = psutil.virtual_memory().available * config.cpu_offload_percentage | ||
| elif config.cpu_offload_gb != 0.0: | ||
| cpu_offload_gb = config.cpu_offload_gb | ||
| else: | ||
| cpu_offload_gb = 0.0 | ||
|
Comment on lines
+149
to
+156
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can skip this for now as we don't need offloading
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we probably will in the future, and it was basically zero effort. The config I wrote isn't offloading. |
||
|
|
||
| llm = LLM( | ||
| model=name_to_hf_model[config.name_model], | ||
| tensor_parallel_size=config.tp, | ||
| max_model_len=config.max_seq_len, | ||
| cpu_offload_gb=cpu_offload_gb, | ||
| ) | ||
| logger = get_logger("INFERENCE") | ||
|
|
||
| sampling_params = SamplingParams(temperature=0.7, top_p=0.95, max_tokens=100, presence_penalty=0.1, frequency_penalty=0.1) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.