Model move from python to ios missing lapack

Matt_Davis: <p>Ok, I have a model that I am trying to move to ios.</p>
<p>I figured out most of the jit export commands. After running the model on mobile it is saying missing the lapack. I read a few others forums on here that you have to build with la pack. My question is do I build the local pytorch doing the training and export or do I rebuild the libtorch for ios?</p>
<p>I think I need to rebuild torch, load up my models and jit save them there after. Is that the correct flow?</p>

kimishpatel: <p>I think you need to rebuild libtorch for ios with LAPACK. <a class="mention" href="/u/xta0">@xta0</a> if he has more input.</p>

Matt_Davis: <p>Ok thanks. I was following you other tutorial from this thread on mobile: <a href="https://discuss.pytorch.org/t/lapack-library-not-found-in-compilation-pytorch-mobile-android-java/126849/10" class="inline-onebox">LAPACK library not found in compilation (Pytorch Mobile, Android, Java) - #10 by Paran0</a><br>
you noted the changed on torch for the libtorch solution I think?<br>
I’ll try followinrg the <a href="https://pytorch.org/mobile/ios/#build-pytorch-ios-libraries-from-source" class="inline-onebox" rel="noopener nofollow ugc">iOS | PyTorch</a></p>
<p>This turned moving a model from a few hour task to days to weeks, would love this included <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=10" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>

kimishpatel: <p>Yeah I had forgotten about what I wrote on that thread :). But it sounds about right. Unfortunately it may require some manual tweaking and building pt from source. I think we will try to include lapack in pt mobile builds for future. Do you mind filing an issue and tagging me on it? Thanks!</p>

Matt_Davis: <p>Ok, sent a github issue:</p><aside class="onebox githubissue" data-onebox-src="https://github.com/pytorch/pytorch/issues/67599">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/issues/67599" target="_blank" rel="noopener nofollow ugc">github.com/pytorch/pytorch</a>
  </header>

  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Issue">
	  <svg width="60" height="60" class="github-icon" viewbox="0 0 14 16" aria-hidden="true"><path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/pytorch/pytorch/issues/67599" target="_blank" rel="noopener nofollow ugc">Mobile builds need to make custom build of libtorch to run, let's just include it to make it easier</a>
    </h4>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2021-10-31" data-time="19:45:13" data-timezone="UTC">07:45PM - 31 Oct 21 UTC</span>
      </div>


      <div class="user">
        <a href="https://github.com/Deamoner" target="_blank" rel="noopener nofollow ugc">
          <img alt="Deamoner" src="https://avatars.githubusercontent.com/u/478888?v=4" class="onebox-avatar-inline" width="20" height="20">
          Deamoner
        </a>
      </div>
    </div>

    <div class="labels">
    </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">## 🚀 Feature

Include lapackage in the libtorch and pytorch builds so that jit<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden"> exports utilizing these packages do not require custom builds in order for the jit exports to work. 

## Motivation


Trying to get a model moved over to mobile has grown to a much bigger task when I have to rebuild torch or libtorch, I'm not sure which I have to rebuild in order to move the model to mobile. Other then that moving to mobile in pytorch I have found incredibly easy. 

## Pitch


Change the build ios cmake args to use lapack 
Change the cmake on pytorch to in the devdependencies to have use lapack turned to 1 

## Alternatives



## Additional context


https://discuss.pytorch.org/t/model-move-from-python-to-ios-missing-lapack/135317/4</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>


Matt_Davis: <p>Tried to put the pytroch model exported on the device and it says the model version is 7 and software is 2 - 5 supported. Is that cause I need to rebuild and use libtorch now?</p>

kimishpatel: <p>Yeah so you probably exported model using later versions of libtorch but the libtorch/runtime on the device is older one. So it is likely backwards compatibility (newer models cannot run on older runtime) issue. You will have to update the runtime on device. Alternatively we have backporting supported but I dont remember since when. Which version of libtorch you are using? Or are you building from source?</p>
<p><a class="mention" href="/u/martin_yuan">@Martin_Yuan</a> for more info on backporting.</p>

Matt_Davis: <p>Using the latest ios cocoapod but I had to rebuild pytorch for the la pack so I assume the libtorch needs to be rebuilt right?</p>

kimishpatel: <p>I think so. Let us know if rebuilding from source does not work for you.</p>