Skip to content

Instantly share code, notes, and snippets.

View philschmid's full-sized avatar

Philipp Schmid philschmid

View GitHub Profile
import requests as r
from huggingface_hub import HfFolder
from tqdm import tqdm
from datasets import Dataset
headers = {"Authorization": f"Bearer {HfFolder.get_token()}"}
sess = r.Session()
sess.headers.update(headers)
#!/bin/bash
start=$(date +%s)
# Initialize RESULT_DIRECTORY with default value and HF_MODEL_ID with an empty string
RESULT_DIRECTORY="nous"
HF_MODEL_ID=""
TRUST_REMOTE_CODE="False"
CURRENT_DIR=$(pwd)
# List of Benchmarking Tasks
from openai import OpenAI
# initialize the client but point it to TGI
client = OpenAI(
base_url="https://api-inference.huggingface.co/v1",
api_key="hf_xxx" # Replace with your token
)
chat_completion = client.chat.completions.create(
model="google/gemma-7b-it",
torchrun --nnodes 2 --nproc_per_node 32 --master_addr algo-1 --master_port 7777 --node_rank 0 train_llama.py \
--model_id "meta-llama/Llama-2-70b-hf" \
--lr 5e-5 \
--per_device_train_batch_size 16 \
--bf16 True \
--epochs 3
import re
cli_output = '''
Text Generation Launcher
Usage: text-generation-launcher [OPTIONS]
Options:
--model-id <MODEL_ID>
The name of the model to load. Can be a MODEL_ID as listed on <https://hf.co/models> like `gpt2` or `OpenAssistant/oasst-sft-1-pythia-12b`. Or it can be a local directory containing the necessary files as saved by `save_pretrained(...)` methods of transformers
Nuremberg (/ˈnjʊərəmbɜːrɡ/ NURE-əm-burg; German: Nürnberg [ˈnʏʁnbɛʁk] (listen); in the local East Franconian dialect: Nämberch [ˈnɛmbɛrç]) is the second-largest city of the German state of Bavaria after its capital Munich, and its 541.000 inhabitants[3] make it the 14th-largest city in Germany. On the Pegnitz River (from its confluence with the Rednitz in Fürth onwards: Regnitz, a tributary of the River Main) and the Rhine–Main–Danube Canal, it lies in the Bavarian administrative region of Middle Franconia, and is the largest city and the unofficial capital of Franconia. Nuremberg forms with the neighbouring cities of Fürth, Erlangen and Schwabach a continuous conurbation with a total population of 800,376 (2019), which is the heart of the urban area region with around 1.4 million inhabitants,[4] while the larger Nuremberg Metropolitan Region has approximately 3.6 million inhabitants. The city lies about 170 kilometres (110 mi) north of Munich. It is the largest city in the East Franconian dialect area (collo
B_INST, E_INST = "[INST]", "[/INST]"
B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
SYSTEM= """\
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.
If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."""
INSTRUCTION="What is the receipe of mayonnaise?"
SOURCE:
- [1](https://react.dev/learn/writing-markup-with-jsx)
JSX is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file. Although there are other ways to write components, most React developers prefer the conciseness of JSX, and most codebases use it.
- [2](https://react.dev/learn/writing-markup-with-jsx#jsx-putting-markup-into-javascript)
The Web has been built on HTML, CSS, and JavaScript. For many years, web developers kept content in HTML, design in CSS, and logic in JavaScript—often in separate files! Content was marked up inside HTML while the page’s logic lived separately in JavaScript. JSX and React are two separate things. They’re often used together, but you can use them independently of each other. JSX is a syntax extension, while React is a JavaScript library.
QUESTION: Do I need to use JSX with React?
JSX is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file. Although there are other ways to write components, most React developers prefer the conciseness of JSX, and most codebases use it.
You will learn
Why React mixes markup with rendering logic
How JSX is different from HTML
How to display information with JSX
JSX: Putting markup into JavaScript
The Web has been built on HTML, CSS, and JavaScript. For many years, web developers kept content in HTML, design in CSS, and logic in JavaScript—often in separate files! Content was marked up inside HTML while the page’s logic lived separately in JavaScript:
HTML markup with purple background and a div with two child tags: p and form.
system = [
"",
"You are an AI assistant. Provide a detailed answer so user don’t need to search outside to understand the answer.",
"You are an AI assistant. You will be given a task. You must generate a detailed and long answer.",
"You are a helpful assistant, who always provide explanation. Think like you are answering to a five year old.",
"You are an AI assistant that follows instruction extremely well. Help as much as you can.",
"You are an AI assistant that helps people find information. Provide a detailed answer so user don’t need to search outside to understand the answer.",
"You are an AI assistant. User will you give you a task. Your goal is to complete the task as faithfully as you can. While performing the task think step-by-step and justify your steps.",
"You should describe the task and explain your answer. While answering a multiple choice question, first output the correct answer(s). Then explain why other answers are wrong. Think like you are answering to a fiv