-
Notifications
You must be signed in to change notification settings - Fork 2
create new llava_captioning filter #48
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
Conversation
|
Create a new llava_captioning filter |
llava_captioning.py
Outdated
| @@ -0,0 +1,114 @@ | |||
| { | |||
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.
этот файл лишний
| resized_width = self.resize if width <= height else self.resize * width // height | ||
| resized_height = self.resize * height // width if width <= height else self.resize | ||
| resized_img = pil_img.resize((resized_width, resized_height)) | ||
| width, height = resized_img.size | ||
| left = (width - self.crop_size_x) // 2 | ||
| top = (height - self.crop_size_y) // 2 | ||
| right = left + self.crop_size_x | ||
| bottom = top + self.crop_size_y | ||
| cropped_image = resized_img.crop((left, top, right, bottom)) |
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.
Это заменяется таким трансформом:
transform = T.Compose([
T.Resize(min_size),
T.CenterCrop(min_size)
])
| self.crop_size_y = crop_size_y | ||
| self.resize = resize | ||
| self.model_path = model_path | ||
| self.prompt = "<|im_start|>system\nAnswer the questions.<|im_end|><|im_start|>user\n<image>\nDescribe this image and its style in a very detailed manner<|im_end|><|im_start|>assistant\n" |
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.
Тут только один промпт и он захардкожен в код( Нужно сделать, чтобы его можно было менять. Посмотри как реализовано в ллаве 1.5
No description provided.