forked from OpenGPTX/lm-evaluation-harness
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Eval modalities #1
Open
rrutmann
wants to merge
10
commits into
master
Choose a base branch
from
eval_modalities
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1f711cf
feat: Add support for models from modalities
rrutmann 51a0cf5
test(eval): Test models from modalities
rrutmann b304f2d
test(modalities): Pass max_length to greedy_until
rrutmann 1908cd8
refactor(HF_test): Test greedy_until() for 20 tokens
ajude2s 5ef5928
Update tests/test_models.py
ajude2s 03b7c20
fix(eval): Using the array accessor instead
ajude2s ba25e26
Merge remote-tracking branch 'origin/eval_modalities' into eval_modal…
ajude2s 7c5a9c0
feat(checkpointing):
ajude2s 09dd787
feat(Modalities): Adapted eval harness to be able to evaluate generic…
ajude2s bf873c6
feat(DownstreamEval):
ajude2s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
from typing import Union, List, Optional | ||
import torch | ||
from transformers import AutoConfig, AutoModel, AutoModelForCausalLM, BatchEncoding | ||
from modalities.config.config import HuggingFaceModelConfig | ||
from modalities.models.gpt2.huggingface_model import HuggingFaceModel | ||
from .huggingface import AutoCausalLM | ||
|
||
TokenSequence = Union[List[int], torch.LongTensor, torch.Tensor, BatchEncoding] | ||
|
||
|
||
class Modalities(AutoCausalLM): | ||
def __init__(self, *args, **kwargs): | ||
AutoConfig.register("modalities_gpt2", HuggingFaceModelConfig) | ||
AutoModelForCausalLM.register(HuggingFaceModelConfig, HuggingFaceModel) | ||
# TODO load our own tokenizer | ||
super().__init__(tokenizer="gpt2", *args, **kwargs) | ||
|
||
def _model_call( | ||
self, inputs: TokenSequence, labels: Optional[TokenSequence] = None | ||
) -> TokenSequence: | ||
return self.model(inputs) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"config": {"sample_key": "input_ids", "prediction_key": "logits", "block_size": 128, "vocab_size": 50304, "n_layer": 1, "n_head": 1, "n_embd": 128, "ffn_hidden": 128, "dropout": 0.0, "bias": true, "attention": {"attention_type": "pytorch_flash_attention", "scaling_factor": 3}, "activation": "gelu", "epsilon": 1e-05, "weight_init": {"mean": 0.0, "std": 0.02}}, "model_type": "modalities_gpt2"} |
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
labels
never needed?