# UnsupportedOperationException while training

**URL:** <https://community.konduit.ai/t/unsupportedoperationexception-while-training/1546>\
**Category:** SameDiff\
**Created:** [August 10, 2021, 4:23pm UTC](https://community.konduit.ai/t/unsupportedoperationexception-while-training/1546 "2021-08-10T16:23:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lln](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lln](https://community.konduit.ai/u/lln)\
**Post date:** [August 10, 2021, 4:23pm UTC](https://community.konduit.ai/t/unsupportedoperationexception-while-training/1546/1 "2021-08-10T16:23:15Z")

</div>

Hi, since updating to M1.1 a simple samediff training is giving me an error. Previously it worked without issues. I have a standard multi-lingual cased BERT model which I’m loading into sd with:

```auto
SameDiff sd = TFGraphMapper.importGraph(new ByteArrayInputStream(pretrainedModel));

```

The stacktrace is:  
 ![image](https://canada1.discourse-cdn.com/flex035/uploads/konduit/original/1X/c1eff2a941e6760fe138a433d93a4fd632891743.png)

I guess this is related to the latest change documented here [Fixes https://github.com/eclipse/deeplearning4j/issues/8876 by agibsonccc · Pull Request #9357 · eclipse/deeplearning4j · GitHub](https://github.com/eclipse/deeplearning4j/pull/9357).

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [August 11, 2021, 1:40am UTC](https://community.konduit.ai/t/unsupportedoperationexception-while-training/1546/2 "2021-08-11T01:40:56Z")

</div>

@lln Could you please try the new tensorflow import? That graph mapper was left there for backwards compatibility, but it’s suggested to try the new import.  
See:

> **[Model Import Framework](https://deeplearning4j.konduit.ai/samediff/explanation/model-import-framework)**
>
> Model import framework overview and examples

---

<div class="post-metadata">

**Author:** ![lln](https://avatars.discourse-cdn.com/v4/letter/l/ecae2f/32.png) [@lln](https://community.konduit.ai/u/lln)\
**Post date:** [August 11, 2021, 12:29pm UTC](https://community.konduit.ai/t/unsupportedoperationexception-while-training/1546/3 "2021-08-11T12:29:11Z")

</div>

@agibsonccc Thanks for the reply. I refactored it to use `TensorflowFrameworkImporter` but I’m now getting an error

```auto
Caused by: java.io.FileNotFoundException: nd4j-op-def.pbtxt cannot be opened because it does not exist
	at org.nd4j.common.io.ClassPathResource.getInputStream(ClassPathResource.java:248)
	at org.nd4j.common.io.ClassPathResource.getInputStream(ClassPathResource.java:235)
	at org.nd4j.samediff.frameworkimport.tensorflow.opdefs.TensorflowOpDescriptorLoader.nd4jOpList(TensorflowOpDescriptorLoader.kt:55)
	at org.nd4j.samediff.frameworkimport.tensorflow.opdefs.TensorflowOpDescriptorLoader.<init>(TensorflowOpDescriptorLoader.kt:46)

```

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [August 11, 2021, 10:33pm UTC](https://community.konduit.ai/t/unsupportedoperationexception-while-training/1546/4 "2021-08-11T22:33:45Z")

</div>

@lln I’ve noticed that recently, for some reason the class path resource isn’t being resolved there. As a work around could you take this folder:

> **[deeplearning4j/nd4j/samediff-import/samediff-import-tensorflow/src/main/resource...](https://github.com/eclipse/deeplearning4j/tree/master/nd4j/samediff-import/samediff-import-tensorflow/src/main/resources)**
>
> master/nd4j/samediff-import/samediff-import-tensorflow/src/main/resources

and put it in your src/main/resources and run it again? Thanks!

---

<div class="post-metadata">

**Author:** ![braeunlich](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/braeunlich/32/631_2.png) [@braeunlich](https://community.konduit.ai/u/braeunlich)\
**Post date:** [August 24, 2021, 7:08am UTC](https://community.konduit.ai/t/unsupportedoperationexception-while-training/1546/5 "2021-08-24T07:08:21Z")

</div>

I’m working in the same project with @lln so i’m following up on this…

@agibsonccc thanks, that helps but we now have an other issue. I’m using the same model as @lln that worked with the import method of M1:

java.lang.IllegalArgumentException: Found invalid output tensor named permuteDims for rule ndarraymapping and mapping process for op transpose and input framework name Transpose with definition being name: “transpose”  
argDescriptor {  
name: “dtype”  
argType: DATA\_TYPE  
}  
argDescriptor {  
name: “outputs”  
argType: OUTPUT\_TENSOR  
}  
argDescriptor {  
name: “input”  
argType: INPUT\_TENSOR  
}  
argDescriptor {  
name: “permutationVector”  
argType: INPUT\_TENSOR  
argIndex: 1  
}  
argDescriptor {  
name: “permuteDims”  
argType: INT64  
}

```
at org.nd4j.samediff.frameworkimport.process.AbstractMappingProcess.<init>(AbstractMappingProcess.kt:84)
at org.nd4j.samediff.frameworkimport.tensorflow.process.TensorflowMappingProcess.<init>(TensorflowMappingProcess.kt:49)
at org.nd4j.samediff.frameworkimport.tensorflow.process.TensorflowMappingProcess.<init>(TensorflowMappingProcess.kt:48)
at org.nd4j.samediff.frameworkimport.tensorflow.process.TensorflowMappingProcessLoader.instantiateMappingProcess(TensorflowMappingProcessLoader.kt:45)
at org.nd4j.samediff.frameworkimport.process.AbstractMappingProcessLoader.createProcess(AbstractMappingProcessLoader.kt:155)
at org.nd4j.samediff.frameworkimport.registry.OpMappingRegistry.loadFromDefinitions(OpMappingRegistry.kt:169)
at org.nd4j.samediff.frameworkimport.tensorflow.opdefs.TensorflowOpDescriptorLoader.createOpMappingRegistry(TensorflowOpDescriptorLoader.kt:105)
at org.nd4j.samediff.frameworkimport.tensorflow.importer.TensorflowFrameworkImporter.<init>(TensorflowFrameworkImporter.kt:45)

```
