Git Product home page Git Product logo

Comments (18)

lostmygithubaccount avatar lostmygithubaccount commented on September 22, 2024 2

I still saw similar w/ llama.cpp recently -- planning to test Mixtral (base and instruct) on both more in the next couple weeks, will report on any relevant findings

relevant PR with a lot of insights: ggerganov/llama.cpp#4406

from mlx-examples.

justinh-rahb avatar justinh-rahb commented on September 22, 2024

Mixtral is known to be very sensitive to the prompting format. You MUST use this:

" [INST] {prompt} [/INST] "

Note the whitespace before and after the [INST] and [/INST] tags, this is intentional.

from mlx-examples.

samikama avatar samikama commented on September 22, 2024

Thanks.
May be default prompt should be updated then. The current default is

parser.add_argument(
        "--prompt",
        help="The message to be processed by the model",
        default="In the beginning the Universe was created.",
    )

That is the reason I passed that argument.

from mlx-examples.

samikama avatar samikama commented on September 22, 2024

Well, I tried 2 more versions based on your suggestions,
python mixtral.py --model_path ../../mixtral/ -m 2000 --prompt " [INST] keep continuing the following story. In the beginning the Universe was created. [/INST] " and
python mixtral.py --model_path ../../mixtral/ -m 2000 --prompt " [INST] {keep continuing the following story. In the beginning the Universe was created.} [/INST] "
Both are similar outcomes

python mixtral.py --model_path ../../mixtral/ -m 2000 --prompt " [INST] {keep continuing the following story. In the beginning the Universe was created.} [/INST] "
[INFO] Loading model from disk.
[INFO] Starting generation...
 [INST] {keep continuing the following story. In the beginning the Universe was created.} [/INST]  [INST] {
For a long time I have wanted to create a detailed, scientific model of the Universe, that would be based on very few assumptions, but that would also explain all known astronomical parameters and observations in as much detail as possible. } [/INST]  <hr>Quote: Savan: I rushed home after work yesterday with the threat of vacation hanging over me, and wrote up a nice description of the background and purpose of the model. But when it came time to save, it crapped out all over my shoes. All I have managed to keep on record is a very short and incomplete description of the background, purpose, and details of the model. Below is all I have managed to save, and I am not sure how much of this is actually useful. What I would actually like to present is the piece of writing that I finished yesterday, but all my attempts to save it have failed. My computer crashed on me during an import procedure involved with an attempt to save the document to my computer's hard drive:
Quote: I have to import a Peek 7.0 Preference file before I try to save the "Crosstalk" thing again next time. Please wait while I finish this import procedure. I wonder what the Peek 7.0 Preference file looks like. I have to import a Peek 7.0 Preference file in order to save the "Crosstalk" thing again next time. Please wait while I finish this import procedure. I wonder what the Peek 7.0 Preference file looks like. I want it! I want it! It wants me! It wants me! I hate it! I hate it! It hates me! It hates me! It conflicts with me! It conflicts with me! There is insufficient system memory to perform this import procedure. There is a system disk error that is causing this import procedure to fail. The disk that was attached to this computer's floppy disk drive interfaced disk controller read interface has timed out because it cannot read any data from the disk quickly enough (because the disk access speeds are too slow) in order to satisfy the minimum manufacturer's specified recommended optimal mandatory minimum safe minimum practical realistically acceptable minimum effective minimum dimensionally satisfactory dimensionally appropriate realistically acceptable nominal minimum effective dimensionally satisfactory dimensionally appropriate realistically acceptable nominal minimum volumes amounts quantities numbers at positions latitudes longitudes altitudes curtain heights during curtain hours particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly peculiarly particularly pecularly peculiarly particularly peculiar particular peculiarly peculiarly particularly peculiarly peculiarly peculiarly peculiarly peculiarly peculiarly peculiarly peculiarily peculiarily peculiarly peculiariest peculiarly peculiaryest peculiarly peculiaryest peculiarly peculiarly peculiaryest peculiarly peculiarly peculiaryest peculiarly peculiaryest peculiarly peculiaryest peculiarly peculiaryest peculiarly peculiaryest peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiary est peculiariest partially particularly peculiary peculiary peculiary peculiary particularly particularly particularly particularly particularly particularly particularly particularly particularly particularly peculiary peculiary peculiary peculiary peculiary peculiary peculiary peculiary peculiary peculiary peculiary peculiary peculiary peculiary peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest pecul peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest peculiariest pecul_

_: 7/30/03:_: 7/31/03:_: 7/1/03: 4 1/2 2/3 1/4 2/10 3/12 1/5 2/14 9/5 3/10 1/3 8/5 14/6 3/12 27/6 13/11 16/3 18/4 126/43 1/3 2/3 1/2 1/3 1/4 1/6 2/9 1/9 2/11 3/13 4/13 1/26 1/26 1/26 1/26 1/26 1/26 1/14 1/21 1/21 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/21 1/21 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/42 1/6 6/6 4/2 12/2 6/3 4/5 5/2 2/3 3/5 4/11 7/12 1/2 5/4 10/4 15/2 25/2 40/3 72/6 127/2 271/3 211/21 12496/6185 31583

from mlx-examples.

awni avatar awni commented on September 22, 2024

Are you using the Instruct version or the regular version? For the regular model you shouldn't need such a specific prompt format. Actually it looks like using a --temp=0.0 gives better results with that model. The temperature might need to be tuned or we may need to have a different sampling method. It is also possible there is a bug in the generation. Let me know if you have any luck tuning the temp, I will start hunting for bugs.

from mlx-examples.

justinh-rahb avatar justinh-rahb commented on September 22, 2024

@samikama Remove the { } brackets, I copied that from Ollama's modelfile for Mixtral and it's an artifact of the templating system. My experience is only with the instruct-tuned version, I have not been using the base version. I've also found lower temperature to produce better results in the instruct model @awni

from mlx-examples.

samikama avatar samikama commented on September 22, 2024

@justinh-rahb Thanks, As I mentioned I tried both. I tried without braces first actually. I just pasted last attempt to keep the message smaller. Both are similarly non-sensical

@awni Thanks for the response. I followed the instructions on the ReadMe file. Merged model file md5 hash matches the one in the documentation. I can't tune the temp right now since it looks like a recent change broke the mixtral.

python mixtral.py --model_path ../../mixtral/ -m 2000 --prompt " [INST] {keep continuing the following story. In the beginning the Universe was created.} [/INST] "
[INFO] Loading model from disk.
Traceback (most recent call last):
  File "/Users/sami/C-Gen/Experiments/mlx-examples/mixtral/mixtral.py", line 289, in <module>
    model, tokenizer = load_model(args.model_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sami/C-Gen/Experiments/mlx-examples/mixtral/mixtral.py", line 233, in load_model
    weights = tree_unflatten(list(weights.items()))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sami/C-Gen/Experiments/MLX/lib/python3.12/site-packages/mlx/utils.py", line 115, in tree_unflatten
    int(tree[0][0].split(".", maxsplit=1)[0])
        ~~~~^^^
IndexError: list index out of range
$ git log --oneline
a3ecda2 (HEAD -> main, origin/main, origin/HEAD) Merge pull request #107 from ml-explore/hf_mixtral
b863e7c (origin/hf_mixtral) format

from mlx-examples.

justinh-rahb avatar justinh-rahb commented on September 22, 2024

I know the llama.cpp folks spent a few days playing with things before they got results they considered to be bug-free enough to merge the feature into main, so it's possible there's issues with the inference code here. Should also be noted that significant differences with outputs were noted between running in CPU vs GPU-accelerated mode in earlier commits to the branch. This is a novel architecture, some learning is to be expected :)

from mlx-examples.

awni avatar awni commented on September 22, 2024

I pushed a fix + minor changes to #112 and will merge soon.

The outputs are much better for me now. Let me know how they look for you if you have a chance to test it.

from mlx-examples.

awni avatar awni commented on September 22, 2024

Comment here if you are still seeing issues after updating the example and I will reopen.

from mlx-examples.

samikama avatar samikama commented on September 22, 2024

Thanks. I fetched the updates to repo, downloaded the new base model in README but it looks like it did not change much. First few tokens seems reasonable but it fails shortly after. Even with the default prompt

python mixtral.py --model_path ../../mixtral-8x7B-v0.1/ -m 500
[INFO] Loading model from disk.
[INFO] Starting generation...
In the beginning the Universe was created. This has made a lot of people very angry and been widely

regarded as a bad move.

Douglus Adams

The Hitchhiker’s Guide to the Universe

The Universe is a very big place. It is so big that it is hard to comprehend. It is so big that it is hard to comprehend how big it is.

The Universe is so big that it is hard to comprehend how big it is.

The Universe is so big that it is hard to comprehend how big it is.

The Universe is so big that it is hard to comprehend how big it is.

The Universe is so big that it is hard to comprehend how big it is.

The Universe is^CTraceback (most recent call last):
  File "/Users/sami/C-Gen/Experiments/mlx-examples/mixtral/mixtra....

from mlx-examples.

lostmygithubaccount avatar lostmygithubaccount commented on September 22, 2024

I believe you need to change how you're prompting it, see ggerganov/llama.cpp#4406 (comment) and other pointers in that thread (and the instructions in the huggingface repo) -- reportedly temperature=0 also helps

perhaps the default example prompt should also be updated?

from mlx-examples.

awni avatar awni commented on September 22, 2024

The default temp is now 0.0. @samikama interesting. I get similar results to you with the default prompt. When I try the prompt you originally provided though it looks pretty nice:

python mixtral.py --model_path ~/models/Mixtral-8x7B-v0.1 -m 200 --prompt "keep continuing the following story. In the beginning the Universe was created." --temp 0.0 
keep continuing the following story. In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move.

Douglas Adams

The Hitchhiker’s Guide to the Galaxy

The Hitchhiker’s Guide to the Galaxy is a comedy science fiction series created by Douglas Adams. Originally a radio comedy broadcast on BBC Radio 4 in 1978, it was later adapted to other formats, including stage shows, novels, comic books, a 1981 TV series, a 1984 computer game, and 2005 feature film.

The series follows the adventures of hapless Englishman Arthur Dent, who is rescued from Earth moments before it is destroyed to make way for a hyperspace bypass. He travels through the galaxy with his friend Ford Prefect, a human-like alien (and researcher for the eponymous guidebook) who was stranded on Earth five

Hence why I say it seems to be working much better...

from mlx-examples.

samikama avatar samikama commented on September 22, 2024

It is weird. For me

python mixtral.py --model_path ../../mixtral-8x7B-v0.1 -m 200 --prompt "keep continuing the following story. In the beginning the Universe was created." --temp 0.0
[INFO] Loading model from disk.
[INFO] Starting generation...
keep continuing the following story. In the beginning the Universe was created. This has made a lot of people very angry and been widely

regarded as a bad move.

Doug Adams

The Universe is a big place, perhaps the biggest.

Carl Sagan

The Universe is a big place, perhaps the biggest.

Carl Sagan

The Universe is a big place, perhaps the biggest.

Carl Sagan

I am using python 3.12 and consequently PT nightly since there is no py-3.12 builds for Mac for release versions. Perhaps nightly is buggy.

from mlx-examples.

awni avatar awni commented on September 22, 2024

Python version shouldn’t matter… maybe try updating mlx:

‘pip install -U mlx’

from mlx-examples.

samikama avatar samikama commented on September 22, 2024

According to pip, it is most recent version (0.0.5) I just updated the torch to 20231215. Didn't change anything.

from mlx-examples.

awni avatar awni commented on September 22, 2024

Hmm we should be getting the same results with a temperature of 0.0. Could you verify you are using the latest mlx-examples? The file mixtral/mixtral.py should have the custom RoPE class in it like this.

from mlx-examples.

samikama avatar samikama commented on September 22, 2024

Yes it is the same. I am at main, commit 08e862336ade809bc37d1

from mlx-examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.