Model: pszemraj/bart-large-code-instructiongen
Author: pszemraj
Library: transformers
Tags: transformers, pytorch, safetensors, bart, text2text-generation, generated_from_trainer, instruct, instructions, code, instructiongen, en, dataset:pszemraj/fleece2instructions-codealpaca, license:apache-2.0, license:cc-by-nc-4.0, endpoints_compatible, region:us
Card metadata: license: apache-2.0, cc-by-nc-4.0
datasets: pszemraj/fleece2instructions-codealpaca
tags: generated_from_trainer, instruct, instructions, code, instructiongen
metrics: rouge
language: en
widget: text: git lfs install
huggingface-cli lfs-enable-largefiles .
git lfs track "*.bin"
git add .
git commit -a -m "add fp32 chkpt"
git push

example_title: bash, text: export interface DocumentParams {
  pageContent: string;

  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  metadata: Record<string, any>;
}

/**
 * Interface for interacting with a document.
 */
export class Document implements DocumentParams {
  pageContent: string;

  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  metadata: Record<string, any>;

  constructor(fields?: Partial<DocumentParams>) {
    this.pageContent = fields?.pageContent ?? this.pageContent;
    this.metadata = fields?.metadata ?? {};
  }
}

example_title: js, text: def merge(left, right):
    if len(left) == 0:
        return right

    if len(right) == 0:
        return left

    result = []
    index_left = index_right = 0

    while len(result) < len(left) + len(right):
        if left[index_left] <= right[index_right]:
            result.append(left[index_left])
            index_left += 1
        else:
            result.append(right[index_right])
            index_right += 1

        if index_right == len(right):
            result += left[index_left:]
            break

        if index_left == len(left):
            result += right[index_right:]
            break

    return result

example_title: merge, text: import pandas as pd
import plotly.graph_objects as go

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_apple_stock.csv')

fig = go.Figure(go.Scatter(x = df['AAPL_x'], y = df['AAPL_y'],
                  name='Share Prices (in USD)'))

fig.update_layout(title='Apple Share Prices over time (2014)',
                   plot_bgcolor='rgb(230, 230,230)',
                   showlegend=True)

fig.show()

example_title: plot, text: from spellchecker import SpellChecker

spell = SpellChecker()

def check_word_spelling(word: str):
    misspelled = spell.unknown([word])
    return len(misspelled) == 0

def eval_and_replace(text: str, match_token: str = "- "):
    if match_token not in text:
        return text
    else:
        while True:
            full_before_text = text.split(match_token, maxsplit=1)[0]
            before_text = [
                char for char in full_before_text.split()[-1] if char.isalpha()
            ]
            before_text = "".join(before_text)
            full_after_text = text.split(match_token, maxsplit=1)[-1]
            after_text = [char for char in full_after_text.split()[0] if char.isalpha()]
            after_text = "".join(after_text)
            full_text = before_text + after_text
            if check_word_spelling(full_text):
                text = full_before_text + full_after_text
            else:
                text = full_before_text + " " + full_after_text
            if match_token not in text:
                break
        return text

text = "I- am- a go- od- boy"
eval_and_replace(text)

example_title: spell check, text: import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

checkpoint = "distilbert-base-uncased-finetuned-sst-2-english"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
sequences = ["I've been waiting for a HuggingFace course my whole life.", "So have I!"]

tokens = tokenizer(sequences, padding=True, truncation=True, return_tensors="pt")
output = model(**tokens)

example_title: model inference
inference: parameters: max_length: 96
num_beams: 4
Likes: 7 | All-time downloads: 686
Created: 2023-03-25 05:11:16