# fine-tune-mistral
Code used to fine-tune this model: [abacaj/mistral-7b-sft](https://huggingface.co/abacaj/mistral-7b-sft). Add your data in the data folder as `train.jsonl` and `validation.jsonl`.
**Note** this repo is intended for full fine-tuning of mistral not qlora or other methods.
# How to run
Install dependencies:
```
python -m venv env \
&& source env/bin/activate \
&& pip install -r requirements.txt
```
[Get a Hugging Face token](https://huggingface.co/settings/tokens) and set the variable:
```
export HF_TOKEN="[insert token here]"
```
Run training code:
```
torchrun --nnodes=1 --nproc-per-node=<REPLACE_WITH_NUMBER_OF_GPUS> train.py
```
# Tips
- If running with a small batch size, lower the learning rate
- I did not have to adjust grad clip or weight_decay but YMMV
- Use enough data, I recommend > 1k samples
- I ran this for 3 epochs on 40k samples, will need to experiment more on epochs because the model was still improving.
- The better way to tell if your model is improving or just overfitting or even getting worse, you should add evaluation on your task. This is data that is not part of training. For example, on code completion you can evaluate your model on the mbpp validation set or a custom set you have.
- Use FSDP option: `backward_prefetch=BackwardPrefetch.BACKWARD_PRE` if you have the GPU memory, or `backward_prefetch=BackwardPrefetch.BACKWARD_POST`. This can cause OOM so it was set to None

__AtYou__
- 粉丝: 3518
- 资源: 2176
最新资源
- COMSOL单相变压器温度场三维模型:获取热点温度与流体流速分布.pdf
- COMSOL单轴压缩裂纹发展二维模型:利用弹性模量变化相图确定裂纹开裂位置.pdf
- COMSOL动网格流固耦合仿真.pdf
- COMSOL动网格与捕风机.pdf
- COMSOL动态采空区三带模拟与动网格应用.pdf
- Comsol冻土THM三场耦合模型案例:水分场、温度场与应力场的瞬态与稳态求解.pdf
- comsol冻土房屋水热力三场耦合模型:现成案例.pdf
- COMSOL冻土降雨水热力耦合:内有源文件与参考文献.pdf
- 78-0607拉格朗日乘子法1:极值点目标与约束相切-1080P 高清-AVC.mp4
- Comsol冻土路基水热力源文件:基于COMSOL软件的水热耦合计算控制方程.pdf
- COMSOL冻土路基水热力多场耦合模型.pdf
- COMSOL冻土流热耦合与PDE方程耦合:采用孔隙比模拟土柱多物理场.pdf
- 80-0609拉3:有限制条件的极值问题转化为求解等式方程问题-1080P 高清-AVC.mp4
- COMSOL冻土路基水热耦合.pdf
- COMSOL冻土路基水热耦合变形模拟.pdf
- COMSOL冻土热-水-力耦合模型.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


