Showing posts with label Deep Learning. Show all posts
Showing posts with label Deep Learning. Show all posts

Tuesday, April 2, 2024

Generated Knowledge Prompting vs Knowledge based-Tuning in the LLM Context

Pretrained Large Language Models LLMs are increasingly used and are known with their astonishing performances. While LLMs is continuously improving, it’s still limited in specific domains like mathematics and medicine. Various research has been dedicated to equipping LLMs with external tools and techniques providing more flexibility and enhancing the capabilities of large language models.

In this post, I’m excited to present Generated Knowledge Prompting (GKP) and Knowledge-based Tuning techniques. They are distinct in their approaches, these methods share the common goal of refining model performance and expanding its comprehension across various domains.

Generated Knowledge Prompting (GKP)

GKP is a prompting technique proposed by Liu et al. The key insight behind Generated Knowledge Prompting is to be able to generate useful knowledge from another language model or external sources, then provide the knowledge as an input prompt that is concatenated with a question.

Generated Knowledge Prompting LLM

The intention behind this technique is to steer the model’s learning process towards specific types of outputs. By crafting prompts that target particular knowledge domains or concepts, GKP effectively guides the model to understand and generate relevant information.

Consider a scenario where a language model needs to grasp medical terminology and concepts. Through generated Knowledge Prompting, the first step is to generate the medical knowledge. The second is to integrate the knowledge as an input in the prompts. The model will analyze the prompt and use its underlying medical knowledge to generate text that addresses the query or provides information on the specified topic. This method harnesses the power of structured prompts to shape the model’s understanding and output generation capabilities.

Knowledge-Based Tuning

On the other hand, knowledge-based tuning involves fine-tuning a pre-trained model by integrating external data or information from knowledge sources. This process seeks to augment the model’s performance on specific tasks or domains by enriching its understanding with additional knowledge.

Let’s take an example of legal texts. If a language model requires proficiency in comprehending legal language, knowledge-based tuning can be employed. By exposing the model to a dataset comprising legal documents, the model can assimilate legal terminology and concepts, thereby enhancing its ability to interpret and generate responses in legal contexts.

Difference Between the Two Techniques

While both Generated Knowledge Prompt GPK and Knowledge-based Tuning contribute to enhancing language models, they differ in their methodologies and objectives. GKP focuses on guiding the model’s learning trajectory through tailored prompts. Knowledge is provided to the LLM as an input, while knowledge-based tuning modifies the model or its training process to incorporate external knowledge directly. This results in a fine-tuned model.

In summary, Generated Knowledge Prompting and knowledge-based tuning represent complementary approaches to empowering language models with deeper comprehension and proficiency across diverse subject matters.

That’s all for today. I will share more knowledge around LLM. So don’t miss coming posts 🎉. Follow and Join the conversation with your experiences/suggestion in the comments below 🌸

Sunday, March 31, 2024

Pip Install OS Error Python package installation System Does not have Windows Long Path Support Enabled

 I have been trying to install the Transformer to work on deep learning project. I used the command, which I used many times before and it works perfectly.

But this time, I got the error Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified

pip install transformers --users


 

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘C:\\Users\\me\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\\transformers\\models\\deprecated\\trajectory_transformer\\convert_trajectory_transformer_original_pytorch_checkpoint_to_pytorch.py’
HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths

In order to fix the OSError, we need to make Windows 10 Accept File Paths Over 260 Characters.

So here the steps to follow in order to fix the error and be able to install the transformers package.

Step 1: Open Registry Editor

To do so, use the “Windows + R” and write “regedit”

Open Registry Editor with Shortcut Windows R

Another option is to search for Registry Editor

Step 2:

In the registry editor, use the left sidebar and navigate to “CurrentControlSet\Control\FileSystem”

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

Step 3:

On the right, find a value named “LongPathEnabled” and double-click it. If you don't see the value listed, you'll need to create it by right-clicking the “FileSystem” key, choosing New > DWORD (32-bit) Value, and then naming the new value “LongPathEnabled”.

Change the value from 0 to 1 and save your changes.

You can now close the registry and restart the computer. For my side, I just restarted my Visual Studio and was able to install successfully the transformer.

🎉Perfect, hope this helps you also and don’t forget to:

  • Like the post 👏
  • Follow me for more Tips

Articles les plus consultés