bobd-unity commited on
Commit
069d939
·
verified ·
1 Parent(s): 0f75aa9

Update RunPhi15.cs

Browse files

Fixed Load Vocabulary() issue on Mac and Linux. (line 142)
The original line was:
merges = mergesAsset.text.Split("\r\n");

Replaced with code that splits on '\n', trims any '\r', and skips the #version header line (lines 140–148 in the current file).
The original code (Split("\r\n")) only worked on Windows. The current fix is cross-platform.

Files changed (1) hide show
  1. RunPhi15.cs +14 -4
RunPhi15.cs CHANGED
@@ -13,9 +13,11 @@ public class RunPhi15 : MonoBehaviour
13
 
14
  const BackendType backend = BackendType.GPUCompute;
15
 
16
- //string outputString = "Once upon a time, there were three bears";
17
- string outputString = "One day an alien came down from Mars. It saw a chicken";
18
-
 
 
19
  // This is how many tokens you want. It can be adjusted.
20
  const int maxTokens = 100;
21
 
@@ -135,7 +137,15 @@ public class RunPhi15 : MonoBehaviour
135
  tokens[item.Value] = item.Key;
136
  }
137
 
138
- merges = mergesAsset.text.Split("\r\n");
 
 
 
 
 
 
 
 
139
  }
140
 
141
  // Translates encoded special characters to Unicode
 
13
 
14
  const BackendType backend = BackendType.GPUCompute;
15
 
16
+ string outputString = "Write a detailed analogy between mathematics and a lighthouse.";
17
+ // string outputString = "Create a list of the first 10 even numbers using list comprehension";
18
+ // string outputString = "# Python function to compute the nth Fibonacci number using recursion\ndef fibonacci(n):\nif n <= 1:";
19
+ // string outputString = "One day an alien came down from Mars. It saw a chicken";
20
+
21
  // This is how many tokens you want. It can be adjusted.
22
  const int maxTokens = 100;
23
 
 
137
  tokens[item.Value] = item.Key;
138
  }
139
 
140
+ var allMerges = mergesAsset.text.Split('\n');
141
+ var mergeList = new List<string>();
142
+ foreach (var line in allMerges)
143
+ {
144
+ var trimmed = line.TrimEnd('\r');
145
+ if (trimmed.Length > 0 && trimmed[0] != '#')
146
+ mergeList.Add(trimmed);
147
+ }
148
+ merges = mergeList.ToArray();
149
  }
150
 
151
  // Translates encoded special characters to Unicode