-
Notifications
You must be signed in to change notification settings - Fork 441
feat: Support creating a workspace with lab init
#1022
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
Conversation
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one minor suggestion inline.
I also wonder about the most desirable UX here. It seems kind of weird to do:
ilab init --workspace-path myworkspace
cd myworkspace
ilab download
ilab ...
A slight improvement would be to allow --workspace-path
to every command.
ilab init --workspace-path myworkspace
ilab download --workspace-path myworkspace
...
This next part could be a separate PR, because the implementation would apply to more than just this use case, but I want to call it out as it helps the UX further once the workspace option is available for all commands.
On top of that, it would be great if instead of only allowing the --workspace-path
option if it also supported an environment variable. More on that is in "Values from Environment variables" here https://click.palletsprojects.com/en/8.1.x/options/
Now we have ...
export ILAB_WORKSPACE_PATH=/path/to/workspace
ilab init
ilab download
ilab serve
What is super nice here is it no longer matters what directory you run ilab
from. Once you have a workspace set and you point to it in the env, you can use the ilab
commands anywhere.
I think that'd be a pretty nice UX.
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
src/instructlab/lab.py
Outdated
if workspace_path: | ||
if not exists(workspace_path): | ||
os.mkdir(workspace_path) | ||
os.chdir(workspace_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had another thought about the UX for a workspaces concept. I think the use of os.chdir()
results in some surprising behavior. Take this for example:
ilab init --taxonomy-path relative/path/to/taxonomy --workspace-path path/to/workspace
Any time I specify a relative path, I would expect it to be interpreted relative to the working directory where I'm running the command.
For my example, I would expect ilab
to take my relative path and write an absolute path into the config file in the workspace that points it to the right place. I think other surprises could happen when the tool is switching its working directory out by surprise.
In other words, while it's more code, I think less surprising behavior would be to not change working directories, but instead, do more careful handling of paths throughout using that workspace path value.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried a different route today, hopefully I didn't veer too far from what you described.
I assumed that it'd be cleaner to use a workspace
directory by default and that the config.yaml
and taxonomy
should go in there unless directed otherwise. To that end there's an added prompt during initialization that confirms the workspace directory. I sum up a few cases and where things would go unless directed otherwise during the prompts:
ilab init
config.yaml -> ./workspace
taxonomy -> ./workspace
ilab init --workspace-path path/to/workspace
config.yaml -> path/to/workspace
taxonomy -> ./workspace/taxonomy
ilab init --taxonomy-path relative/path/to/taxonomy --workspace-path path/to/workspace
config.yaml -> path/to/workspace
taxonomy -> relative/path/to/taxonomy
I had to update tests to check for the config.yaml
in the workspace
dir and the extra initializing prompt for the workspace directory, now there's something failing. I'll hold off on figuring out what's going wrong there until you have a look at this different implementation, in case I'm completely off the mark and redo it all anyway :)
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
@Mergifyio rebase |
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
✅ Branch has been successfully rebased |
34f1e66
to
caf224f
Compare
This pull request has merge conflicts that must be resolved before it can be |
just want to apologize for the long delay in coming back to this. I have been traveling the last 1.5 weeks or so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. One comment inline is that I think I'd prefer it disabled by default and to retain the current behavior.
I also wonder if we should try to incorporate this general idea into some work that @cdoern started in #990. He's looking to do an overhaul of the CLI command layout. It would be good to map out how this feature would work in his new design.
src/instructlab/config.py
Outdated
DEFAULT_API_KEY = "no_api_key" | ||
DEFAULT_CONFIG = "config.yaml" | ||
DEFAULT_MODEL = "merlinite-7b-lab-Q4_K_M" | ||
DEFAULT_MODEL_PATH = f"models/{DEFAULT_MODEL}.gguf" | ||
DEFAULT_TAXONOMY_REPO = "https://github.com/instructlab/taxonomy.git" | ||
DEFAULT_TAXONOMY_PATH = "taxonomy" | ||
DEFAULT_TAXONOMY_PATH = f"{DEFAULT_WORKSPACE_PATH}/taxonomy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer not to use the workspace feature by default. Most instructions tell people to do a similar thing manually, I believe.
my work in #990 intends to also create a centralized dir in ~/.config for the ilab config and convert to a .conf file type. I am unsure of how this would interact with this PR. However, I am totally open to taking whichever approach people are more comfortable with |
I think the ideas are complementary. The idea in this PR would be to configure a workspace directory so that it didn't matter what directory you were in to run I think it may be mostly a new config file option (and option to |
@rafvasq we have this as part of our 5/30 milestone, do you think it's something we could get done before then or should we push it out to later? |
@nathan-weinberg I'll be travelling until mid-next week but based on @russellb and @cdoern's comments, most of the work is done and I should be able to complete it as soon as I'm back. I'm pretty confident it can get into the 5/30 milestone! |
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
lab init
lab init
Apologies again for the delay ... The current implementation is a good start. I see that A starting point would be my original comment here: #1022 (review) To summarize - once a workspace is created and configured, I'd like to see everything done relative to that workspace instead of the current working directory. Otherwise, it feels incomplete and not enough of an improvement over |
This pull request has merge conflicts that must be resolved before it can be |
@leseb I've now created an issue instructlab/dev-docs#100 but sadly I don't have time to commit to seeing this work past what was originally scoped and done in this PR so far. |
Thanks for your effort on this and sorry for the delay. I think we should probably close this and wait for someone else to pick up. Do you mind? Thanks |
Changes
--workspace-path
to theinit
commandILAB_WORKSPACE_PATH
Which issue is resolved by this Pull Request:
Resolves #729
Description of your changes:
Allows for a user to pass a path to
ilab init
for config initialization in that given directory.