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

Custom datasets support for chat models #8

Open
RanchiZhao opened this issue Sep 23, 2024 · 1 comment
Open

Custom datasets support for chat models #8

RanchiZhao opened this issue Sep 23, 2024 · 1 comment

Comments

@RanchiZhao
Copy link

for chat models, calibration datasets' input_ids&attn_masks should be passed in

@zengchao0424
Copy link

zengchao0424 commented Sep 27, 2024

If you want to customize your own calibration dataset, you can add support for your dataset in the get_loader function inside ABQ-LLM/algorithm/datautils.py.For example, you can implement the get_chat function to load your own calibration dataset.

def get_loaders(
    name, nsamples=128, seed=0, seqlen=2048, model='',
):
    if 'wikitext2' in name:
        return get_wikitext2(nsamples, seed, seqlen, model)
    if 'chat_data' in name:
        return get_chat(nsamples, seed, seqlen, model)
    if 'ptb' in name:
        if 'new' in name:
            return get_ptb_new(nsamples, seed, seqlen, model)  
        return get_ptb(nsamples, seed, seqlen, model)
    if 'c4' in name:
        if 'new' in name:
            return get_c4_new(nsamples, seed, seqlen, model)  
        return get_c4(nsamples, seed, seqlen, model)
    if 'mix' in name:
        wiki_train,wiki_val=get_wikitext2(nsamples//3, seed, seqlen, model)
        ptb_train,ptb_val=get_ptb(nsamples//3, seed, seqlen, model)
        c4_train,c4_val=get_c4(nsamples//3, seed, seqlen, model)
        train=wiki_train+ptb_train+c4_train
        val=None
        return train,val

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

No branches or pull requests

2 participants