-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added uncertainty estimation scripts for ByT5 architecture models #63
base: main
Are you sure you want to change the base?
Conversation
model = model.train() | ||
else: | ||
model = model.eval() | ||
model = model.to("cuda").half() if use_gpu else model |
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.
Er half ok? Þjálfum við með FP16? Ég held að við gerum það en ég veit að upphaflegu líkönin eru með Bfloat16
MAX_LENGTH = 512 | ||
|
||
|
||
def batch_by_n(iterable, batch_size): |
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.
þetta fall er skilgreint í hinni skránni líka. Import-a?
model = T5ForConditionalGeneration.from_pretrained(str(checkpoint_path)) | ||
model = model.to("cuda").half() if use_gpu else model | ||
|
||
def prepare_model_inputs(data_lines): |
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.
Þetta er líka skilgreint í hinni skránni og mikið af þessum kóða. Er hægt að samnýta?
permuted_stds.append(seq_stds) | ||
|
||
# # recover the original order by inverting the length-sorted indices | ||
inverse_indices = sorted_indices.argsort().tolist() |
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.
Ertu alveg viss?
# we need to pass the attention mask to the model (encoder attention mask) | ||
encoder_attention_mask = model_inputs["attention_mask"] | ||
tgt_ids = prepare_model_inputs(decoded_output)["input_ids"] | ||
cpu = torch.device("cpu") |
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.
ég vona að þetta sé ekki dýrt kall
No description provided.