index int64 0 0 | repo_id stringlengths 15 98 | file_path stringlengths 33 130 | content stringlengths 27 14.4M |
|---|---|---|---|
0 | hf_public_repos | hf_public_repos/olm-training/train_model.py | import logging
import sys
from dataclasses import dataclass, field
from typing import Optional
from t5_data_collator import DataCollatorForT5MLM, compute_t5_input_and_target_lengths
from transformers import (
HfArgumentParser,
AutoModelForMaskedLM,
AutoModelForCausalLM,
T5ForConditionalGeneration,
... |
0 | hf_public_repos | hf_public_repos/olm-training/create_tokenizer.py | from datasets import concatenate_datasets, load_dataset
from tqdm import tqdm
from transformers import AutoTokenizer
from itertools import chain
import math
import argparse
parser = argparse.ArgumentParser(description="Constructs a Tokenizer from a list of input datasets. It uses all available CPUs by default.")
parse... |
0 | hf_public_repos | hf_public_repos/olm-training/t5_data_collator.py | '''
Note that this code mostly comes from https://github.com/huggingface/transformers/blob/main/examples/flax/language-modeling/run_t5_mlm_flax.py with some modifications.
The code here doesn't rely on flax anymore.
'''
from typing import Dict, List
import numpy as np
from transformers import (
BatchEncoding,
... |
0 | hf_public_repos | hf_public_repos/olm-training/requirements.txt | datasets==2.6.1
transformers==4.24.0
torch==1.13.0
tensorboard==2.10.1
|
0 | hf_public_repos | hf_public_repos/olm-training/README.md | # Online Language Modelling Training Pipeline
This repo has the code for training models and tokenizers on the olm data, but it should work with any Hugging Face dataset with text examples. You can see the models for the OLM project here: https://huggingface.co/olm. They actually get better performance than their orig... |
0 | hf_public_repos | hf_public_repos/olm-training/chunk_and_tokenize_datasets.py | from datasets import concatenate_datasets, load_dataset
from tqdm import tqdm
from transformers import AutoTokenizer
from itertools import chain
import math
import argparse
parser = argparse.ArgumentParser(description="Constructs a tokenized dataset from an input tokenizer and a list of input datasets. Also chunks the... |
0 | hf_public_repos | hf_public_repos/olm-training/LICENSE | Copyright 2022- The Hugging Face team. All rights reserved.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" s... |
0 | hf_public_repos | hf_public_repos/node-question-answering/tsconfig.json | {
"compilerOptions": {
"skipLibCheck": true,
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "ES2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or... |
0 | hf_public_repos | hf_public_repos/node-question-answering/DistilBERT_to_SavedModel.ipynb | import tensorflow as tf
from transformers import TFDistilBertForQuestionAnswering
distilbert = TFDistilBertForQuestionAnswering.from_pretrained('distilbert-base-cased-distilled-squad')concrete_function = tf.function(distilbert.call).get_concrete_function([tf.TensorSpec([None, 384], tf.int32, name="input_ids"), tf.Tens... |
0 | hf_public_repos | hf_public_repos/node-question-answering/.eslintrc.json | {
"root": true,
"env": {
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2019,
... |
0 | hf_public_repos | hf_public_repos/node-question-answering/.prettierrc.json | {
"$schema": "http://json.schemastore.org/prettierrc",
"printWidth": 90
}
|
0 | hf_public_repos | hf_public_repos/node-question-answering/package-lock.json | {
"name": "question-answering",
"version": "3.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
"integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c... |
0 | hf_public_repos | hf_public_repos/node-question-answering/CHANGELOG.md | # [3.0.0](https://github.com/huggingface/node-question-answering/compare/v2.0.0...v3.0.0) (2020-07-02)
This version introduces full support for any DistilBERT/BERT/RoBERTa based models from the [Hugging Face model hub](https://huggingface.co/models). It also simplifies the model instantiation by introducing a single `... |
0 | hf_public_repos | hf_public_repos/node-question-answering/jest.config.js | // For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 0,
// Respect "browser" f... |
0 | hf_public_repos | hf_public_repos/node-question-answering/README.md | # Question Answering for Node.js
[](https://www.npmjs.com/package/question-answering)
#### Production-ready Question Answering directly in Node.js, with only 3 lines of code!
This package leverages the power of the [🤗Tokenizers](https://github.com/huggi... |
0 | hf_public_repos | hf_public_repos/node-question-answering/tsconfig.prod.json | {
"extends": "./tsconfig.json",
"exclude": [
"./**/*.test.ts"
],
"compilerOptions": {
"sourceMap": false,
"declaration": true
}
} |
0 | hf_public_repos | hf_public_repos/node-question-answering/.eslintignore | node_modules
dist
build
coverage
|
0 | hf_public_repos | hf_public_repos/node-question-answering/package.json | {
"name": "question-answering",
"version": "3.0.0",
"description": "Production-ready Question Answering directly in Node.js",
"keywords": [
"nlp",
"question answering",
"tensorflow",
"distilbert"
],
"repository": {
"type": "git",
"url": "git+https://github.com/huggingface/node-questi... |
0 | hf_public_repos | hf_public_repos/node-question-answering/LICENSE | Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
... |
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/scripts/cli.js | #!/usr/bin/env node
//@ts-check
const shell = require("shelljs");
const yargs = require("yargs");
const utils = require("../dist/utils");
// Fail this script if any of these commands fail
shell.set("-e");
yargs
.command(
"download [model]",
"Download a model (defaults to distilbert-base-cased-distilled-sq... |
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/scripts/benchmark.js | #!/usr/bin/env node
//@ts-check
const QAClient = require("../dist/qa").QAClient;
const DATA = [
{
context: `
Super Bowl 50 was an American football game to determine the champion of the National Football League (NFL) for the 2015 season.
The American Football Conference (AFC) champion Denver Broncos... |
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/scripts/example.js | #!/usr/bin/env node
//@ts-check
const yargsInteractive = require("yargs-interactive");
const QAClient = require("../dist/qa").QAClient;
const texts = {
"Charles VI": `
At his father's death on 16 September 1380, Charles VI inherited the throne of France. His coronation took place on 4 November 1380, at Reims Cathe... |
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/scripts/build.js | #!/usr/bin/env node
//@ts-check
const path = require("path");
const shell = require("shelljs");
const fs = require("fs");
const promisify = require("util").promisify;
const distPath = "./dist";
const buildPath = "./build";
// Fail this script if any of these commands fail
shell.set("-e");
// Ensure that our directo... |
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/src/qa-options.ts | import * as path from "path";
import { Model } from "./models/model";
import { Tokenizer } from "./tokenizers";
export const ROOT_DIR = process.cwd();
export const DEFAULT_ASSETS_DIR = path.join(ROOT_DIR, "./.models");
export const DEFAULT_MODEL_NAME = "distilbert-base-cased-distilled-squad";
export const DEFAULT_VOC... |
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/src/qa.test.ts | import { mocked } from "ts-jest";
import { QAClient } from "./";
import { initModel } from "./models";
import { RuntimeType } from "./runtimes";
import { Tokenizer } from "./tokenizers";
const basicQuestion = "What was the final score?";
const basicContext = `
Super Bowl 50 was an American football game to determin... |
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/src/utils.ts | import fs from "fs";
import https from "https";
import fetch from "node-fetch";
import path from "path";
import ProgressBar from "progress";
import shell from "shelljs";
import tar from "tar";
import { promisify } from "util";
import { getModelType, ModelType } from "./models/model";
import { ROOT_DIR } from "./qa-opt... |
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/src/index.ts | export * from "./qa";
export * from "./models";
export { QAOptions } from "./qa-options";
export * from "./runtimes";
export * from "./tokenizers";
|
0 | hf_public_repos/node-question-answering | hf_public_repos/node-question-answering/src/qa.ts | import { Encoding, slice, TruncationStrategy } from "tokenizers";
import { Logits, Model } from "./models/model";
import { initModel } from "./models/model.factory";
import { DEFAULT_MODEL_NAME, QAOptions } from "./qa-options";
import { Tokenizer } from "./tokenizers/tokenizer";
import { initTokenizer, TokenizerFactor... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/tokenizers/tokenizer.ts | import {
BaseTokenizer,
Encoding,
PaddingConfiguration,
TruncationConfiguration,
TruncationOptions
} from "tokenizers";
import { ModelType } from "../models";
export interface TokenizerBaseOptions {
/**
* @default true
*/
lowercase?: boolean;
/**
* Name of the merges file (if applicable to th... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/tokenizers/tokenizer.factory.ts | import { getModelType, ModelType } from "../models/model";
import { DEFAULT_ASSETS_DIR } from "../qa-options";
import { getAbsolutePath, getVocab, TokenMappingKey } from "../utils";
import { BertTokenizer, BertTokenizerOptions } from "./bert.tokenizer";
import { RobertaTokenizer, RobertaTokenizerOptions } from "./rober... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/tokenizers/index.ts | export { Tokenizer } from "./tokenizer";
export {
initTokenizer,
BertTokenizerFactoryOptions,
RobertaTokenizerFactoryOptions,
TokenizerFactoryOptions
} from "./tokenizer.factory";
|
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/tokenizers/bert.tokenizer.ts | import path from "path";
import {
BertWordPieceOptions,
BertWordPieceTokenizer,
Encoding,
getTokenContent,
Token
} from "tokenizers";
import { DEFAULT_VOCAB_PATH } from "../qa-options";
import { exists } from "../utils";
import { FullTokenizerOptions, Tokenizer } from "./tokenizer";
export interface BertTok... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/tokenizers/roberta.tokenizer.ts | import path from "path";
import {
AddedToken,
ByteLevelBPETokenizer,
Encoding,
getTokenContent,
PaddingConfiguration,
Token
} from "tokenizers";
import { robertaProcessing } from "tokenizers/bindings/post-processors";
import { exists } from "../utils";
import { FullTokenizerOptions, Tokenizer } from "./tok... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/models/model.factory.ts | import path from "path";
import { DEFAULT_ASSETS_DIR } from "../qa-options";
import { Remote } from "../runtimes/remote.runtime";
import { LocalRuntime, Runtime, RuntimeOptions, RuntimeType } from "../runtimes/runtime";
import { SavedModel } from "../runtimes/saved-model.runtime";
import { TFJS } from "../runtimes/tfj... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/models/distilbert.model.ts | import { Encoding } from "tokenizers";
import { Logits, Model, ModelInput, ModelType } from "./model";
export class DistilbertModel extends Model {
public static readonly inputs: ReadonlyArray<ModelInput> = [
ModelInput.AttentionMask,
ModelInput.Ids
];
public readonly type = ModelType.Distilbert;
ru... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/models/index.ts | export { ModelInput, ModelInputsNames, ModelOutputNames, ModelType } from "./model";
export { initModel, ModelFactoryOptions } from "./model.factory";
|
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/models/roberta.model.ts | import { Encoding } from "tokenizers";
import { Logits, Model, ModelInput, ModelType } from "./model";
export class RobertaModel extends Model {
public static readonly inputs: ReadonlyArray<ModelInput> = [
ModelInput.AttentionMask,
ModelInput.Ids
];
public readonly type = ModelType.Roberta;
runInfer... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/models/model.ts | import { Encoding } from "tokenizers";
import { Runtime } from "../runtimes/runtime";
export enum ModelInput {
AttentionMask = "attentionMask",
Ids = "inputIds",
TokenTypeIds = "tokenTypeIds"
}
export enum ModelType {
Distilbert = "distilbert",
Roberta = "roberta",
Bert = "bert" // AFTER roberta, to be s... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/models/bert.model.ts | import { Encoding } from "tokenizers";
import { Logits, Model, ModelInput, ModelType } from "./model";
export class BertModel extends Model {
public static readonly inputs: ReadonlyArray<ModelInput> = [
ModelInput.AttentionMask,
ModelInput.Ids,
ModelInput.TokenTypeIds
];
public readonly type = Mode... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/runtimes/worker-message.ts | import { MessagePort } from "worker_threads";
import { FullParams } from "./runtime";
export interface BaseMessage {
type: "load" | "infer" | "init";
}
export interface InferenceMessage extends BaseMessage {
_id: number;
inputs: {
ids: number[][];
attentionMask: number[][];
tokenTypeIds?: number[][... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/runtimes/saved-model.worker.ts | import { join as joinPaths } from "path";
import { MessageChannel, MessagePort, SHARE_ENV, Worker } from "worker_threads";
import { Logits } from "../models/model";
import { FullParams } from "./runtime";
import { InferenceMessage, InitMessage } from "./worker-message";
interface InferenceTask {
id: number;
model... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/runtimes/tfjs.runtime.ts | import * as tf from "@tensorflow/tfjs-node";
import * as path from "path";
import { Logits, ModelInput } from "../models/model";
import { isOneDimensional } from "../utils";
import {
FullParams,
ModelDefaults,
PartialMetaGraph,
Runtime,
RuntimeOptions
} from "./runtime";
export class TFJS extends Runtime {
... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/runtimes/saved-model.runtime.ts | import * as tf from "@tensorflow/tfjs-node";
import { Logits } from "../models/model";
import { FullParams, Runtime, RuntimeOptions } from "./runtime";
import { SavedModelWorker } from "./saved-model.worker";
export class SavedModel extends Runtime {
private static worker = new SavedModelWorker();
private constr... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/runtimes/remote.runtime.ts | import fetch from "node-fetch";
import { Logits, ModelInput } from "../models/model";
import {
FullParams,
PartialMetaGraph,
PartialModelTensorInfo,
Runtime,
RuntimeOptions
} from "./runtime";
export class Remote extends Runtime {
private constructor(public params: Readonly<FullParams>) {
super(params... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/runtimes/index.ts | export { RuntimeType } from "./runtime";
|
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/runtimes/runtime.ts | import { Logits, ModelInput, ModelInputsNames, ModelOutputNames } from "../models/model";
const MODEL_DEFAULTS: ModelDefaults = {
inputsNames: {
[ModelInput.AttentionMask]: "attention_mask",
[ModelInput.Ids]: "input_ids",
[ModelInput.TokenTypeIds]: "token_type_ids"
},
outputsNames: {
endLogits: "... |
0 | hf_public_repos/node-question-answering/src | hf_public_repos/node-question-answering/src/runtimes/saved-model.worker-thread.ts | import * as tf from "@tensorflow/tfjs-node";
import { TFSavedModel } from "@tensorflow/tfjs-node/dist/saved_model";
import { MessagePort, parentPort } from "worker_threads";
import { Logits, ModelInput } from "../models/model";
import { isOneDimensional } from "../utils";
import { FullParams } from "./runtime";
import... |
0 | hf_public_repos | hf_public_repos/hf-rocm-benchmark/README.md | ## TGI benchmark
TGI benchmark with TP=8 can be reproduced as follow on MI250 and MI300:
```
docker run --rm -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
--device=/dev/kfd --device=/dev/dri --group-add video --ipc=host --shm-size 256g \
--net host -v $(pwd)/hf_cache:/data -e HUGGING_FACE_HUB_TO... |
0 | hf_public_repos | hf_public_repos/hf-rocm-benchmark/deepspeed_zero3.yml | compute_environment: LOCAL_MACHINE
debug: false
deepspeed_config:
deepspeed_multinode_launcher: standard
offload_optimizer_device: none
offload_param_device: none
zero3_init_flag: true
zero3_save_16bit_model: true
zero_stage: 3
distributed_type: DEEPSPEED
downcast_bf16: 'no'
machine_rank: 0
main_training_fu... |
0 | hf_public_repos | hf_public_repos/hf-rocm-benchmark/LICENSE | MIT License
Copyright (c) 2024 Hugging Face
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, dist... |
0 | hf_public_repos | hf_public_repos/hf-rocm-benchmark/peft_fine_tuning.py | import gc
import os
import sys
import threading
import psutil
import torch
from accelerate import Accelerator
from datasets import load_dataset
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
default_data_collator,
get_linear... |
0 | hf_public_repos | hf_public_repos/Google-Cloud-Containers/README.md | # 🤗 Hugging Face Deep Learning Containers for Google Cloud
<img alt="Hugging Face x Google Cloud" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/google-cloud/thumbnail.png" />
[Hugging Face Deep Learning Containers for Google Cloud](https://cloud.google.com/deep-learning-container... |
0 | hf_public_repos | hf_public_repos/Google-Cloud-Containers/Makefile | .PHONY: docs clean help
docs: clean
@echo "Processing README.md files from examples/gke, examples/cloud-run, and examples/vertex-ai..."
@mkdir -p docs/source/examples
@echo "Converting Jupyter Notebooks to MDX..."
@doc-builder notebook-to-mdx examples/vertex-ai/notebooks/
@echo "Auto-generating example files for ... |
0 | hf_public_repos | hf_public_repos/Google-Cloud-Containers/LICENSE | Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
... |
0 | hf_public_repos/Google-Cloud-Containers | hf_public_repos/Google-Cloud-Containers/scripts/upload_model_to_gcs.sh | #!/bin/bash
# This script downloads a model from HuggingFace and uploads it to a bucket in Google Cloud Storage.
# Requirements:
# `huggingface_hub`, `hf_transfer`, `gcloud`, and `gsutil` installed and authenticated
# Usage:
# ./upload_model_to_gcs.sh --model-id meta-llama/Meta-Llama-3-8B-Instruct --gcs gs://hf-models... |
0 | hf_public_repos/Google-Cloud-Containers | hf_public_repos/Google-Cloud-Containers/scripts/push_image_to_gcr.sh | #!/bin/bash
# This script pushes a built Docker image into the Artifact Registry in GCP.
# ./push_image_to_gcr.sh --image my-image --project-id my-project --location us-central1 --repository deep-learning-images --destination us-central1-docker.pkg.dev/my-project/deep-learning-images/huggingface-image
# Parse command... |
0 | hf_public_repos/Google-Cloud-Containers | hf_public_repos/Google-Cloud-Containers/scripts/README.md | # Scripts
This directory contains some useful scripts when working with Hugging Face in Google Cloud Platform (GCP), and some are used within some of the examples in order to provide the community with a simpler way to interact with Hugging Face via GCP and the other way around.
Note that before running any script, y... |
0 | hf_public_repos/Google-Cloud-Containers/scripts | hf_public_repos/Google-Cloud-Containers/scripts/internal/update_example_tables.py | import os
import re
import json
from collections import defaultdict
import subprocess
def get_tracked_files():
result = subprocess.run(["git", "ls-files"], capture_output=True, text=True)
return set(result.stdout.splitlines())
def extract_info_from_md(file_path):
with open(file_path, "r") as f:
... |
0 | hf_public_repos/Google-Cloud-Containers | hf_public_repos/Google-Cloud-Containers/examples/README.md | # Examples
This directory contains some usage examples for the Hugging Face Deep Learning Containers (DLCs) available in Google Cloud, as published from the [containers directory](../containers).
The examples' structure is organized based on the Google Cloud service we can use to deploy the containers, being:
- [Goo... |
0 | hf_public_repos/Google-Cloud-Containers/examples | hf_public_repos/Google-Cloud-Containers/examples/cloud-run/README.md | # (Preview) Cloud Run Examples
This directory contains usage examples of the Hugging Face Deep Learning Containers (DLCs) in Cloud Run only for inference at the moment, with a focus on Large Language Models (LLMs).
> [!WARNING]
> Cloud Run now offers on-demand access to NVIDIA L4 GPUs for running AI inference workloa... |
0 | hf_public_repos/Google-Cloud-Containers/examples/cloud-run | hf_public_repos/Google-Cloud-Containers/examples/cloud-run/deploy-llama-3-1-on-cloud-run/README.md | ---
title: Deploy Llama 3.1 8B with TGI DLC on Cloud Run
type: inference
---
# Deploy Llama 3.1 8B with TGI DLC on Cloud Run
Llama 3.1 is the latest open LLM from Meta, released in July 2024. Llama 3.1 comes in three sizes: 8B for efficient deployment and development on consumer-size GPU, 70B for large-scale AI nativ... |
0 | hf_public_repos/Google-Cloud-Containers/examples/cloud-run | hf_public_repos/Google-Cloud-Containers/examples/cloud-run/deploy-gemma-2-on-cloud-run/README.md | ---
title: Deploy Gemma2 9B with TGI DLC on Cloud Run
type: inference
---
# Deploy Gemma2 9B with TGI DLC on Cloud Run
Gemma 2 is an advanced, lightweight open model that enhances performance and efficiency while building on the research and technology of its predecessor and the Gemini models developed by Google Deep... |
0 | hf_public_repos/Google-Cloud-Containers/examples | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/README.md | # Vertex AI Examples
This directory contains usage examples of the Hugging Face Deep Learning Containers (DLCs) in Google Vertex AI for both training and inference, with a focus on Large Language Models (LLMs), while also including some examples showcasing how to train and deploy models suited for other task than text... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/deploy-flux-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-pytorch-inference-cu121.2-2.transformers.4-44.ubuntu2204.py311import os
from google.cloud import aiplatform
aiplatform.init(
project=os.getenv("PROJECT_ID"),
locatio... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/deploy-gemma-from-gcs-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env BUCKET_URI=gs://hf-tgi-vertex-ai
%env ARTIFACT_NAME=google--gemma-7b-it
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-text-generation-inference-cu124.2-3.ubuntu2204.py311%%bash
# Parse the bucket from the provided ... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/deploy-bert-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-pytorch-inference-cu121.2-2.transformers.4-44.ubuntu2204.py311import os
from google.cloud import aiplatform
aiplatform.init(
project=os.getenv("PROJECT_ID"),
locatio... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/trl-full-sft-fine-tuning-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env BUCKET_URI=gs://hf-vertex-pipelines
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-pytorch-training-cu121.2-3.transformers.4-42.ubuntu2204.py310import os
from google.cloud import aiplatform
aiplatform.init(
proj... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/trl-lora-sft-fine-tuning-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env BUCKET_URI=gs://hf-vertex-pipelines
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-pytorch-training-cu121.2-3.transformers.4-42.ubuntu2204.py310import os
from google.cloud import aiplatform
aiplatform.init(
proj... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/deploy-llama-vision-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-text-generation-inference-cu124.2-3.ubuntu2204.py311import os
from google.cloud import aiplatform
aiplatform.init(
project=os.getenv("PROJECT_ID"),
location=os.geten... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/deploy-gemma-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-text-generation-inference-cu124.2-3.ubuntu2204.py311import os
from google.cloud import aiplatform
aiplatform.init(
project=os.getenv("PROJECT_ID"),
location=os.geten... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/evaluate-llms-with-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=gcp-partnership-412108
%env LOCATION=us-central1
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-text-generation-inference-cu121.2-2.ubuntu2204.py310 from huggingface_hub import interpreter_login
interpreter_login()import os
from google.cloud import aiplatform
aip... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/deploy-llama-3-1-405b-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-text-generation-inference-cu124.2-3.ubuntu2204.py311import os
from google.cloud import aiplatform
aiplatform.init(
project=os.getenv("PROJECT_ID"),
location=os.geten... |
0 | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks | hf_public_repos/Google-Cloud-Containers/examples/vertex-ai/notebooks/deploy-embedding-on-vertex-ai/vertex-notebook.ipynb | %env PROJECT_ID=your-project-id
%env LOCATION=your-location
%env CONTAINER_URI=us-docker.pkg.dev/deeplearning-platform-release/gcr.io/huggingface-text-embeddings-inference-cu122.1-4.ubuntu2204import os
from google.cloud import aiplatform
aiplatform.init(
project=os.getenv("PROJECT_ID"),
location=os.getenv("LOC... |
0 | hf_public_repos/Google-Cloud-Containers/examples | hf_public_repos/Google-Cloud-Containers/examples/gke/README.md | # Google Kubernetes Engine (GKE) Examples
This directory contains usage examples of the Hugging Face Deep Learning Containers (DLCs) in Google Kubernetes Engine (GKE) for both training and inference, with a focus on Large Language Models (LLMs).
## Training Examples
| Example |... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-llama-vision-deployment/README.md | ---
title: Deploy Llama 3.2 11B Vision with TGI DLC on GKE
type: inference
---
# Deploy Llama 3.2 11B Vision with TGI DLC on GKE
[Llama 3.2](https://huggingface.co/blog/llama32) is the latest release of open LLMs from the Llama family released by Meta (as of October 2024); Llama 3.2 Vision comes in two sizes: 11B for... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-llama-vision-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-llama-vision-deployment/config/service.yaml | apiVersion: v1
kind: Service
metadata:
name: tgi-service
spec:
selector:
app: tgi-server
type: ClusterIP
ports:
- protocol: TCP
port: 8080
targetPort: 8080
|
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-llama-vision-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-llama-vision-deployment/config/ingress.yaml | apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tgi-ingress
# https://cloud.google.com/kubernetes-engine/docs/concepts/ingress
annotations:
kubernetes.io/ingress.class: "gce"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-llama-vision-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-llama-vision-deployment/config/deployment.yaml | apiVersion: apps/v1
kind: Deployment
metadata:
name: tgi-deployment
spec:
replicas: 1
selector:
matchLabels:
app: tgi-server
template:
metadata:
labels:
app: tgi-server
hf.co/model: meta-llama--Llama-3.2-11B-Vision-Instruct
hf.co/task: text-generation
spec:
... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke | hf_public_repos/Google-Cloud-Containers/examples/gke/trl-lora-fine-tuning/job.yaml | apiVersion: batch/v1
kind: Job
metadata:
name: trl-lora-sft
namespace: hf-gke-namespace
spec:
template:
metadata:
name: trl
labels:
app: trl
hf.co/model: mistralai--Mistral-7B-v0.3
hf.co/dataset: timdettmers--openassistant-guanaco
annotations:
gke-gcsfuse/volu... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke | hf_public_repos/Google-Cloud-Containers/examples/gke/trl-lora-fine-tuning/README.md | ---
title: Fine-tune Mistral 7B v0.3 with PyTorch Training DLC using SFT + LoRA on GKE
type: training
---
# Fine-tune Mistral 7B v0.3 with PyTorch Training DLC using SFT + LoRA on GKE
Mistral is a family of models with varying sizes, created by the Mistral AI team; the Mistral 7B v0.3 LLM is a Mistral 7B v0.2 with ex... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-deployment/README.md | ---
title: Deploy Meta Llama 3 8B with TGI DLC on GKE
type: inference
---
# Deploy Meta Llama 3 8B with TGI DLC on GKE
Meta Llama 3 is the latest LLM from the Llama family, released by Meta; coming in two sizes 8B and 70B, including both the base model and the instruction-tuned model. Text Generation Inference (TGI) ... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-deployment/config/service.yaml | apiVersion: v1
kind: Service
metadata:
name: tgi-service
spec:
selector:
app: tgi-server
type: ClusterIP
ports:
- protocol: TCP
port: 8080
targetPort: 8080
|
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-deployment/config/ingress.yaml | apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tgi-ingress
# https://cloud.google.com/kubernetes-engine/docs/concepts/ingress
annotations:
kubernetes.io/ingress.class: "gce"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-deployment/config/deployment.yaml | apiVersion: apps/v1
kind: Deployment
metadata:
name: tgi-deployment
spec:
replicas: 1
selector:
matchLabels:
app: tgi-server
template:
metadata:
labels:
app: tgi-server
hf.co/model: meta-llama--Meta-Llama-3-8B-Instruct
hf.co/task: text-generation
spec:
conta... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-multi-lora-deployment/README.md | ---
title: Deploy Gemma2 with multiple LoRA adapters with TGI DLC on GKE
type: inference
---
# Deploy Gemma2 with multiple LoRA adapters with TGI DLC on GKE
Gemma 2 is an advanced, lightweight open model that enhances performance and efficiency while building on the research and technology of its predecessor and the ... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-multi-lora-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-multi-lora-deployment/config/service.yaml | apiVersion: v1
kind: Service
metadata:
name: tgi-service
spec:
selector:
app: tgi-server
type: ClusterIP
ports:
- protocol: TCP
port: 8080
targetPort: 8080
|
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-multi-lora-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-multi-lora-deployment/config/ingress.yaml | apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tgi-ingress
# https://cloud.google.com/kubernetes-engine/docs/concepts/ingress
annotations:
kubernetes.io/ingress.class: "gce"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-multi-lora-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tgi-multi-lora-deployment/config/deployment.yaml | apiVersion: apps/v1
kind: Deployment
metadata:
name: tgi-deployment
spec:
replicas: 1
selector:
matchLabels:
app: tgi-server
template:
metadata:
labels:
app: tgi-server
hf.co/model: google--gemma-2-2b-it
hf.co/task: text-generation
spec:
containers:
... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment/README.md | ---
title: Deploy Snowflake's Arctic Embed with TEI DLC on GKE
type: inference
---
# Deploy Snowflake's Arctic Embed with TEI DLC on GKE
Snowflake's Arctic Embed is a suite of text embedding models that focuses on creating high-quality retrieval models optimized for performance, achieving state-of-the-art (SOTA) perf... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment/gpu-config/service.yaml | apiVersion: v1
kind: Service
metadata:
name: tei-service
spec:
selector:
app: tei-server
type: ClusterIP
ports:
- protocol: TCP
port: 8080
targetPort: 8080
|
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment/gpu-config/ingress.yaml | apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tei-ingress
# https://cloud.google.com/kubernetes-engine/docs/concepts/ingress
annotations:
kubernetes.io/ingress.class: "gce"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment/gpu-config/deployment.yaml | apiVersion: apps/v1
kind: Deployment
metadata:
name: tei-deployment
spec:
replicas: 1
selector:
matchLabels:
app: tei-server
template:
metadata:
labels:
app: tei-server
hf.co/model: Snowflake--snowflake-arctic-embed-m
hf.co/task: text-embeddings
spec:
contai... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment/cpu-config/service.yaml | apiVersion: v1
kind: Service
metadata:
name: tei-service
spec:
selector:
app: tei-server
type: ClusterIP
ports:
- protocol: TCP
port: 8080
targetPort: 8080
|
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment/cpu-config/ingress.yaml | apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tei-ingress
# https://cloud.google.com/kubernetes-engine/docs/concepts/ingress
annotations:
kubernetes.io/ingress.class: "gce"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-deployment/cpu-config/deployment.yaml | apiVersion: apps/v1
kind: Deployment
metadata:
name: tei-deployment
spec:
replicas: 1
selector:
matchLabels:
app: tei-server
template:
metadata:
labels:
app: tei-server
hf.co/model: Snowflake--snowflake-arctic-embed-m
hf.co/task: text-embeddings
spec:
contai... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment/README.md | ---
title: Deploy BGE Base v1.5 with TEI DLC from GCS on GKE
type: inference
---
# Deploy BGE Base v1.5 with TEI DLC from GCS on GKE
BGE, standing for BAAI General Embedding, is a collection of embedding models released by BAAI, which is an English base model for general embedding tasks ranked in the MTEB Leaderboard... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment/gpu-config/service.yaml | apiVersion: v1
kind: Service
metadata:
name: tei-service
namespace: hf-gke-namespace
spec:
selector:
app: tei-server
type: ClusterIP
ports:
- protocol: TCP
port: 8080
targetPort: 8080
|
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment/gpu-config/storageclass.yaml | apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ssd
namespace: hf-gke-namespace
provisioner: pd.csi.storage.gke.io
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
parameters:
type: pd-ssd
|
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment/gpu-config/ingress.yaml | apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tei-ingress
namespace: hf-gke-namespace
# https://cloud.google.com/kubernetes-engine/docs/concepts/ingress
annotations:
kubernetes.io/ingress.class: "gce"
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix... |
0 | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment | hf_public_repos/Google-Cloud-Containers/examples/gke/tei-from-gcs-deployment/gpu-config/deployment.yaml | apiVersion: apps/v1
kind: Deployment
metadata:
name: tei-deployment
namespace: hf-gke-namespace
spec:
replicas: 1
selector:
matchLabels:
app: tei-server
template:
metadata:
labels:
app: tei-server
hf.co/model: BAAI--bge-base-en-v1
hf.co/task: text-embeddings
spe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.