-
Notifications
You must be signed in to change notification settings - Fork 448
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
New repo layout based on RFC #70
Conversation
What are |
In the RFC the folders are all under |
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'm still a fan of keeping the directory and import name as torchtune
, and doing imports such as torchtune.llm
and etc. If users feel strongly about the shorthand, they can simply import torchtune as tune
.
It also looks like not everything is under the tune
directory so some imports will be like from torchtune import blah
and others will be like from torchtune.tune import blah
and users will be quite confused.
This also follows other domain libraries as a convention - i.e. torchaudio and torchrec.
As @joecummings mentioned, the blocks
directory is also something I'm not sure about - we should group things into general subdirectories where things make sense of course, but datasets, models, trainer, and utils are only loosely related and can probably all live under torchtune
.
also, we should consider whether we really need the trainer
subdirectory. It might imply to users that it's a full-service trainer offering which we're not planning on building, and (2) is currently not used.
Thanks!
I can concede on the tune vs torchtune point though I prefer when packages have shorter import names. Also your right that it should match the other domain library pattern.
This goal was that everything from the library would be under tune (or torchtune) and the other code that users would use from the rep goes in the top level directory so you'd never import it. I can move the utils folder into the tune (torchtune) folder if it's expected to be available from the pip package.
I'm not sold on the name blocks, so I'm open to suggestions, but the idea is that 'blocks' is the library within the library. It's all the building blocks that the recipes rely on. You can think that User 1 mostly uses the defaults folder, user 2 works with and modifies the recipes, and user three just uses the blocks that they need.
That's my fear with 'trainer' too. train_utils didn't seem like a great name for a folder though. But maybe something along that line is better. |
So one fundamental set of questions that I think will inform a lot of how we set things up:
Basically if we are packaging everything under torchtune (or tune as in this PR), then we should probably have CI set up there. But this includes recipes, which I'm not sure we want to run CI on (I think the previous suggestion was that we will have integration tests; while those are potentially amenable to CI I imagine we would want it decoupled from core components). For that reason I would suggest separate test directories for e.g. tune/blocks and tune/recipes. To weigh in on the usage of A couple other miscellaneous thoughts: Why the top-level utils directory? I assume these files will not be part of the package, but will they have any tests? Also maybe just personal preference but imo it feels janky to have a top-level directory called utils, maybe we can call it scripts or something instead. Also, what is up with examples/inference.py? The naming seems to imply that this is a recipe, but really this is just a parity check, right? I think the naming does not indicate that clearly, and idk why this couldn't go in e.g. tests/blocks/llama2/scripts/... |
@ebsmothers thanks for your helpful comments here. I will admit I'm not an expert on python packaging. The intent here is that the library provides a set of building blocks that we then user ourselves and provides to the user as building blocks. I was not aware of package entry points, given that, I think it would make sense for the current Two additional points to that though:
|
@pbontrager I agree on both (1) and (2). For (1) we just need to make a call on whether to couple recipe tests to component tests, sounds like you're saying we shouldn't (assuming I'm understanding correctly). I'm in agreement with this, in practice we could have e.g. a nightly job to run only recipe tests instead of one that runs on every PR like with the core library components. |
Based on the comments so far I made the following changes:
|
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.
synced up over VC and resolved the remaining questions. Looks great - please rebase on latest & test comprehensively before landing. thanks!
All the unit tests pass and finetune_llm.py was able to start and pull all imports correctly. |
New repo layout to match https://github.com/pytorch-labs/torchtune/pull/54/files?short_path=dda34b2#diff-dda34b2e50075ce560d9f896ac2834b74c9e851a94f35fdfec031da03efa22c3
As this is file structure changes and the only code changes are imports, it might be easier to evaluate by checking out the branch and viewing the folders