• Graham King's avatar
    feat(pystr): Pass command line arguments (#123) · 995f71cc
    Graham King authored
    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`.
    995f71cc
lib.rs 15.5 KB