#Principle | Prompt Principle | Example Prompt |
---|---|---|
1 | If you prefer more concise answers, no need to be polite with LLM so there is no need to add phrases like “please", "if you don't mind", "thank you", "I would like to", etc., and get straight to the point. | |
2 | Integrate the intended audience in the prompt, e.g., the audience is an expert in the field. | Construct an overview of how smartphones work, intended for seniors who have never used one before. |
3 | Break down complex tasks into a sequence of simpler prompts in an interactive conversation. | P1: Distribute the negative sign to each term inside the parentheses of the following equation: 2x + 3y - (4x - 5y) P2: Combine like terms for 'x' and 'y' separately. P3: Provide the simplified expression after combining t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original idea: https://www.linkedin.com/feed/update/urn:li:activity:7210982019751661568/ | |
# Original script: https://github.com/rasbt/LLMs-from-scratch/blob/main/ch07/05_dataset-generation/llama3-ollama.ipynb | |
# Make sure have your ollama server runing | |
# and pip install tqdm datasets | |
# Note that the instruction datasets created here are for educational purposes. However, it is the users' duty to ensure that their use adheres to the terms of the relevant licensing agreements with Meta AI's Llama 3. | |
import urllib.request | |
import json | |
import argparse | |
from tqdm import tqdm |
#Principle | Prompt Principle for Instructions |
---|---|
1 | If you prefer more concise answers, no need to be polite with LLM so there is no need to add phrases like "please", "if you don't mind", "thank you", "I would like to", etc., and get straight to the point. |
2 | Integrate the intended audience in the prompt, e.g., the audience is an expert in the field. |
3 | Break down complex tasks into a sequence of simpler prompts in an interactive conversation. |
4 | Employ affirmative directives such as do, while steering clear of negative language like don't. |
5 | When you need clarity or a deeper understanding of a topic, idea, or any piece of information, utilize the following prompts: o Explain [insert specific topic] in simple terms. o Explain to me like I'm 11 years old. o Explain to me as if I'm a beginner in [field]. o Write the [essay/text/paragraph] using simple English like you're explaining something to a 5-year-old. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg id="patternSVG" xmlns="http://www.w3.org/2000/svg"> | |
<defs> | |
<pattern id="sqrs" width="20" height="20" patternUnits="userSpaceOnUse" id="pulseBg" viewBox="0 0 20 20" > | |
<rect class="grid" x="0" y="0" width="20" height="20" fill="none"/> | |
</pattern> | |
</defs> | |
<rect id="grid" class="grid" fill="url(#sqrs)" width="100%" height="100%" /> | |
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NlpRawTextDataset(Dataset): | |
def __init__(self, tokenizer, file_path: str, block_size: int): | |
self.tokenizer = tokenizer | |
self.file_path = file_path | |
self.block_size = block_size | |
print("Loading Dataset...") | |
self.dataset = load_dataset("text", data_files=file_path)["train"] | |
print("Loaded Dataset!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shallowEqual(obj1, obj2) { | |
const keys1 = Object.keys(obj1); | |
if (keys1.length == | |
Object.keys(obj2).length) return | |
false; | |
for (const k1 of keys1) { | |
if (!(k1 in obj2)) return false; | |
if (obj1[k1] !== obj2[k1]) return | |
false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(XJ Bs | |
wget -0 translation.py | |
Ig NGL | |
7 ; PE TE Da MAR a SERS | |
-
Go to your
bucket dashboard
-
Click on the bucket where is stored the resource you want to download
-
Go to
Permissions
tab -
Add a new member
with the gmail account your are going to use in your Colab -
Give
to this member the requiredpermissions
(Admin, List, Create,...)5.b. Admin permissions will work!
-
In your
Colab Notebook
, execute the following commands:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compareObjects = (a, b) => { | |
if (a === b) return true; | |
if (typeof a != 'object' || typeof b != 'object' || a == null || b == null) return false; | |
let keysA = Object.keys(a), keysB = Object.keys(b); | |
if (keysA.length != keysB.length) return false; | |
for (let key of keysA) { |
NewerOlder