Skip to content

Added uncertainty estimation scripts for ByT5 architecture models - #63

Open
haukurb wants to merge 1 commit into
mainfrom
dev/byt5-uncertainty-estimation
Open

Added uncertainty estimation scripts for ByT5 architecture models#63
haukurb wants to merge 1 commit into
mainfrom
dev/byt5-uncertainty-estimation

Conversation

@haukurb

@haukurb haukurb commented Nov 7, 2023

Copy link
Copy Markdown
Member

No description provided.

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

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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
Copy Markdown
Member

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
Copy Markdown
Member

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
Copy Markdown
Member

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