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

Nougat modified to huggingface interface #178

Merged
merged 2 commits into from
Feb 16, 2024
Merged

Conversation

CluckRookie
Copy link
Collaborator

No description provided.

except ModuleNotFoundError as exc:
raise ModuleNotFoundError(
"Please install nougat to use NougatModelServer. You can use `pip install nougat-ocr` to install it."
"Please install nougat to use NougatModelServer. You can use `pip install transformers` to install it."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might also require to install torch.

Comment on lines 585 to 587
from PIL import Image
import pypdfium2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can consider to move this to init.

model_name: str = "0.1.0-small"
batch_size: int = 1
model_name: str = "facebook/nougat-small"
batch_size: int = 2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: shall we default to 1.

if is_last_page[j]:
out = "".join(predictions).strip()
out = re.sub(r"\n{3,}", "\n\n", out).strip()
sequence = self.processor.batch_decode(outputs, skip_special_tokens=True)#[0]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move #[0]

Comment on lines +609 to +616
pad_token_id=self.processor.tokenizer.pad_token_id,
eos_token_id=self.processor.tokenizer.eos_token_id,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: does nougatprocess has a tokenizer?

Ubuntu and others added 2 commits February 15, 2024 21:31
update by running black and isort reformat.
@CambioML CambioML merged commit 1c59ae6 into CambioML:main Feb 16, 2024
5 checks passed
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