Skip to content

Instantly share code, notes, and snippets.

View mrm8488's full-sized avatar
🏠
Working from home

Manuel Romero mrm8488

🏠
Working from home
View GitHub Profile
@mrm8488
mrm8488 / 26_prompt_principles.md
Created May 27, 2024 00:33
26 prompt principles

Overview of 26 prompt principles

#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. Could you kindly describe the structure of a human cell, please? Describe the structure of a human cell.
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
@mrm8488
mrm8488 / prompt_principles.md
Created May 27, 2024 00:30
LLMs Prompt principles
#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.
@mrm8488
mrm8488 / finetune_llama_v2.py
Created July 19, 2023 14:25 — forked from younesbelkada/finetune_llama_v2.py
Fine tune Llama v2 models on Guanaco Dataset
# 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
@mrm8488
mrm8488 / index.html
Created August 18, 2022 09:51
Plane Trails
<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>
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!")
@mrm8488
mrm8488 / testN.js
Created June 18, 2020 21:42
Test again
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;
}
@mrm8488
mrm8488 / gesirtasf.py
Created June 2, 2020 16:02
easdfasfdasdfsd
(XJ Bs
wget -0 translation.py
Ig NGL
7 ; PE TE Da MAR a SERS |

How to download files from a GCP Bucket to Colab ☁📚➡📝

  1. Go to your bucket dashboard

  2. Click on the bucket where is stored the resource you want to download

  3. Go to Permissions tab

  4. Add a new member with the gmail account your are going to use in your Colab

  5. Give to this member the required permissions (Admin, List, Create,...)

    5.b. Admin permissions will work!

  6. In your Colab Notebook, execute the following commands:

@mrm8488
mrm8488 / compare_js_objects.js
Created April 30, 2020 01:45
Vanilla COMPARE JS OBJECTS
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) {
@mrm8488
mrm8488 / text_dataset_pytorch.py
Created April 17, 2020 03:17
Create an efficient text dataset
class LazyTextDataset(Dataset):
def __init__(self, filename):
self._filename = filename
self._total_data = 0
self._total_data = int(subprocess.check_output("wc -l " + filename, shell=True).split()[0])
def __getitem__(self, idx):
line = linecache.getline(self._filename, idx + 1)
csv_line = csv.reader([line])
return next(csv_line)