-
Notifications
You must be signed in to change notification settings - Fork 56
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
Conversation
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." |
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.
nit: might also require to install torch.
uniflow/op/model/model_server.py
Outdated
from PIL import Image | ||
import pypdfium2 |
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.
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 |
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.
nit: shall we default to 1.
uniflow/op/model/model_server.py
Outdated
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] |
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.
nit: move #[0]
pad_token_id=self.processor.tokenizer.pad_token_id, | ||
eos_token_id=self.processor.tokenizer.eos_token_id, |
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.
nit: does nougatprocess has a tokenizer?
update by running black and isort reformat.
No description provided.