-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
dvc exp run unavailable in CML #7547
Comments
I think this is an upstream bug - #7531. What error are you getting? Are you using Or are you using the CML Docker images? |
Sorry I don't quite follow. How do commits hide results? CML is intended for provisioning & reporting experiments. |
When I say experiments I refer to using In my specific case I wanted to try the following: name: experiments
on: [push]
jobs:
train-model:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: iterative/setup-cml@v1
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Train model
env:
repo_token: ${{ secrets.GITHUB_TOKEN }}
run: |
pip3 install -r requirements.txt
#bash exp_file.sh
dvc exp run -S train.C=0.005
dvc exp run -S train.C=100
echo "## Resultados del Experimento" >> report.md
dvc exp show --only-changed --drop 'assets|src' --no-pager --md >> report.md
echo "## Parallel Plot\n" >> report.md
dvc exp show --only-changed --drop 'assets|src' --pcp --sort-by test_recall >> report.md
cml send-comment report.md In this particular case I wanted to report the results of 2 experiments with dvc exp run --queue -S train.C=5
dvc exp run --queue -S train.C=30
dvc exp run --queue -S train.C=60
dvc exp run --queue -S train.C=120
dvc exp run --run-all All of the experiments resulted in something like: So my question would be: Is it allowed to run something like what I'm proposing? I can't remember when I read that Experimentation was meant to be done locally and only Thanks in advance, Alfonso |
My brain has stopped working for the day already, but I don't think there isn't any reason you shouldn't be able to do this. Without having tested anything like this I would blindly expand your checkout step to see if that fixes it: - uses: actions/checkout@v3
with:
fetch-depth: 0 https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches |
(Transferred to DVC because it looks like a config/setup issue unrelated to CML) |
@dacbd's suggestion should be correct, github's checkout action only fetches a single shallow commit by default, this isn't enough of the Git repo for |
@pmrowla Why does |
I understand you say Anyways, I'll be testing this small change during the day and I'll get back to you... Alfonso |
The issue is that we use Basically, doing the merge-base requires finding a common ancestor for the commits being merged (that is not any of the merge commits themselves). For our purposes w/DVC experiments, this means that a fetch depth of 2 will usually be sufficient (so baseline commit + 1 parent), but that won't be the case 100% of the time. So if users are trying to use |
Thanks @pmrowla. I guess even if we tried to minimize operations where merge is needed, it will still be needed sometimes, and it's probably better to document the proposed workaround above. Opened iterative/dvc.org#3416. |
Ah right so the CML solution would be |
If we go with the suggestion in iterative/dvc.org#3416 (comment), we should keep this open to update the message in DVC to be more informative and helpful. Even if DVC can't tell whether it's in a CI context, it could at least suggest to fetch missing commits and maybe link to docs that could go into more depth about specific use cases like cml. |
On the UI side, we could detect the presence of |
If we get the invalid commit exception we can just do the extra check to see whether or not we are in a shallow repo (you just have to check whether or not |
Right, I guess the question is whether the message should be general like "don't use a shallow clone" or more CI-specific like "try fetch-depth: 0"? I think probably the former is better even if we can detect CI, since we don't want to have to cover the syntax of different git server behaviors, although we could link to docs where that level of detail could be provided. |
+1 for a general message w/ link to docs for more specific details/solutions. |
I'd prefer general message with a CI specific hint and link to the docs wherever possible. I'd prefer less redirection as much as possible. Example:
|
Dear all, I implemented the steps mentioned above and it worked partially. Once I run the experiments it turns out git is not recognized in the Github Machine: In order to solve this issue I found a really nice action here: The final workflow will be like this: name: experiments
on: [push]
jobs:
train-model:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: fregante/setup-git-user@v1
- uses: iterative/setup-cml@v1
- uses: iterative/setup-dvc@v1
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Experiment
env:
repo_token: ${{ secrets.GITHUB_TOKEN }}
run: |
pip3 install -r requirements.txt
#bash exp_file.sh
dvc exp run -S train.C=0.005
dvc exp run -S train.C=100
echo "## Resultados del Experimento" >> report.md
dvc exp show --only-changed --drop 'assets|src' --no-pager --md >> report.md
cml send-comment report.md I think this could be mentioned as a user-case in the documentation because is a very common experimentation workflow, and if we can externalize experimentation to a Github machine or a Cloud Runner would be very good. On another note, I noticed Thanks and hope this helps DVC, Alfonso |
@datacubeR, thanks for the feedback; since you are already using
This is part of what |
Bumping the priority of this since it is necessary for integration with cml.
Is this sufficiently general? It's only applicable to GH actions AFAIK. Each git server has its own depth settings and variables, not to mention people who manually do shallow clones.
Also, this is probably a better suggestion, but only if cml is installed. So maybe we can generalize the message and provide specific examples like |
If you allow me to chime in, from the user perspective I think use cases are way clearer than just random notes. For instance, I understand these fixes are only applicable to GitHub Actions, but in my opinion there is no clear documentation on CML CI which I think won't be normally installed since docker containers or virtual machines are normally the most common way to deal with this part. |
Should note that |
Keeping this open on the DVC side until we address clarifying the shallow repo error in DVC UI and/or docs |
Yup probably just adding " |
@pmrowla It makes sense as part of making the workspace and temp implementations more consistent, but is there any way to make at least workspace runs succeed in this scenario? It breaks a previously supported workflow for anyone using CML or other CI actions with
Is a merge necessary to run an experiment? I thought behavior for running experiments was similar to git stash apply, which works fine in this scenario. |
Prior to that change, workspace and temp implementations were essentially two completely different things, which made testing and maintaining both difficult, and led to them having different behavior in a lot of scenarios. I don't think it is worth the development effort required to maintain two separate
It works "similar to" stash apply, not exactly like |
Is there any way to run DVC exp run in CML?
My use case includes training several experiments in a Cloud or self hosted Server and publish in the PR the results of my work.
For now when trying to do this using the setup action I get an unexpected error.
I understand that commit hides experiment results and I read that CML is not intended for experimentation but that is not quite clear in official documentation.
The text was updated successfully, but these errors were encountered: