flex_ai
0.42
Twitter (aka x)
from flex_ai import FlexAI
from openai import OpenAI
import time
# Initialize the Flex AI client
client = FlexAI ( api_key = "your_api_key_here" )
# Create dataset - for all datasets [here](https://docs.getflex.ai/quickstart#upload-your-first-dataset)
dataset = client . create_dataset (
"API Dataset New" ,
"instruction/train.jsonl" ,
"instruction/eval.jsonl"
)
# Start a fine-tuning task
task = client . create_finetune (
name = "My Task New" ,
dataset_id = dataset [ "id" ],
model = "meta-llama/Llama-3.2-1B-Instruct" ,
n_epochs = 5 ,
train_with_lora = True ,
lora_config = {
"lora_r" : 64 ,
"lora_alpha" : 8 ,
"lora_dropout" : 0.1
},
n_checkpoints_and_evaluations_per_epoch = 1 ,
batch_size = 4 ,
learning_rate = 0.0001 ,
save_only_best_checkpoint = True
)
# Wait for training completion
client . wait_for_task_completion ( task_id = task [ "id" ])
# Wait for last checkpoint to be uploaded
while True :
checkpoints = client . get_task_checkpoints ( task_id = task [ "id" ])
if checkpoints and checkpoints [ - 1 ][ "stage" ] == "FINISHED" :
last_checkpoint = checkpoints [ - 1 ]
checkpoint_list = [{
"id" : last_checkpoint [ "id" ],
"name" : "step_" + str ( last_checkpoint [ "step" ])
}]
break
time . sleep ( 10 ) # Wait 10 seconds before checking again
# Create endpoint
endpoint_id = client . create_multi_lora_endpoint (
name = "My Endpoint New" ,
lora_checkpoints = checkpoints_list ,
compute = "A100-40GB"
)
endpoint = client . wait_for_endpoint_ready ( endpoint_id = endpoint_id )
# Use the model
openai_client = OpenAI (
api_key = "your_api_key_here" ,
base_url = f" { endpoint [ 'url' ] } /v1"
)
completion = openai_client . completions . create (
model = "meta-llama/Llama-3.2-1B-Instruct" ,
prompt = "Translate the following English text to French" ,
max_tokens = 60
)
print ( completion . choices [ 0 ]. text )ตารางนี้ให้ภาพรวมของแบบจำลองภาษาขนาดใหญ่ (LLMS) สำหรับการปรับแต่งโดยประมาณจากที่รู้จักกันดีที่สุดจนถึงน้อยที่สุด มันแสดงรายละเอียดคีย์สำหรับแต่ละรุ่นรวมถึงชื่อครอบครัวจำนวนพารามิเตอร์ความยาวบริบทและคุณสมบัติเพิ่มเติม
| ชื่อนางแบบ | ตระกูล | พารามิเตอร์ (B) | ความยาวบริบท | รองรับ VLLM | การสนับสนุน Lora |
|---|---|---|---|---|---|
| NVIDIA-LLAMA-3.1-NEMOTRON-70B-Instruct-HF | llama3.1 | 70 | 131,072 | ใช่ | ใช่ |
| Meta-Llama-3.2-3b-Instruct | llama3.2 | 3 | 131,072 | ใช่ | ใช่ |
| Meta-Llama-3.2-1B-Instruct | llama3.2 | 1 | 131,072 | ใช่ | ใช่ |
| Mistral-Small-Instruct-2409 | ผิดพลาด | 7.2 | 128,000 | ใช่ | ใช่ |
| MINISTRAL-8B-Instruct-2410 | ผิดพลาด | 8 | 128,000 | ใช่ | ใช่ |
| MathStral-7B-V0.1 | ผิดพลาด | 7 | 32,000 | ใช่ | ใช่ |
| QWEN2.5-CODER-7B-Instruct | Qwen2.5 | 7 | 32,768 | ใช่ | ใช่ |
| Aya-Expanse-32b | aya | 32 | 128,000 | ใช่ | เลขที่ |
| Aya-Expanse-8b | aya | 8 | 8,000 | ใช่ | เลขที่ |
| Nemotron-Mini-4b-Instruct | Nemotron | 4 | 4,096 | ใช่ | เลขที่ |
| Gemma-2-2b-it | Gemma2 | 2 | 8,192 | ใช่ | ใช่ |
| Meta-Llama-3.1-70B-Instruct | llama3.1 | 70 | 131,072 | ใช่ | ใช่ |
| Meta-Llama-3.1-70B-Instruct | llama3.1 | 70 | 131,072 | ใช่ | ใช่ |
| meta-llama-3.1-70b | llama3.1 | 70 | 131,072 | ใช่ | ใช่ |
| Meta-Llama-3.1-8B-Instruct | llama3.1 | 8 | 131,072 | ใช่ | ใช่ |
| meta-llama-3.1-8b | llama3.1 | 8 | 131,072 | ใช่ | ใช่ |
| Meta-Llama-3-70B-Instruct | ลามะ 3 | 70 | 8,192 | ใช่ | ใช่ |
| meta-llama-3-70b | ลามะ 3 | 70 | 8,192 | ใช่ | ใช่ |
| Meta-Llama-3-8B-Instruct | ลามะ 3 | 8 | 8,192 | ใช่ | ใช่ |
| meta-llama-3-8b | ลามะ 3 | 8 | 8,192 | ใช่ | ใช่ |
| MixTRAL-8X7B-Instruct-V0.1 | มิกซ์ | 46.7 | 32,768 | ใช่ | ใช่ |
| MISTRAL-7B-Instruct-V0.3 | ผิดพลาด | 7.2 | 32,768 | ใช่ | ใช่ |
| Mistral-Nemo-Instruct-2407 | ผิดพลาด | 12.2 | 128,000 | เลขที่ | เลขที่ |
| Mistral-Nemo-Base-2407 | ผิดพลาด | 12.2 | 128,000 | เลขที่ | เลขที่ |
| Gemma-2-27b-it | Gemma2 | 27 | 8,192 | ใช่ | ใช่ |
| Gemma-2-27b | Gemma2 | 27 | 8,192 | ใช่ | ใช่ |
| Gemma-2-9b-it | Gemma2 | 9 | 8,192 | ใช่ | ใช่ |
| Gemma-2-9b | Gemma2 | 9 | 8,192 | ใช่ | ใช่ |
| PHI-3-Medium-128K-Instruct | Phi3 | 14 | 128,000 | ใช่ | เลขที่ |
| PHI-3-Medium-4K-Instruct | Phi3 | 14 | 4,000 | ใช่ | เลขที่ |
| PHI-3-SMALL-128K-Instruct | Phi3 | 7.4 | 128,000 | ใช่ | เลขที่ |
| PHI-3-SMALL-8K-Instruct | Phi3 | 7.4 | 8,000 | ใช่ | เลขที่ |
| PHI-3-MINI-128K-Instruct | Phi3 | 3.8 | 128,000 | ใช่ | เลขที่ |
| PHI-3-MINI-4K-Instruct | Phi3 | 3.8 | 4,096 | ใช่ | เลขที่ |
| QWEN2-72B-Instruct | Qwen2 | 72 | 32,768 | ใช่ | ใช่ |
| QWEN2-72B | Qwen2 | 72 | 32,768 | ใช่ | ใช่ |
| QWEN2-57B-A14B-Instruct | Qwen2 | 57 | 32,768 | ใช่ | ใช่ |
| QWEN2-57B-A14B | Qwen2 | 57 | 32,768 | ใช่ | ใช่ |
| QWEN2-7B-Instruct | Qwen2 | 7 | 32,768 | ใช่ | ใช่ |
| QWEN2-7B | Qwen2 | 7 | 32,768 | ใช่ | ใช่ |
| QWEN2-1.5B-Instruct | Qwen2 | 1.5 | 32,768 | ใช่ | ใช่ |
| QWEN2-1.5B | Qwen2 | 1.5 | 32,768 | ใช่ | ใช่ |
| QWEN2-0.5B-Instruct | Qwen2 | 0.5 | 32,768 | ใช่ | ใช่ |
| QWEN2-0.5B | Qwen2 | 0.5 | 32,768 | ใช่ | ใช่ |
| tinyllama_v1.1 | tinyllama | 1.1 | 2,048 | เลขที่ | เลขที่ |
| Deepseek-Coder-V2-lite-base | DEEPSEEEK-CODER-V2 | 16 | 163,840 | เลขที่ | เลขที่ |
| internlm2_5-7b-chat | internlm2.5 | 7.74 | 1,000,000 | ใช่ | เลขที่ |
| internlm2_5-7b | internlm2.5 | 7.74 | 1,000,000 | ใช่ | เลขที่ |
| jamba-v0.1 | กระวนกระวายใจ | 51.6 | 256,000 | ใช่ | ใช่ |
| yi-1.5-34b-chat | Yi-1.5 | 34.4 | 4,000 | ใช่ | ใช่ |
| yi-1.5-34b | Yi-1.5 | 34.4 | 4,000 | ใช่ | ใช่ |
| yi-1.5-34b-32k | Yi-1.5 | 34.4 | 32,000 | ใช่ | ใช่ |
| yi-1.5-34b-chat-16k | Yi-1.5 | 34.4 | 16,000 | ใช่ | ใช่ |
| yi-1.5-9b-chat | Yi-1.5 | 8.83 | 4,000 | ใช่ | ใช่ |
| yi-1.5-9b | Yi-1.5 | 8.83 | 4,000 | ใช่ | ใช่ |
| yi-1.5-9b-32k | Yi-1.5 | 8.83 | 32,000 | ใช่ | ใช่ |
| yi-1.5-9b-chat-16k | Yi-1.5 | 8.83 | 16,000 | ใช่ | ใช่ |
| yi-1.5-6b-chat | Yi-1.5 | 6 | 4,000 | ใช่ | ใช่ |
| yi-1.5-6b | Yi-1.5 | 6 | 4,000 | ใช่ | ใช่ |
| C4AI-Command-R-V01 | command-r | 35 | 131,072 | ใช่ | เลขที่ |
ตารางนี้ให้ภาพรวมที่ครอบคลุมของรุ่นที่มีขนาดขนาดความสามารถและการสนับสนุนสำหรับเทคนิคการปรับจูนต่างๆ เมื่อเลือกแบบจำลองสำหรับการปรับแต่งให้พิจารณาปัจจัยต่าง ๆ เช่นขนาดของแบบจำลองความยาวบริบทและการสนับสนุนสำหรับเทคนิคการเพิ่มประสิทธิภาพเฉพาะเช่น VLLM และ LORA