Skip to content

add a setup ilab script for macos#2419

Merged
mergify[bot] merged 1 commit intoinstructlab:mainfrom
reidliu41:add-setup-script-for-macos
Dec 17, 2024
Merged

add a setup ilab script for macos#2419
mergify[bot] merged 1 commit intoinstructlab:mainfrom
reidliu41:add-setup-script-for-macos

Conversation

@reidliu41
Copy link
Copy Markdown
Contributor

@reidliu41 reidliu41 commented Oct 9, 2024

Due to macOS is one of the more popular user bases, and deployment instructions(warnings, notes) can become increasingly detailed, so providing a setup script will help users get started quickly.

$ curl -s http://test-test-test.com/files/ilab-macos-installer.sh |bash

or  curl -s http://test-test-test.com/files/ilab-macos-installer.sh |bash -s -- /Users/test-user/test-test

==============================================
    Starting InstructLab installation script
==============================================

Checking for supported Python version and CPU brand:
    Detected Python version: 3.11.11
    Using Python binary: python3.11
    Detected CPU brand: Apple M3 Pro
    Detected architecture: arm64

Creating installation directory:
    /Users/test-user/instructlab

Creating virtual environment:
    /Users/test-user/instructlab/venv

Apple Silicon Mac detected. Start checking the environment setup...
    Python binary supports arm64 architecture.
    System environment is correctly configured for Apple Silicon.

Installing InstructLab with Metal support...
Files removed: 1
Collecting instructlab
...
InstructLab installed with Apple Metal support.

Creating symbolic link...
    Created soft link: /usr/local/bin/ilab -> /Users/test-user/instructlab/venv/bin/ilab

Running 'ilab --help' to check the installation...
Usage: ilab [OPTIONS] COMMAND [ARGS]...

  CLI for interacting with InstructLab.

  If this is your first time running ilab, it's best to start with `ilab
  config init` to create the environment.

Options:
  --config PATH  Path to a configuration file.  [default:
                 /Users/test-user/.config/instructlab/config.yaml]
  -v, --verbose  Enable debug logging (repeat for even more verbosity)
  --version      Show the version and exit.
  --help         Show this message and exit.

Commands:
  config    Command Group for Interacting with the Config of InstructLab.
  data      Command Group for Interacting with the Data generated by...
  model     Command Group for Interacting with the Models in InstructLab.
  system    Command group for all system-related command calls
  taxonomy  Command Group for Interacting with the Taxonomy of InstructLab.

Aliases:
  chat      model chat
  generate  data generate
  serve     model serve
  train     model train

============================================================
    InstructLab installation completed successfully.

Next step:
    Run 'ilab config init' to initialize your configuration.
============================================================

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the
    conventional commits.
  • Changelog updated with breaking and/or notable changes for the next minor release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Functional tests have been added, if necessary.
  • E2E Workflow tests have been added, if necessary.

@mergify mergify bot added documentation Improvements or additions to documentation ci-failure PR has at least one CI failure and removed ci-failure PR has at least one CI failure labels Oct 9, 2024
@reidliu41 reidliu41 force-pushed the add-setup-script-for-macos branch 2 times, most recently from d06ebcf to 20dc583 Compare October 9, 2024 03:40
@reidliu41
Copy link
Copy Markdown
Contributor Author

hi, please someone help to take a look

@nathan-weinberg nathan-weinberg requested a review from a team October 16, 2024 14:27
Copy link
Copy Markdown
Contributor

@cdoern cdoern left a comment

Choose a reason for hiding this comment

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

can you add some tests which run this? This is great! just a few comments on what we do/do not support


# Clean llama_cpp_python cache and install with MPS support
pip cache remove llama_cpp_python
pip install 'instructlab[mps]'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if this target is actively maintained, but it should be if it isn't

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

again, I don't think [mps] is the right target, this tends to install an older ilab version. This should probably just be pip install 'instructlab'

# Intel Mac
echo "Intel Mac detected. Installing InstructLab with Intel CPU..."
CMAKE_ARGS="-DLLAMA_METAL=off" pip install instructlab
echo "InstructLab installed with Intel CPU support."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we don't technically support Intel Mac, so I am wary to put this into our codebase

@reidliu41 reidliu41 force-pushed the add-setup-script-for-macos branch from 20dc583 to 39d9d5c Compare October 20, 2024 01:31
@mergify mergify bot added testing Relates to testing ci-failure PR has at least one CI failure and removed ci-failure PR has at least one CI failure labels Oct 20, 2024
@reidliu41 reidliu41 force-pushed the add-setup-script-for-macos branch from 84db2c0 to d9ff33d Compare October 20, 2024 01:35
@reidliu41 reidliu41 requested a review from cdoern October 23, 2024 07:09
@reidliu41
Copy link
Copy Markdown
Contributor Author

reidliu41 commented Oct 23, 2024

someone else help to take a look? +2

Copy link
Copy Markdown
Contributor

@cdoern cdoern left a comment

Choose a reason for hiding this comment

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

tests look nice, but the build target still is pointing to MPS! Please take a look at those targets and correct me if I am wrong but I think that one is out of date


# Clean llama_cpp_python cache and install with MPS support
pip cache remove llama_cpp_python
pip install 'instructlab[mps]'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

again, I don't think [mps] is the right target, this tends to install an older ilab version. This should probably just be pip install 'instructlab'

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Nov 9, 2024

This pull request has merge conflicts that must be resolved before it can be
merged. @reidliu41 please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase This Pull Request needs to be rebased label Nov 9, 2024
@reidliu41 reidliu41 force-pushed the add-setup-script-for-macos branch from d9ff33d to 1b0a95a Compare November 10, 2024 00:27
@mergify mergify bot added ci-failure PR has at least one CI failure and removed needs-rebase This Pull Request needs to be rebased labels Nov 10, 2024
@reidliu41 reidliu41 force-pushed the add-setup-script-for-macos branch from 1b0a95a to c4ad772 Compare November 10, 2024 10:21
@mergify mergify bot removed the ci-failure PR has at least one CI failure label Nov 10, 2024
@reidliu41 reidliu41 requested a review from cdoern November 10, 2024 13:04
@reidliu41 reidliu41 force-pushed the add-setup-script-for-macos branch from c4ad772 to 07071c2 Compare December 15, 2024 05:51
Signed-off-by: reid_liu <guliu@redhat.com>
@reidliu41 reidliu41 force-pushed the add-setup-script-for-macos branch from 7a454e8 to 4e9517e Compare December 15, 2024 06:02
@JustinXHale
Copy link
Copy Markdown

I think this is cool. I'm currently working on something in the same realm for MacOS, in the form of an intermode mode versus a script. I'm hoping to share within the coming weeks

@cdoern
Copy link
Copy Markdown
Contributor

cdoern commented Dec 17, 2024

I think this can exist with an interactive mode, they serve kind of different use cases.

Copy link
Copy Markdown
Contributor

@cdoern cdoern left a comment

Choose a reason for hiding this comment

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

lgtm. @nathan-weinberg PTAL

@mergify mergify bot added the one-approval PR has one approval from a maintainer label Dec 17, 2024
@mergify mergify bot merged commit c4a10b1 into instructlab:main Dec 17, 2024
@mergify mergify bot removed the one-approval PR has one approval from a maintainer label Dec 17, 2024
OS_TYPE=$(uname)
OS_ARCH=$(uname -m)
CPU_BRAND=$(sysctl -n machdep.cpu.brand_string)
LINK_TARGET_DIR="/usr/local/bin"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It gives me an error when I launch it, do I need to run it with sudo?

Error: No write permission to /usr/local/bin.
Run the script with sudo or choose another directory.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for you try. I think you may need to use sudo for the soft link.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

weird, only show two lines? Should be three

        echo -e "\nError: No write permission to $LINK_TARGET_DIR."
        echo "Run the script with sudo or choose another directory."
        echo -e "Alternatively, you can use sudo create the symlink manually for $INSTALL_DIR/venv/bin/ilab"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Of course I can use sudo, as you say, but when I run the full unit test suite with tox -e py3-unit it also runs this test which fails for the same reason. Maybe we can remove it from the pytest suite? (easiest way is to rename it to something like macos_install.py)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you so much for feedback. But based on the previous discussion, the test is needed for the script.
I try to fix with the venv whole path(will not exit) to run the next steps if no permission, make sure it can finish to the end. I also tried simply use sudo with curl command, seems will totally change the dir permission, that's not good to the current user.
can you try below?
2827

@mairin
Copy link
Copy Markdown
Contributor

mairin commented Dec 18, 2024

Is there a reason why we wouldn't just run ilab config init as part of the script instead of having the user run it manually?

@reidliu41
Copy link
Copy Markdown
Contributor Author

Is there a reason why we wouldn't just run ilab config init as part of the script instead of having the user run it manually?

When users first interact with it, it's important to let them know what they are configuring, what settings are being applied, and the paths where configurations are stored. Providing this information helps users understand the setup process and be aware of what changes have been made.

Some configurations allow users to customize their settings rather than sticking with the default ones.

However, the --non-interactive option can still be used to quickly set up the configuration file without requiring user interaction if you want a more automated setup.

mergify bot added a commit that referenced this pull request Dec 20, 2024
Some users might need `sudo` to set the soft link, so it will fail after install. To make it fluently, it will use `the whole path` to run the next steps.
#2419 (comment)

**Checklist:**

- [ ] **Commit Message Formatting**: Commit titles and messages follow guidelines in the
  [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).
- [ ] [Changelog](https://github.com/instructlab/instructlab/blob/main/CHANGELOG.md) updated with breaking and/or notable changes for the next minor release.
- [ ] Documentation has been updated, if necessary.
- [ ] Unit tests have been added, if necessary.
- [ ] Functional tests have been added, if necessary.
- [ ] E2E Workflow tests have been added, if necessary.



Approved-by: nathan-weinberg

Approved-by: jaideepr97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation testing Relates to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants