The commit is the right one as it’s pointing to the HEAD of v1.12.1. If you want to show the release version alone you might want to set the PYTORCH_VERSION environment variable.
(pytorch_compile_2) .../mypath/.../pytorch$ git branch
* (HEAD detached at v1.12.1)
main
(pytorch_compile_2) .../mypath/.../pytorch$ export PYTORCH_VERSION=v1.12.1
(pytorch_compile_2) .../mypath/.../pytorch$ python setup.py install
Building wheel torch-1.12.0a0+git664058f
-- Building version 1.12.0a0+git664058f
cmake --build . --target install --config Release
[0/1] Install the project...
-- Install configuration: "Release"
running install
...
...
How to set the PYTORCH_VERSION environment variable.
Even after setting it using export PYTORCH_VERSION=v1.12.1, the installation is not successful. When trying to install in the v1.12.1 folder, it shows Building wheel torch-1.12.0a0+git664058f.