← 开源
danielgross

LlamaAcademy

A school for camelids

Model DevelopmentFine-tuningPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
1.20k
Star
73
Fork
+0
本周
3
贡献者
创建于 2023-04-19 · 更新于 2026-09-05 · 今日第 11194 名
主要开发者
danielgrossflotothemoonhuyphan168

danielgross/LlamaAcademy 排名第 11,194,有 1,197 个星标。

同类别比较

danielgross/LlamaAcademy 排名第 11,194,此处有 8 个同类条目;a-r-j/graphein 排名第 11,193。

同类别比较
名称排名指标
facebookresearch/House3D11,183
语言:
C++
星标数:
1,199
分叉数:
185
简介:
a Realistic and Rich 3D Environment
AlgRUC/JittorGeometric11,185
语言:
Python
星标数:
1,198
分叉数:
197
简介:
JittorGeometric is a Jittor-based graph machine learning library.
DeepRec-AI/DeepRec11,191
语言:
C++
星标数:
1,197
分叉数:
359
简介:
DeepRec is a high-performance recommendation deep learning framework based on TensorFlow. It is hosted in incubation in LF AI & Data Foundation.
a-r-j/graphein11,193
语言:
Jupyter Notebook
星标数:
1,197
分叉数:
143
简介:
Protein Graph Library
kexinhuang12345/DeepPurpose11,195
语言:
Jupyter Notebook
星标数:
1,197
分叉数:
307
简介:
A Deep Learning Toolkit for DTI, Drug Property, PPI, DDI, Protein Function Prediction (Bioinformatics)
huggingface/hmtl11,201
语言:
Python
星标数:
1,196
分叉数:
143
简介:
🌊HMTL: Hierarchical Multi-Task Learning - A State-of-the-Art neural network model for several NLP tasks based on PyTorch and AllenNLP
autonomousvision/stylegan-t11,205
语言:
Python
星标数:
1,195
分叉数:
60
简介:
[ICML'23] StyleGAN-T: Unlocking the Power of GANs for Fast Large-Scale Text-to-Image Synthesis
facebookresearch/mixup-cifar1011,206
语言:
Python
星标数:
1,195
分叉数:
231
简介:
mixup: Beyond Empirical Risk Minimization
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Fine-tuning
关键词Coding, PEFT
星标数1,197
分叉数73
贡献者3
创建日期2023-04-19
更新日期2026-09-05
1 天星标数0
7 天星标数0
排名11,194
上次排名11,145
排名变化-49
7 天星标排名12,923
上次 7 天星标排名12,935
7 天星标排名变化12
总星标排名9,730
上次总星标排名9,718
总星标排名变化-12
README 摘录

LlamaAcademy: Teaching Llamas How to Code Teach GPTs to read API documentation using LLaMA, LoRA, and Langchain. Wouldn't it be great if GPTs could learn about new APIs? With LlamaAcademy you can teach GPTs to call Stripe, Notion, or even your own product's API. Instead of hosting API _documentation_, you can host an API _implementation_! You can host that model on your server, and users can call your bespoke mini-GPT to write their API glue. We'd love help with

that, if you're into that sort of thing. Demo: A Llama That Learned Notion's API How it works LlamaAcademy is a pipeline that combines the following steps: crawling, data generation using GPT3. 5 and GPT4 and fine-tuning Vicuna-13B on synthetic data. Installation You need to install firefox and Elinks, then install all necessary pythonic dependencies. Usage LlamaAcademy uses a simple interface by abstracting every user hyper-parameters with a configuration file. To run the fine-tuning process, run

: After the training, run export LoRA model to HuggingFace weights by doing this: To run inference with LangChain: Hardware requirements This code is tested with 1 RTX A6000 instance in vast. 8 GB, therefore, any GPU with VRAM > 30GB will be safe for fine-tuning. The fine-tuning is done after 20 minutes with 100 examples, the data generation is completed after 1 hour (most of the time spent in GPT-4 instances generation and crawling process due to screen

scraping being quite expensive). Plan [ ] Implement (IA)^3 for few-shot fine-tuning. [ ] Implement scratch-pad based GPT-4 agent to generate multi-turn planning and generating code. Code Files This repository provides the following Folders and Files : The folder contains seed tasks + training URLs to generate the data (see self-instruct for more information). : The folder for the configuration files. : The file for custom Langchain pipeline and agents. : The file implementing data generation using GPT3. 5, GPT4, Bing with

different strategies. : The main inteference file for user to customize their Alpaca to API references (scraping API references website, generating instruction-code pairs and fine-tuning Vicuna). : Allow user to inference with a trained model with a query related to the API (using Langchain + LlamaAcademy). : (Still under construction) Using memory fine-tuning method to force Vicuna to memorize API references without pre-training. : Implementing API references crawling using Elinks and Selenium.

常见问题

记录了多少星标和分叉?

danielgross/LlamaAcademy 有 1,197 个星标和 73 个分叉。

仓库排名是多少?

danielgross/LlamaAcademy 排名第 11,194。

记录的语言和类别是什么?

danielgross/LlamaAcademy 有 1,197 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

danielgross/LlamaAcademy 与 a-r-j/graphein 比较,后者排名第 11,193,有 1,197 个星标。

README

LlamaAcademy: Teaching Llamas How to Code

Teach GPTs to read API documentation using LLaMA, LoRA, and Langchain.

Wouldn't it be great if GPTs could learn about new APIs? With LlamaAcademy you can teach GPTs to call Stripe, Notion, or even your own product's API. Instead of hosting API documentation, you can host an API implementation! Just point LlamaAcademy at your API docs, run the script, and -- shazam! -- a new LLaMA model will be created for you. You can host that model on your server, and users can call your bespoke mini-GPT to write their API glue.

Seriously?

Well, sort of. LlamaAcademy is experimental -- we haven't gotten it to consistently generate great code (yet). We'd love help with that, if you're into that sort of thing.

Demo: A Llama That Learned Notion's API

https://user-images.githubusercontent.com/51882888/232329429-c7aadc40-8251-41f3-b4bb-9ac41ac2c6f8.mp4

How it works

LlamaAcademy is a pipeline that combines the following steps: crawling, data generation using GPT3.5 and GPT4 and fine-tuning Vicuna-13B on synthetic data.

Installation

You need to install firefox and Elinks, then install all necessary pythonic dependencies. You also need to input an OPENAI_KEY.

sudo apt-get install firefox elinks
conda env create --file=environment.yaml
conda env config vars set OPENAI_API_KEY=YOUR_API_KEY

Usage

LlamaAcademy uses a simple interface by abstracting every user hyper-parameters with a configuration file.

GENERATE: True # Turn off if you don't want to generate the data
API_DOCS: https://developers.notion.com/reference 
DEPTH_CRAWLING: 1 # 0 if your API website is long and not hierarchical (for example polygon.io). Otherwise, feel free to set, it might take much longer if your webiste has many children.
SUMMARIZE_DOCS: True
MICRO_BATCH_SIZE: 3  
BATCH_SIZE: 12
EPOCHS: 4  
LEARNING_RATE: 3e-4  
WARMUP_STEPS: 5
CUTOFF_LEN: 2048 
LORA_R: 8
LORA_ALPHA: 16
LORA_DROPOUT: 0.05
OPENAI_ENGINE: "gpt-4"
NUM_PROMPT_INSTRUCTIONS: 3
NUM_TASKS_TO_GENERATE: 200 # Recommended number of examples
DATA_PATH: "assets/"
OUTPUT_DIR: "output/lora-vicuna-api-notion"

To run the fine-tuning process, run:

CUDA_VISIBLE_DEVICES=0 python3 main.py --config configs/vicuna_13b.yaml

After the training, run export LoRA model to HuggingFace weights by doing this:

python3 export_hf.py --base_model jeffwan/vicuna-13b --model_folder output/lora-vicuna-api-notion

To run inference with LangChain:

python3 inference.py --model_folder output/lora-vicuna-api-notion

Hardware requirements

This code is tested with 1 RTX A6000 instance in vast.ai (approximated 0.6$/1h). The peak VRAM is 27.8 GB, therefore, any GPU with VRAM > 30GB will be safe for fine-tuning. The fine-tuning is done after 20 minutes with 100 examples, the data generation is completed after 1 hour (most of the time spent in GPT-4 instances generation and crawling process due to screen scraping being quite expensive).

Plan

  • [ ] Implement (IA)^3 for few-shot fine-tuning.
  • [ ] Implement flash_attention.
  • [ ] Implement scratch-pad based GPT-4 agent to generate multi-turn planning and generating code.

Code Files

This repository provides the following Folders and Files

  • assets/: The folder contains seed tasks + training URLs to generate the data (see self-instruct for more information).
    • data.json: generated data will be saved here for training.
    • generated_instructions.jsonl: generated instructions for instruction tuning will be saved here.
    • training_urls.json: common API for crawling and generating the training data (other direction).
    • seed_tasks.json: human written seed tasks for self-instruct process (4-10 examples are recommended).
    • prompt_summary.txt: prompt for GPT3.5-turbo extract and summarize the crawled API documents.
    • prompt_input_code.txt: prompt for GPT4 generate code with references queried from the vector score.
  • configs/: The folder for the configuration files.
  • chain.py: The file for custom Langchain pipeline and agents.
  • data_gen.py: The file implementing data generation using GPT3.5, GPT4, Bing with different strategies.
  • main.py: The main inteference file for user to customize their Alpaca to API references (scraping API references website, generating instruction-code pairs and fine-tuning Vicuna).
  • inference.py: Allow user to inference with a trained model with a query related to the API (using Langchain + LlamaAcademy).
  • environment.yaml: The file for the dependencies.
  • utils.py: The file for the helper functions.
  • memorizing.py: (Still under construction) Using memory fine-tuning method to force Vicuna to memorize API references without pre-training.
  • ingest_docs.py: Implementing API references crawling using Elinks and Selenium.
排名相邻
同类项目