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

Proposal: refactor probing pipeline args #93

Open
oserikov opened this issue Dec 5, 2022 · 0 comments
Open

Proposal: refactor probing pipeline args #93

oserikov opened this issue Dec 5, 2022 · 0 comments

Comments

@oserikov
Copy link
Collaborator

oserikov commented Dec 5, 2022

I propose to allow for model_config, model, and tokenizer to be optional arguments to the experiment class, rather than setting them post-factum. Like, you either simply pass the model's name, like here, or pass the whole config-model-tokenizer triplet like this :

    model_config = AutoConfig.from_pretrained(
        model_name,
        output_hidden_states=True, 
        output_attentions=True
    )
    model = AutoModelForCausalLM.from_pretrained(
        model_name,
        config=model_config,
        device_map="auto",
        torch_dtype=dtype,
        max_memory = get_max_memory_per_gpu_dict(dtype, model_name)
    )
    tokenizer = AutoTokenizer.from_pretrained(model_name, config = model_config)
    experiment = ProbingPipeline(
        config=config, model = model, tokenizer=tokenizer,
        device = device,
        metric_names = ["f1", "accuracy"],
        encoding_batch_size = encoding_batch_size,
        classifier_batch_size = classifier_batch_size
    )
    
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

1 participant