UnityGiles commited on
Commit
b3d9a99
·
1 Parent(s): 20374b1

cleanup syntax

Browse files
Files changed (1) hide show
  1. RunTinyStories.cs +7 -6
RunTinyStories.cs CHANGED
@@ -1,8 +1,9 @@
 
1
  using System.Collections.Generic;
2
- using UnityEngine;
3
- using Unity.InferenceEngine;
4
  using System.Text;
5
- using FF = Unity.InferenceEngine.Functional;
 
 
6
 
7
  public class RunTinyStories : MonoBehaviour
8
  {
@@ -57,8 +58,8 @@ public class RunTinyStories : MonoBehaviour
57
  var graph = new FunctionalGraph();
58
  var input = graph.AddInput(model1, 0);
59
  var currentTokenInput = graph.AddInput<int>(new TensorShape(), "currentToken");
60
- var row = FF.Select(Functional.Forward(model1, input)[0], 1, currentTokenInput);
61
- var output = FF.Multinomial(predictability * row, 1);
62
  var model2 = graph.Compile(output);
63
 
64
  engine = new Worker(model2, backend);
@@ -122,7 +123,7 @@ public class RunTinyStories : MonoBehaviour
122
  void LoadVocabulary()
123
  {
124
  var jsonText = vocabAsset.text;
125
- vocab = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, int>>(jsonText);
126
  tokens = new string[vocab.Count];
127
  foreach (var item in vocab)
128
  {
 
1
+ using System;
2
  using System.Collections.Generic;
 
 
3
  using System.Text;
4
+ using Newtonsoft.Json;
5
+ using Unity.InferenceEngine;
6
+ using UnityEngine;
7
 
8
  public class RunTinyStories : MonoBehaviour
9
  {
 
58
  var graph = new FunctionalGraph();
59
  var input = graph.AddInput(model1, 0);
60
  var currentTokenInput = graph.AddInput<int>(new TensorShape(), "currentToken");
61
+ var row = Functional.Select(Functional.Forward(model1, input)[0], 1, currentTokenInput);
62
+ var output = Functional.Multinomial(predictability * row, 1);
63
  var model2 = graph.Compile(output);
64
 
65
  engine = new Worker(model2, backend);
 
123
  void LoadVocabulary()
124
  {
125
  var jsonText = vocabAsset.text;
126
+ vocab = JsonConvert.DeserializeObject<Dictionary<string, int>>(jsonText);
127
  tokens = new string[vocab.Count];
128
  foreach (var item in vocab)
129
  {