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

[PROBLEM] Errors in Fine-Tuning for retrieval augmented generation (RAG) with Qdrant #1122

Open
AyushSinghal9020 opened this issue Mar 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@AyushSinghal9020
Copy link

I was trying to run this particular notebooks

Where I got these 2 errors for these particular lines in cell 10

  • Line 15
            file=open(self.training_file_path, "r"),
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-34-2cc5ff431133>](https://localhost:8080/#) in <cell line: 1>()
----> 1 model_id = fine_tuner.fine_tune_model()
      2 model_id

1 frames
[<ipython-input-33-eb412b9caab8>](https://localhost:8080/#) in fine_tune_model(self)
     45         self.create_openai_file()
     46         self.wait_for_file_processing()
---> 47         self.create_fine_tuning_job()
     48         self.wait_for_fine_tuning()
     49         return self.retrieve_fine_tuned_model()

[<ipython-input-33-eb412b9caab8>](https://localhost:8080/#) in create_fine_tuning_job(self)
     27         # print(self.file_object)
     28         self.fine_tuning_job = client.fine_tuning.jobs.create(
---> 29             training_file=self.file_object['id'],
     30             model=self.model_name,
     31             suffix=self.suffix,

TypeError: 'FileObject' object is not subscriptable
  • Line 29
            training_file=self.file_object['id'],
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-36-2cc5ff431133>](https://localhost:8080/#) in <cell line: 1>()
----> 1 model_id = fine_tuner.fine_tune_model()
      2 model_id

13 frames
[/usr/local/lib/python3.10/dist-packages/httpx/_multipart.py](https://localhost:8080/#) in __init__(self, name, value)
    130             )
    131         if isinstance(fileobj, io.TextIOBase):
--> 132             raise TypeError(
    133                 "Multipart file uploads must be opened in binary mode, not text mode."
    134             )

TypeError: Multipart file uploads must be opened in binary mode, not text mode.

Identify the file to be fixed
https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/ft_retrieval_augmented_generation_qdrant.ipynb

Describe a solution
The solution is

            file=open(self.training_file_path, "rb")
            training_file=self.file_object.id,

Screenshots

image
image

Additional context
For sure, these errors were minimal and could be rectified by most of the people running the notebook, but I just thought to point them out

Also I am not sure what these will carry to the next parts of the code, as Fine-tuning them requires paid API

@AyushSinghal9020 AyushSinghal9020 added the bug Something isn't working label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant