Spaces:
Running
Running
Commit ·
b0701ef
1
Parent(s): 32d5b8f
feat: implement GridMind-RL training pipeline with GRPO Colab notebook and Unsloth configuration script
Browse filesFiles changed (2)
344 unmodified lines3453463473483493503513 unmodified lines3553563573583593603611 unmodified line363364365366367368316 unmodified lines685686687688689690691344 unmodified lines"MODEL_NAME = \"Qwen/Qwen2.5-1.5B-Instruct\"\n","gpu_name = torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"CPU\"\n","gpu_total_gb = torch.cuda.get_device_properties(0).total_memory / 1e9 if torch.cuda.is_available() else 0\n","print(f\"Loading {MODEL_NAME} with 4-bit quantization on {gpu_name} ({gpu_total_gb:.2f} GB VRAM)...\")\n","\n","tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)\n","if tokenizer.pad_token is None:\n",3 unmodified lines"# 4-bit quantization for memory-efficient QLoRA training\n","bnb_config = BitsAndBytesConfig(\n"," load_in_4bit=True,\n"," bnb_4bit_compute_dtype=torch.float16,\n"," bnb_4bit_quant_type=\"nf4\",\n"," bnb_4bit_use_double_quant=True,\n",")\n",1 unmodified line"model = AutoModelForCausalLM.from_pretrained(\n"," MODEL_NAME,\n"," quantization_config=bnb_config,\n"," device_map=\"auto\",\n"," trust_remote_code=True,\n",")\n",316 unmodified lines" \"max_new_tokens\": 80,\n"," \"num_generations\": 4,\n"," \"learning_rate\": 5e-5,\n"," \"fp16\": True,\n"," \"logging_steps\": 1,\n"," \"save_steps\": 60,\n"," \"report_to\": \"none\",\n",344 unmodified lines3453463473483493503513523533543 unmodified lines3583593603613623633641 unmodified line366367368369370371372316 unmodified lines689690691692693694695696697344 unmodified lines"MODEL_NAME = \"Qwen/Qwen2.5-1.5B-Instruct\"\n","gpu_name = torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"CPU\"\n","gpu_total_gb = torch.cuda.get_device_properties(0).total_memory / 1e9 if torch.cuda.is_available() else 0\n","use_bf16 = bool(torch.cuda.is_available() and torch.cuda.is_bf16_supported())\n","compute_dtype = torch.bfloat16 if use_bf16 else torch.float16\n","print(f\"Loading {MODEL_NAME} with 4-bit quantization on {gpu_name} ({gpu_total_gb:.2f} GB VRAM)...\")\n","print(f\"Compute dtype: {compute_dtype}\")\n","\n","tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)\n","if tokenizer.pad_token is None:\n",3 unmodified lines"# 4-bit quantization for memory-efficient QLoRA training\n","bnb_config = BitsAndBytesConfig(\n"," load_in_4bit=True,\n"," bnb_4bit_compute_dtype=compute_dtype,\n"," bnb_4bit_quant_type=\"nf4\",\n"," bnb_4bit_use_double_quant=True,\n",")\n",1 unmodified line"model = AutoModelForCausalLM.from_pretrained(\n"," MODEL_NAME,\n"," quantization_config=bnb_config,\n"," torch_dtype=compute_dtype,\n"," device_map=\"auto\",\n"," trust_remote_code=True,\n",")\n",316 unmodified lines" \"max_new_tokens\": 80,\n"," \"num_generations\": 4,\n"," \"learning_rate\": 5e-5,\n"," \"fp16\": not use_bf16,\n"," \"bf16\": use_bf16,\n"," \"max_grad_norm\": 0.0,\n"," \"logging_steps\": 1,\n"," \"save_steps\": 60,\n"," \"report_to\": \"none\",\n",
641 unmodified lines64264364464564664735 unmodified lines683684685686687688689641 unmodified linesprint(f"🚀 Loading model: {args.model_name}")max_seq_length = 512lora_rank = 8model, tokenizer = FastLanguageModel.from_pretrained(model_name=args.model_name,35 unmodified lines"warmup_ratio": 0.1,"logging_steps": 5,"save_steps": 100,"fp16": True,"report_to": "none","seed": 42,}641 unmodified lines64264364464564664764835 unmodified lines684685686687688689690691692641 unmodified linesprint(f"🚀 Loading model: {args.model_name}")max_seq_length = 512lora_rank = 8use_bf16 = bool(torch.cuda.is_available() and torch.cuda.is_bf16_supported())model, tokenizer = FastLanguageModel.from_pretrained(model_name=args.model_name,35 unmodified lines"warmup_ratio": 0.1,"logging_steps": 5,"save_steps": 100,"fp16": not use_bf16,"bf16": use_bf16,"max_grad_norm": 0.0,"report_to": "none","seed": 42,}
scripts/gridmind_grpo_colab.ipynb+8-2
scripts/train_unsloth.py+4-1