Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial support of Apple M1/M2 (via CPU mode) #504

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

b0noI
Copy link

@b0noI b0noI commented Jul 22, 2023

example of the run:

(base) ➜  llama git:(main) ✗ torchrun --nproc_per_node 1 example_text_completion.py \
    --ckpt_dir llama-2-7b/ \
    --tokenizer_path tokenizer.model \
    --max_seq_len 128 --max_batch_size 4
[2023-07-22 13:50:01,081] torch.distributed.elastic.multiprocessing.redirects: [WARNING] NOTE: Redirects are currently not supported in Windows or MacOs.
> initializing model parallel with size 1
> initializing ddp with size 1
> initializing pipeline with size 1
Loaded in 13.06 seconds
I believe the meaning of life is
> to be happy. I think that if you are happy you will be a good person. I believe that if you are a good person, you will be happy. I believe that if you are happy, you will be a good person. I believe that if you are a good person, you will be happy. I

==================================

Simply put, the theory of relativity states that
> 1) all laws of physics are the same for all observers, and 2) the speed of light in a vacuum is the same for all observers.
1) All laws of physics are the same for all observers
The theory of relativity says that the laws of physics are the same

==================================

A brief message congratulating the team on the launch:

        Hi everyone,

        I just
>
        <a href="#" class="btn btn-success" target="_blank">launched</a>
        my project <a href="#" class="btn btn-success" target="_blank">@<strong>${project.name}</strong></a>
        on <a href

==================================

Translate English to French:

        sea otter => loutre de mer
        peppermint => menthe poivrée
        plush girafe => girafe peluche
        cheese =>
> fromage
        spaghetti => spaghetti
        shampoo => shampoing
        tire => pneu
        candy => bonbon
        pizza => pizza
        car => voiture
        dog => chien
        cat => chat
        orange

==================================

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 22, 2023
@goswamig
Copy link

+1

@@ -265,7 +273,7 @@ def chat_completion(
f"{B_INST} {(dialog[-1]['content']).strip()} {E_INST}",
bos=True,
eos=False,
)
).to(default_device())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttributeError on this line: 'list' object has no attribute 'to'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, resolved,

somehow this was only impacting example_chat_completion.py only so I missed it

however for example_chat_completion.py there are assertions that are failing, does not look like it has anything to do with my changes. I can make it work but this will require:

  • removing assert
  • explicitly adjust tensor shape casting

neither of these changes should be committed (but I still can if needed)

@msaroufim msaroufim added the needs-discussion If an issue fix has complexity and tradeoffs which requires further discussion. label Sep 1, 2023
@msaroufim
Copy link

msaroufim commented Sep 1, 2023

This is pretty cool, we should look to land this once it supports mps - cc @malfet who has been looking a lot at llm inference on M1

@msaroufim msaroufim added the new-backend Running on other platforms and hardware label Sep 1, 2023
@subramen subramen mentioned this pull request Sep 11, 2023
@franciscoabenza
Copy link

What is the expected performance (~ tokens per second) for the weakest option: Macbook Air 2020 8GB? It would be nice if there was a table with the different hardware and model sizes.

return True


def distrubuted_device():
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo, I recommend to refactor it

Suggested change
def distrubuted_device():
def distributed_device():

here
and here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. needs-discussion If an issue fix has complexity and tradeoffs which requires further discussion. new-backend Running on other platforms and hardware
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants