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

escaping quotes, added requirements and gitignore #1

Closed
wants to merge 0 commits into from

Conversation

couillonnade
Copy link
Contributor

  • Added a requirement.txt file to install required module
  • Added a .gitignore file to ignore phi3v folder
  • Fixed escaping issue un line 700 and 730

For line 738, escaping was not easy so I introduced intermediate variables.

Error references:

File "Phi-3-Vision-MLX/main.py", line 700
list_str = [f".. code-block:: python\n :caption: {filename}\n\n{textwrap.indent(code, " ")}" for filename, code in zip(list_doc, list_str)]
^^^
SyntaxError: f-string: unmatched '('

and

SyntaxError: f-string: unmatched '('
File "Phi-3-Vision-MLX/main.py", line 738
print(f'### Prompt ###\n{"\n".join(map(str.strip, prompt)).strip()}\n### Images ###\n{'\n'.join(map(str, images)) if images else "None"}\n### Output ###') if verbose else None
^
SyntaxError: unexpected character after line continuation character

@JosefAlbers
Copy link
Owner

JosefAlbers commented Jun 22, 2024

@couillonnade,

First of all, thank you so much for your pull request! I am super excited to see the first contribution to my repository, and I appreciate your taking the time to make the changes. I apologize however there was a bit of a mix-up on my end, and I accidentally made a commit that overwrites the changes in your pull request before seeing your pull request.

I would really like to incorporate your changes into the repo though. Would you be able to rebase your branch on top of the latest version of the main branch and resubmit your pull request? If you need any assistance with the rebase process or have any questions, please don't hesitate to ask!

Thank you again for your contribution!

requirements.txt Outdated
datasets==2.20.0
huggingface-hub==0.23.4
matplotlib==3.9.0
mlx==0.15.1
Copy link
Owner

Choose a reason for hiding this comment

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

The model's behavior's been a bit weird with mlx 0.15.1 (released just a few days ago). I cannot yet pinpoint the exact cause, so for now, I am fixing the mlx version to 0.15.0 in this repository. Additionally, I am keeping the rest of the requirements.txt as is for now.

.gitignore Outdated
@@ -0,0 +1 @@
phi3v/
Copy link
Owner

@JosefAlbers JosefAlbers Jun 22, 2024

Choose a reason for hiding this comment

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

Agree! Also:

phi3v/
quantized_phi3v/
adapters/
*.egg-info
*.json
.DS_STORE
.DS_Store
__pycache__/

main.py Outdated
@@ -697,7 +697,7 @@ def to_lora(layer):
def _load_text(root_url, list_doc, is_code=False, join=True):
list_str = [response.text for file_url in list_doc if (response := requests.get(f'{root_url}/{file_url}')).status_code == 200]
if is_code:
list_str = [f".. code-block:: python\n :caption: {filename}\n\n{textwrap.indent(code, " ")}" for filename, code in zip(list_doc, list_str)]
list_str = [f".. code-block:: python\n :caption: {filename}\n\n{textwrap.indent(code, ' ')}" for filename, code in zip(list_doc, list_str)]
Copy link
Owner

@JosefAlbers JosefAlbers Jun 22, 2024

Choose a reason for hiding this comment

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

Absolutely! However, I had replaced _load_text() with a simpler load_text() function that simply returns the text content of a file or URL. I apologize once again for not catching your pull request before making my commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries, the new version is clearly better!

main.py Outdated
prompt_str = "\n".join(map(str.strip, prompt)).strip()
images_str = "\n".join(map(str, images)) if images else "None"
print(f'### Prompt ###\n{prompt_str}\n### Images ###\n{images_str}\n### Output ###')

Copy link
Owner

Choose a reason for hiding this comment

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

Agree 100%!

@couillonnade
Copy link
Contributor Author

Closed and new PR #2 submitted.

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