12/09/2024

Azure Devops/Git, authentication issue

 If you have authentication issues when you push or pull your changes, try this command below:

  • Configure Git to Use the Credential Manager:

$ git config --global credential.helper manager-core

  • Push Your Changes Again:

$ git push origin main

This should prompt a window where you can enter your username and password. If you continue to face issues, you might need to use a Personal Access Token (PAT) instead of your password, as many services have moved away from password authentication for security reasons.

11/20/2024

11/02/2024

Understanding and Coding the Self-Attention Mechanism of Large Language Models From Scratch

 https://sebastianraschka.com/blog/2023/self-attention-from-scratch.html

10/27/2024

Multi head attention - what is the difference between different heads for the multi head attention?

 

Example: Sentence Translation with Multiple Attention Heads

Suppose we have a sentence:

"The quick brown fox jumps over the lazy dog."

We want a model to translate this sentence into another language. Different aspects of the sentence's structure and meaning are important for an accurate translation. Let’s assume a Transformer model with 3 attention heads is applied to this sentence.

How Each Head Might Work:

  1. Head 1 - Focuses on Short-Range Dependencies:
    This head might pay attention to words that are close together to capture short-range relationships. For instance:

    • "quick" and "brown" relate directly to "fox" (describing it).
    • "lazy" relates to "dog".
    • This head could help in identifying adjective-noun pairs, which are crucial for preserving meaning in translation.
  2. Head 2 - Focuses on Long-Range Dependencies:
    This head might look at relationships between words that are farther apart in the sentence. For instance:

    • "fox" and "jumps" relate as subject-verb, even though they are separated by words.
    • "jumps" and "over" indicate the action and direction.
    • This head helps capture grammatical structure, like the subject-verb-object pattern, which is essential for proper sentence construction in translation.
  3. Head 3 - Focuses on Semantic Roles:
    This head might attend to the roles that different words play, such as identifying the main actors and actions:

    • Recognizes "fox" as the agent (subject) performing the action.
    • Identifies "jumps" as the action.
    • Sees "dog" as the recipient or target of the action.
    • This head helps the model understand the overall meaning, which is critical to convey accurately in translation.

What Happens Next:

Each head attends to its own set of relationships, focusing on different aspects. The outputs of these heads are then concatenated and combined, providing a rich representation that includes short-range dependencies, long-range dependencies, and semantic roles.

Result:

When translating, the model now has a comprehensive understanding:

  • It preserves descriptive details (e.g., "quick brown fox") due to Head 1.
  • It maintains sentence structure (e.g., "The fox jumps over...") due to Head 2.
  • It accurately translates meaning (e.g., recognizing "fox" as the actor and "dog" as the recipient) due to Head 3.

Without multiple heads, the model might miss some of these subtleties, leading to less accurate translations. Multi-head attention enables it to capture a more nuanced and multi-faceted understanding of the sentence, which enhances overall performance.

10/14/2024

Git replace old files with new files

 

·        If the previous saved password is old and you get fail message when clone the repo, you can try below:

o   $ git config --global credential.helper cache

·        Then you should be able to update your username (PA****) and password


·        Clone the Repository: If you haven’t already, clone the repository to your local machine.

o   git clone https://github.com/your-username/your-repo.git

o   cd your-repo

 
·        Remove Existing Files: Delete all the existing files and folders in the repository. Be careful not to delete the .git directory.

o   rm -rf *

 
·        Copy New Files: Copy all the files from your new folder into the repository.

o   cp -r /path/to/new-folder/* .

 
·        Stage the Changes: Stage all the new files for commit.

o   git add .

 
·        Commit the Changes: Commit the changes with a meaningful message.

o   git commit -m "Replace old files with new files"

 
·        Push the Changes: Push the changes to the remote repository.

o   git push origin main

6/13/2024

what to do when a window stuck outside the edge of monitor

  • Select the off-screen program from your Taskbar.
  • Press and hold the Win key (Windows logo key) on your keyboard.
  • While holding the Win key, tap the arrow keys (←, →) to move the window back into view.

3/17/2024

git push steps

 echo "# car_app" >> README.md

git init

git add *

git commit -m "first commit"

git branch -M main

git remote add origin https://github.com/Guofeng-Yuan/car_app.git

git push -u origin main

3/15/2024

Model deployment steps for flask

1. $ py -m venv venv

2. $ source venv/Scripts/activate

3. $ pip install flask

4. Create .flaskenv file in the root folder, inside, put 

FLASK_ENV=development

FLASK_APP=main.py

5. $ pip install --upgrade pip

6. $ pip install python-dotenv

7. Create “main.py”, inside “from application import app”

8. $ pip install scikit-learn (or any other packages that are needed)

9.     flask run



To create requirement.txt
use below is better

$pipreqs --force .

2/16/2024

MS edge blurry fonts

 MS Edge - blurry fonts - WIN10 and WIN11 - Microsoft Community


Have you tried turning off the hardware acceleration? Edge might be having some issues with your display. Try turning it off in Settings > System and performance > "Use hardware acceleration when available" and see if that helps