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 / 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)
"################################################################################\n",
"# INSTALL CONDA ON GOOGLE COLAB\n",
"################################################################################\n",
"! wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.2-Linux-x86_64.sh\n",
"! chmod +x Miniconda3-py37_4.8.2-Linux-x86_64.sh\n",
"! bash ./Miniconda3-py37_4.8.2-Linux-x86_64.sh -b -f -p /usr/local\n",
"import sys\n",
"sys.path.append('/usr/local/lib/python3.7/site-packages/')"
@mrm8488
mrm8488 / smallberta_pretraining.ipynb
Created February 25, 2020 20:44 — forked from aditya-malte/smallberta_pretraining.ipynb
smallBERTa_Pretraining.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.