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

What is the right data for SOURCE_LORA when Convert LoRA to cpp format #1453

Open
sleepwalker2017 opened this issue Apr 16, 2024 · 5 comments
Assignees
Labels
triaged Issue has been triaged by maintainers

Comments

@sleepwalker2017
Copy link

sleepwalker2017 commented Apr 16, 2024

I'm benchmarking lora following this: https://github.com/NVIDIA/TensorRT-LLM/blob/main/benchmarks/cpp/README.md#benchmarking-lora

I clone this repo: https://huggingface.co/hfl/chinese-llama-2-lora-13b

when I run the script:

# Convert LoRA to cpp format
python examples/gpt/nemo_lora_convert.py \
    -i $SOURCE_LORA \
    --storage-type $DTYPE \
    --write-cpp-runtime-tensors \
    -o $CPP_LORA

It reports error.

    with tempfile.TemporaryDirectory() as prompt_out_dir:
        prompt_out_dir = Path(prompt_out_dir)
        unpack_nemo_ckpt(args.in_file, prompt_out_dir)
        LOGGER.info("Spent %s (h:m:s) to unpack NeMo prompt archive",
                    datetime.datetime.now() - start_time)

        model_weights_ckpt = "model_weights.ckpt"
        with open(prompt_out_dir / "model_config.yaml") as f:
            prompt_config = yaml.full_load(f)
        LOGGER.debug(prompt_config)

It looks like the file need to open a tar file, but this model is a folder.

And also, the lora weight folder contains no model_weights.ckpt and no model_config.yaml.
How can I run this script? Any advice ?

image

@sleepwalker2017 sleepwalker2017 changed the title What is the input for SOURCE_LORA when Convert LoRA to cpp format What is the right data for SOURCE_LORA when Convert LoRA to cpp format Apr 16, 2024
@byshiue
Copy link
Collaborator

byshiue commented Apr 29, 2024

The nemo converter is only used for nemo ckpt, you cannot use it on huggingface ckpt.

@byshiue byshiue self-assigned this Apr 29, 2024
@byshiue byshiue added the triaged Issue has been triaged by maintainers label Apr 29, 2024
@sleepwalker2017
Copy link
Author

The nemo converter is only used for nemo ckpt, you cannot use it on huggingface ckpt.

So what should we do at this step ? I want to benchmark trt-llm for multi lora, I get stuck here.

@byshiue
Copy link
Collaborator

byshiue commented Apr 30, 2024

This is a miss of the document. You should use examples/hf_lora_convert.py like

# Convert LoRA to cpp format
python examples/hf_lora_convert.py \
    -i $SOURCE_LORA \
    --storage-type $DTYPE \
    -o $CPP_LORA

Also, the NUM_LORA_MODS is 7 in this case. We will fix it soon.

@sleepwalker2017
Copy link
Author

NUM_LORA_MODS

NUM_LORA_MODS what does this mean? q k v o proj? and up down gate proj?

@sleepwalker2017
Copy link
Author

This is a miss of the document. You should use examples/hf_lora_convert.py like

# Convert LoRA to cpp format
python examples/hf_lora_convert.py \
    -i $SOURCE_LORA \
    --storage-type $DTYPE \
    -o $CPP_LORA

Also, the NUM_LORA_MODS is 7 in this case. We will fix it soon.

#1552
I get this issue when running lora, could you take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants