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

Added uncertainty estimation scripts for ByT5 architecture models #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

haukurb
Copy link
Member

@haukurb haukurb commented Nov 7, 2023

No description provided.

model = model.train()
else:
model = model.eval()
model = model.to("cuda").half() if use_gpu else model
Copy link
Collaborator

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):
Copy link
Collaborator

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):
Copy link
Collaborator

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()
Copy link
Collaborator

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")
Copy link
Collaborator

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

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

Successfully merging this pull request may close these issues.

2 participants