Run this model with HF Jobs

Run Zyphra/Zamba2-7B-Instruct on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/Zyphra/Zamba2-7B-Instruct. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Zyphra/Zamba2-7B-Instruct on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/Zyphra/Zamba2-7B-Instruct. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/Zyphra/Zamba2-7B-Instruct. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

Error When Training LoRA Model with Unsupported Target Modules

#3
by anandhperumal - opened

I am trying to train a LoRA model using the following configuration:

lora_config = LoraConfig(
    r=8,
    target_modules=["x_proj", "embeddings", "in_proj", "out_proj"],
    task_type="CAUSAL_LM",
    bias="none"
)

However, I am encountering the following error:

Currently, only the following modules are supported: torch.nn.Linear, torch.nn.Embedding, torch.nn.Conv2d, transformers.pytorch_utils.Conv1D.

I followed the installation steps as recommended:

Cloned the repository: git clone https://github.com/Zyphra/transformers_zamba2.git
cd transformers_zamba2
pip install -e .
pip install accelerate

Despite following these steps, I am still seeing the error regarding unsupported modules. Could you please advise on how to resolve this issue or if additional modules need to be supported for LoRA training?

It's always more helpful to see the entire error message!
The issue is in_proj, which is a ModuleList and not a Linear. For some reason, the code underlying lora config that matches target_modules to model parts does not descend into the ModuleList to find the Linear.

ValueError: Target module ModuleList(
  (0): Linear(in_features=2560, out_features=10448, bias=False)
) is not supported. Currently, only the following modules are supported: `torch.nn.Linear`, `torch.nn.Embedding`, `torch.nn.Conv2d`, `transformers.pytorch_utils.Conv1D`.

A straightforward way to circumvent this error is to provide a list of parameter names without the .weight extension, like this:

target_modules = ["x_proj", "embeddings", "out_proj"]

for n, p in model.named_parameters():
    if 'mamba.in_proj' in n:
        target_modules.append(n.strip('.weight'))
annago-zy changed discussion status to closed

Hi @anandhperumal , thanks for bringing this up. We made a small update to transformers_zamba2 and also to the model weights. Please run git pull inside the folder of transformers_zamba2 and download the updated model. After doing that, you should be able to use the LoRA config that you originally specified, as well as the approach that @annago-zy suggested.

Sign up or log in to comment