flex_ai
0.42
Twitter(又稱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支持 | 洛拉支持 |
|---|---|---|---|---|---|
| NVIDIA-LALAMA-3.1-NEMOTRON-70B-INSTRUCT-HF | Llama3.1 | 70 | 131,072 | 是的 | 是的 |
| meta-llama-3.2-3b-thrinct | Llama3.2 | 3 | 131,072 | 是的 | 是的 |
| meta-llama-3.2-1b-thrinct | Llama3.2 | 1 | 131,072 | 是的 | 是的 |
| Mistral-Small-Instruct-2409 | Mistral | 7.2 | 128,000 | 是的 | 是的 |
| Ministral-8B-Instruct-2410 | Mistral | 8 | 128,000 | 是的 | 是的 |
| MATHSTRAL-7B-V0.1 | Mistral | 7 | 32,000 | 是的 | 是的 |
| QWEN2.5-coder-7b-instruct | qwen2.5 | 7 | 32,768 | 是的 | 是的 |
| Aya-Expanse-32b | 嗯 | 32 | 128,000 | 是的 | 不 |
| Aya-Expanse-8B | 嗯 | 8 | 8,000 | 是的 | 不 |
| nemotron-mini-4b構造 | Nemotron | 4 | 4,096 | 是的 | 不 |
| Gemma-2-2b-it | Gemma2 | 2 | 8,192 | 是的 | 是的 |
| meta-llama-3.1-70B教學 | Llama3.1 | 70 | 131,072 | 是的 | 是的 |
| meta-llama-3.1-70B教學 | Llama3.1 | 70 | 131,072 | 是的 | 是的 |
| meta-llama-3.1-70b | Llama3.1 | 70 | 131,072 | 是的 | 是的 |
| meta-llama-3.1-8B教學 | Llama3.1 | 8 | 131,072 | 是的 | 是的 |
| meta-llama-3.1-8b | Llama3.1 | 8 | 131,072 | 是的 | 是的 |
| meta-llama-3-70B教學 | Llama3 | 70 | 8,192 | 是的 | 是的 |
| meta-llama-3-70b | Llama3 | 70 | 8,192 | 是的 | 是的 |
| meta-llama-3-8b教學 | Llama3 | 8 | 8,192 | 是的 | 是的 |
| meta-llama-3-8b | Llama3 | 8 | 8,192 | 是的 | 是的 |
| Mixtral-8x7b-instruct-v0.1 | 混音 | 46.7 | 32,768 | 是的 | 是的 |
| MISTRAL-7B-INSTRUCT-V0.3 | Mistral | 7.2 | 32,768 | 是的 | 是的 |
| Mistral-Nemo-Instruct-2407 | Mistral | 12.2 | 128,000 | 不 | 不 |
| MISTRAL-NEMO-BASE-2407 | Mistral | 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教學 | phi3 | 14 | 128,000 | 是的 | 不 |
| phi-3-MeDium-4K教學 | phi3 | 14 | 4,000 | 是的 | 不 |
| PHI-3-SMALL-128K教學 | phi3 | 7.4 | 128,000 | 是的 | 不 |
| phi-3-small-8K教學 | phi3 | 7.4 | 8,000 | 是的 | 不 |
| PHI-3-MINI-128K教學 | phi3 | 3.8 | 128,000 | 是的 | 不 |
| PHI-3-MINI-4K教學 | 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教學 | qwen2 | 7 | 32,768 | 是的 | 是的 |
| QWEN2-7B | qwen2 | 7 | 32,768 | 是的 | 是的 |
| Qwen2-1.5b-trustinct | 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鹼基 | DeepSeek-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 | 命令r | 35 | 131,072 | 是的 | 不 |
該表提供了有關可用模型,大小,功能和對各種微調技術的支持的全面概述。在選擇用於微調的模型時,請考慮諸如模型大小,上下文長度和對特定優化技術(例如VLLM和LORA)的支持之類的因素。