Skip to content

Conversation

grahamking
Copy link
Contributor

@grahamking grahamking commented Mar 12, 2025

Command line arguments are passed to the python engine like this:

dynamo-run out=pystr:my_python_engine.py -- -n 42 --custom-arg Orange --yes

The python engine receives the arguments in sys.argv. The argument list will include some standard ones as well as anything after the --.

This input:

dynamo-run out=pystr:my_engine.py /opt/models/Llama-3.2-3B-Instruct/ --model-name llama_3.2 --tensor-parallel-size 4 -- -n 1

is read like this:

async def generate(request):
    .. as before ..

if __name__ == "__main__":
    print(f"MAIN: {sys.argv}")

and produces this output:

MAIN: ['my_engine.py', '--model-path', '/opt/models/Llama-3.2-3B-Instruct/', '--model-name', 'llama3.2', '--http-port', '8080', '--tensor-parallel-size', '4', '--base-gpu-id', '0', '--num-nodes', '1', '--node-rank', '0', '-n', '1']

This allows quick iteration on the engine setup. Note how the -n 1 is included. Flags --leader-addr and --model-config will also be added if provided to dynamo-run.

@github-actions
Copy link

Test Results

88 tests   88 ✅  51s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit f5b07faa.

Copy link
Contributor

@rmccorm4 rmccorm4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Command line arguments are passed to the python engine like this:
```
dynamo-run out=pystr:my_python_engine.py -- -n 42 --custom-arg Orange --yes
```

The python engine has two options for receiving those command line arguments (both of which are optional).

In both cases the argument list will include some standard ones as well as anything after the `--`.

This input:
```
dynamo-run out=pystr:my_engine.py /opt/models/Llama-3.2-3B-Instruct/ --model-name llama_3.2 --tensor-parallel-size 4 -- -n 1
```

1. In `sys.argv`:

```
async def generate(request):
    .. as before ..

if __name__ == "__main__":
    print(f"MAIN: {sys.argv}")
```

Produces this output:
```
MAIN: ['my_engine.py', '--model-path', '/opt/models/Llama-3.2-3B-Instruct/', '--model-name', 'llama3.2', '--http-port', '8080', '--tensor-parallel-size', '4', '--base-gpu-id', '0', '--num-nodes', '1', '--node-rank', '0', '-n', '1']
```

This form allows quick iteration on the engine setup.

2. In an `initialize` function:

```
async def generate(request):
    .. as before ..

def initialize(args: list[str]) -> None:
    print(f"initialize: {args}")
```

Produces this output:
```
initialize: ['--model-path', '/opt/models/Llama-3.2-3B-Instruct/', '--model-name', 'llama3.2', '--http-port', '8080', '--tensor-parallel-size', '4', '--base-gpu-id', '0', '--num-nodes', '1', '--node-rank', '0', '-n', '1']
```

Note how in both cases the `-n` `1` is included.

Flags `--leader-addr` and `--model-config` will also be added if provided to `dynamo-run`.
@grahamking grahamking merged commit 63adf11 into main Mar 12, 2025
16 checks passed
@grahamking grahamking deleted the gk-dr-args branch March 12, 2025 20:19
kylehh pushed a commit to kylehh/dynamo that referenced this pull request Apr 11, 2025
Signed-off-by: Ryan Olson <[email protected]>
Co-authored-by: Ryan McCormick <[email protected]>
Co-authored-by: Neelay Shah <[email protected]>
kylehh pushed a commit to kylehh/dynamo that referenced this pull request Apr 11, 2025
Command line arguments are passed to the python engine like this:
```
dynamo-run out=pystr:my_python_engine.py -- -n 42 --custom-arg Orange --yes
```

The python engine receives the arguments in `sys.argv`. The argument list will include some standard ones as well as anything after the `--`.

This input:
```
dynamo-run out=pystr:my_engine.py /opt/models/Llama-3.2-3B-Instruct/ --model-name llama_3.2 --tensor-parallel-size 4 -- -n 1
```

is read like this:
```
async def generate(request):
    .. as before ..

if __name__ == "__main__":
    print(f"MAIN: {sys.argv}")
```

and produces this output:
```
MAIN: ['my_engine.py', '--model-path', '/opt/models/Llama-3.2-3B-Instruct/', '--model-name', 'llama3.2', '--http-port', '8080', '--tensor-parallel-size', '4', '--base-gpu-id', '0', '--num-nodes', '1', '--node-rank', '0', '-n', '1']
```

This allows quick iteration on the engine setup. Note how the `-n` `1` is included. Flags `--leader-addr` and `--model-config` will also be added if provided to `dynamo-run`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants