Skip to content

Commit

Permalink
fix some typing
Browse files Browse the repository at this point in the history
  • Loading branch information
helpmefindaname committed Jan 31, 2025
1 parent 79aa337 commit 087b74e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions flair/embeddings/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,9 @@ def _add_embeddings_internal(self, sentences: list[Sentence]):

lengths: list[int] = [len(sentence.tokens) for sentence in sentences]
padding_length: int = max(max(lengths), self.min_sequence_length)

pre_allocated_zero_tensor = torch.zeros(
self.embeddings.embedding_length * padding_length,
dtype=self.convs[0].weight.dtype,
dtype=cast(torch.nn.Conv1d, self.convs[0]).weight.dtype,
device=flair.device,
)

Expand Down
2 changes: 1 addition & 1 deletion flair/embeddings/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ def _add_embeddings_internal(self, sentences: list[Sentence]) -> list[Sentence]:
word = token.text if self.field is None else token.get_label(self.field).value

if word.strip() == "":
ids = [self.spm.vocab_size(), self.embedder.spm.vocab_size()]
ids = [self.spm.vocab_size(), self.spm.vocab_size()]
else:
if self.do_preproc:
word = self._preprocess(word)
Expand Down
4 changes: 2 additions & 2 deletions flair/models/sequence_tagger_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,8 @@ def push_to_hub(
self.save(local_model_path)

# Determine if model card already exists
info = model_info(repo_id, use_auth_token=token)
write_readme = all(f.rfilename != "README.md" for f in info.siblings)
info = model_info(repo_id, token=token)
write_readme = info.siblings is None or all(f.rfilename != "README.md" for f in info.siblings)

# Generate and save model card
if write_readme:
Expand Down

0 comments on commit 087b74e

Please sign in to comment.