英文

基本模型: replit/replit-code-v1-3b

该模型以FP16格式上传(与原始的精细调整上传相比,大小减小一半,以便更容易下载)

该模型由Sahil2801的CodeAlpaca和Teknium的GPTeacher Code-Instruct进行了精细调整,以提供Replit的Code模型指导能力

在HuggingFace演示空间上尝试该模型: https://huggingface.co/spaces/teknium/Replit-v1-CodeInstruct-3B

数据集链接: CodeAlpaca: https://huggingface.co/datasets/sahil2801/CodeAlpaca-20k GPTeacher子集-Code Instruct: https://github.com/teknium1/GPTeacher

该模型在Alpaca格式的大约25,000个代码指导/响应对中,使用2个a100 80GB的设备进行了1小时的训练

有关运行此模型的基本要求,请参阅基本模型的HuggingFace模型卡片: https://huggingface.co/replit/replit-code-v1-3b

可以像任何alpaca精细调整一样,以以下方式提示该模型:

### Instruction:
<prompt>

### Input:
<additional context>

### Response:

或者

### Instruction:
<prompt>

### Response:

该模型似乎在模型参数中使用device="auto"存在问题(并且需要trust_remote_code=True),因此您应该像我在此处加载它一样:

        self.tokenizer = AutoTokenizer.from_pretrained("./Replit-CodeInstruct/", trust_remote_code=True)
        self.model = AutoModelForCausalLM.from_pretrained(
            "./Replit-CodeInstruct",
            torch_dtype=torch.bfloat16,
            trust_remote_code=True
        )
        self.model.to('cuda')

对我来说,该模型在以下抽样器设置下产生了连贯的输出,但是您可以随意尝试:

max_new_tokens=128, do_sample=True, use_cache=True, temperature=0.2, top_p=0.9, eos_token_id= self.tokenizer.eos_token_id

在令牌化器的解码参数中,还需要这些设置:

skip_special_tokens=True, clean_up_tokenization_space=False

使用HuggingFace训练器训练模型时使用了以下参数:

--model_name_or_path replit/replit-code-v1-3b --data_path /root/stanford_alpaca/train.json --bf16 True --output_dir /root/stanford_alpaca/model_ckpts --num_train_epochs 3 --per_device_train_batch_size 4 --per_device_eval_batch_size 1 --gradient_accumulation_steps 8 --save_strategy steps --save_steps 200 --save_total_limit 3 --learning_rate 1e-5 --weight_decay 0. --warmup_ratio 0.03 --tf32 True --run_name Replit1