unslothai / unsloth

Finetune Llama 3.2, Mistral, Phi, Qwen & Gemma LLMs 2-5x faster with 80% less memory
https://unsloth.ai
Apache License 2.0
18k stars 1.25k forks source link

The fine-tuning of the 2024.8 version has become very poor compared to the previous version. #882

Open githubzuoyi opened 3 months ago

githubzuoyi commented 3 months ago

Today I updated the unsloth version for the first time, using 2024.8, and found a strange phenomenon. The fine-tuning results using the 2024.4 version were very good, but the fine-tuning results using the 2024.8 version became very poor. After fine-tuning, the format was not even learned well. Has anyone encountered this problem?

dromeuf commented 3 months ago

we are the same problem ? https://github.com/unslothai/unsloth/issues/881

githubzuoyi commented 3 months ago

we are the same problem ? #881

I'm not sure yet, but I've been using unsloth fine-tuning for 2 months, and I have a distinct feeling that the fine-tuning results in the 2024.8 version are poor, and my colleagues have the same feeling

dromeuf commented 3 months ago

we are the same problem ? #881

I'm not sure yet, but I've been using unsloth fine-tuning for 2 months, and I have a distinct feeling that the fine-tuning results in the 2024.8 version are poor, and my colleagues have the same feeling

my ru use it : "Building wheels for collected packages: unsloth Building wheel for unsloth (pyproject.toml) ... done Created wheel for unsloth: filename=unsloth-2024.8-py3-none-any.whl size=136912 sha256=7c408cab17d207a06e6b22693fac30b498acecb062c06f2b023b28ee42014a27 Stored in directory: /tmp/pip-ephem-wheel-cache-u3imsks4/wheels/ed/d4/e9/76fb290ee3df0a5fc21ce5c2c788e29e9607a2353d8342fd0d Successfully built unsloth Installing collected packages: sentencepiece, xxhash, unsloth, shtab, requests, pyarrow, hf-transfer, fsspec, dill, multiprocess, tyro, transformers, datasets Attempting uninstall: sentencepiece Found existing installation: sentencepiece 0.1.99 Uninstalling sentencepiece-0.1.99: Successfully uninstalled sentencepiece-0.1.99 Attempting uninstall: requests Found existing installation: requests 2.31.0 Uninstalling requests-2.31.0: Successfully uninstalled requests-2.31.0 Attempting uninstall: pyarrow Found existing installation: pyarrow 14.0.2 Uninstalling pyarrow-14.0.2: Successfully uninstalled pyarrow-14.0.2 Attempting uninstall: fsspec Found existing installation: fsspec 2024.6.1 Uninstalling fsspec-2024.6.1: Successfully uninstalled fsspec-2024.6.1 Attempting uninstall: transformers Found existing installation: transformers 4.42.4 Uninstalling transformers-4.42.4: Successfully uninstalled transformers-4.42.4 "

danielhanchen commented 3 months ago

@githubzuoyi Apologies on the issue! Do you know which model you are finetuning? Is it Llama 3.1?

githubzuoyi commented 3 months ago

@githubzuoyi Apologies on the issue! Do you know which model you are finetuning? Is it Llama 3.1?

I am using the 2024.8 version to fine-tune the llama3 model, to be precise: llama-3-8b-Instruct-bnb-4bit. The phenomenon I encountered is that we use the company's data set for fine-tuning, the script and the data set have not changed, only The version of unsloth has been upgraded, but there is an obvious gap in the results. One obvious phenomenon is that in the fine-tuning of the previous version, the format learning was very accurate, but the format of the latest version does not seem to be well learned.

githubzuoyi commented 3 months ago

Today I updated the unsloth version for the first time, using 2024.8, and found a strange phenomenon. The fine-tuning results using the 2024.4 version were very good, but the fine-tuning results using the 2024.8 version became very poor. After fine-tuning, the format was not even learned well. Has anyone encountered this problem?

I want to try the previous version of unsloth, such as 2024.4/6, but I can’t seem to find a way to roll back the version. pip install unsloth cannot find the previous version.

danielhanchen commented 3 months ago

@githubzuoyi You could try a May 4th version which included some Llama-3 fixes. The commit is a93a885c286934c9c7467324054ca3f9d526a2bd

Or an April 21st one which solved some more Llama-3 issues: ce523ed15cf56a6cd05fa4646153e7688ec44c8a

The first ever Llama-3 one is April 18-19th: bd88b011ada9d00847ef6bf4f6700f2b5f6d4203

To install a commit version, try: !pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git@a93a885c286934c9c7467324054ca3f9d526a2bd"

If you're able to test an old version out (I can also help fix some bugs in that old issue if it doesn't install well), would you be able to share the training loss curves for the new version and the old version - that would be extremely helpful if that's possible :) You can DM me on Discord, or email me as well or Linkedin msg me!

Extremely apologies on the issue, and hopefully we can get to the bottom of this!

githubzuoyi commented 3 months ago

@githubzuoyi You could try a May 4th version which included some Llama-3 fixes. The commit is a93a885c286934c9c7467324054ca3f9d526a2bd

Or an April 21st one which solved some more Llama-3 issues: ce523ed15cf56a6cd05fa4646153e7688ec44c8a

The first ever Llama-3 one is April 18-19th: bd88b011ada9d00847ef6bf4f6700f2b5f6d4203

To install a commit version, try: !pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git@a93a885c286934c9c7467324054ca3f9d526a2bd"

If you're able to test an old version out (I can also help fix some bugs in that old issue if it doesn't install well), would you be able to share the training loss curves for the new version and the old version - that would be extremely helpful if that's possible :) You can DM me on Discord, or email me as well or Linkedin msg me!

Extremely apologies on the issue, and hopefully we can get to the bottom of this!

Thanks Daniel, I have sent you a DM on discord and attached a screenshot of the loss. Thank you for taking the time to help analyze it.

githubzuoyi commented 3 months ago

Thank you very much! I used the old version !pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git@a93a885c286934c9c7467324054ca3f9d526a2bd" and downgraded the transformers version to '4.39.0', the finetune result of 'Llama3 8B' is normal.

tristan279 commented 3 months ago

Hi @githubzuoyi also interested in this issue, tried installing unsloth with that commit but getting the "TypeError: LlamaRotaryEmbedding.init() got an unexpected keyword argument 'config' " error again, how did you fix it?

githubzuoyi commented 3 months ago

Hi @githubzuoyi also interested in this issue, tried installing unsloth with that commit but getting the "TypeError: LlamaRotaryEmbedding.init() got an unexpected keyword argument 'config' " error again, how did you fix it?

I didn't get this error, you can try downgrading the transformers version to '4.39.0' and try installing the old unsloth again. But I suggest you can use the latest version of llama3.1 for fine-tuning, which is better

danielhanchen commented 3 months ago

@githubzuoyi Do you know what the differences were?