--- license: - apache-2.0 - cc-by-nc-4.0 datasets: pszemraj/fleece2instructions-codealpaca tags: - generated_from_trainer - instruct - instructions - code metrics: - rouge language: - en widget: - 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: Example One - text: | import torch from tqdm.auto import tqdm device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") model.to(device) progress_bar = tqdm(range(num_training_steps)) model.train() for epoch in range(num_epochs): for batch in train_dataloader: batch = {k: v.to(device) for k, v in batch.items()} outputs = model(**batch) loss = outputs.loss loss.backward() optimizer.step() lr_scheduler.step() optimizer.zero_grad() progress_bar.update(1) example_title: Example Two - text: | import evaluate metric = evaluate.load("glue", "mrpc") model.eval() for batch in eval_dataloader: batch = {k: v.to(device) for k, v in batch.items()} with torch.no_grad(): outputs = model(**batch) logits = outputs.logits predictions = torch.argmax(logits, dim=-1) metric.add_batch(predictions=predictions, references=batch["labels"]) metric.compute() example_title: Example Three - 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: Example Four - text: | export interface DocumentParams { pageContent: string; // eslint-disable-next-line @typescript-eslint/no-explicit-any metadata: Record; } /** * Interface for interacting with a document. */ export class Document implements DocumentParams { pageContent: string; // eslint-disable-next-line @typescript-eslint/no-explicit-any metadata: Record; constructor(fields?: Partial) { this.pageContent = fields?.pageContent ?? this.pageContent; this.metadata = fields?.metadata ?? {}; } } example_title: Example Five inference: parameters: max_length: 128 num_beams: 4 --- # bart-large-code-instructiongen Use this text2text model to find out what LLM instructions might be able to generate an arbitary piece of code! This model is a fine-tuned version of [facebook/bart-large](https://huggingface.co./facebook/bart-large) on the `pszemraj/fleece2instructions-codealpaca` dataset. It achieves the following results on the evaluation set: - Loss: 0.9222 - Rouge1: 62.0692 - Rouge2: 36.1947 - Rougel: 57.5128 - Rougelsum: 58.6613 - Gen Len: 31.0060 ## Intended uses & limitations 🚨 **note:** as the authors elected to release the [original dataset](https://github.com/sahil280114/codealpaca) under `cc-by-nc`, the license carries over to this model and **cannot be used for commercial activity**. Intended use: Research on domain adaptation and/or other improvements to LLMs by extending instruction:text data pairs. ## Training and evaluation data Refer to the linked dataset card for `pszemraj/fleece2instructions-codealpaca` or the [original dataset](https://github.com/sahil280114/codealpaca) repo. ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 6e-05 - train_batch_size: 16 - eval_batch_size: 8 - seed: 42 - distributed_type: multi-GPU - gradient_accumulation_steps: 2 - total_train_batch_size: 32 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: cosine - lr_scheduler_warmup_ratio: 0.03 - num_epochs: 3.0 ### Training results | Training Loss | Epoch | Step | Validation Loss | Rouge1 | Rouge2 | Rougel | Rougelsum | Gen Len | |:-------------:|:-----:|:----:|:---------------:|:-------:|:-------:|:-------:|:---------:|:-------:| | 1.0914 | 1.0 | 563 | 1.0303 | 60.288 | 34.1884 | 55.9293 | 57.0714 | 30.6267 | | 0.8688 | 2.0 | 1126 | 0.9333 | 61.0409 | 34.9823 | 56.4887 | 57.6662 | 31.7255 | | 0.6773 | 3.0 | 1689 | 0.9222 | 62.0692 | 36.1947 | 57.5128 | 58.6613 | 31.0060 |