Spaces:
Build error
Build error
PeteBleackley
commited on
Commit
·
58e8b0b
1
Parent(s):
66ccfdf
Datasets documentation
Browse files- .ipynb_checkpoints/Model visualisation-checkpoint.ipynb +6 -0
- DataSets.md +17 -0
- model.png +0 -0
- qarac/models/layers/HyenaLayer.py +3 -1
- scripts.py +2 -1
.ipynb_checkpoints/Model visualisation-checkpoint.ipynb
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [],
|
| 3 |
+
"metadata": {},
|
| 4 |
+
"nbformat": 4,
|
| 5 |
+
"nbformat_minor": 5
|
| 6 |
+
}
|
DataSets.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#Datasets
|
| 2 |
+
|
| 3 |
+
We are planning to use the following datasets to train the models.
|
| 4 |
+
|
| 5 |
+
##Base Model Training
|
| 6 |
+
|
| 7 |
+
[The British National Corpus](http://www.natcorp.ox.ac.uk/)
|
| 8 |
+
|
| 9 |
+
##Question Answering
|
| 10 |
+
|
| 11 |
+
##Reasoning
|
| 12 |
+
|
| 13 |
+
[Avicenna: Syllogistic Commonsense Reasoning](https://github.com/ZeinabAghahadi/Syllogistic-Commonsense-Reasoning)
|
| 14 |
+
|
| 15 |
+
##Consistency
|
| 16 |
+
|
| 17 |
+
[Stanford Natural Language Inference Corpus](https://www.kaggle.com/datasets/stanfordu/stanford-natural-language-inference-corpus)
|
model.png
ADDED
|
qarac/models/layers/HyenaLayer.py
CHANGED
|
@@ -11,6 +11,7 @@ import keras_nlp
|
|
| 11 |
import tensorflow
|
| 12 |
import warnings
|
| 13 |
|
|
|
|
| 14 |
def convolve(x,y):
|
| 15 |
|
| 16 |
fx = tensorflow.vectorized_map(fft, x, warn=False)
|
|
@@ -54,6 +55,7 @@ class HyenaLayer(keras.layers.Layer):
|
|
| 54 |
self.data_projection = None
|
| 55 |
self.filters = None
|
| 56 |
|
|
|
|
| 57 |
def positional_encoding(self,X):
|
| 58 |
t = tensorflow.dtypes.saturate_cast(tensorflow.ragged.range(X.row_lengths()),
|
| 59 |
tensorflow.float32)
|
|
@@ -90,7 +92,7 @@ class HyenaLayer(keras.layers.Layer):
|
|
| 90 |
x = concat(x,tensorflow.zeros_like(x))
|
| 91 |
f = concat(f,tensorflow.zeros_like(f))
|
| 92 |
y = x[:,:,:,0]
|
| 93 |
-
for i in range(self.stages):
|
| 94 |
y = convolve(y,f[:,:,:,i])*x[:,:,:,i+1]
|
| 95 |
if self.causal:
|
| 96 |
for (i,n) in enumerate(X.row_lengths()):
|
|
|
|
| 11 |
import tensorflow
|
| 12 |
import warnings
|
| 13 |
|
| 14 |
+
@tensorflow.function
|
| 15 |
def convolve(x,y):
|
| 16 |
|
| 17 |
fx = tensorflow.vectorized_map(fft, x, warn=False)
|
|
|
|
| 55 |
self.data_projection = None
|
| 56 |
self.filters = None
|
| 57 |
|
| 58 |
+
@tensorflow.function
|
| 59 |
def positional_encoding(self,X):
|
| 60 |
t = tensorflow.dtypes.saturate_cast(tensorflow.ragged.range(X.row_lengths()),
|
| 61 |
tensorflow.float32)
|
|
|
|
| 92 |
x = concat(x,tensorflow.zeros_like(x))
|
| 93 |
f = concat(f,tensorflow.zeros_like(f))
|
| 94 |
y = x[:,:,:,0]
|
| 95 |
+
for i in tensorflow.range(self.stages):
|
| 96 |
y = convolve(y,f[:,:,:,i])*x[:,:,:,i+1]
|
| 97 |
if self.causal:
|
| 98 |
for (i,n) in enumerate(X.row_lengths()):
|
scripts.py
CHANGED
|
@@ -30,7 +30,8 @@ def train_base_model(task,filename):
|
|
| 30 |
model.compile(optimizer=optimizer,loss='sparse_categorical_crossentropy',metrics='accuracy')
|
| 31 |
model.fit(train_data,
|
| 32 |
epochs=100,
|
| 33 |
-
workers = 16
|
|
|
|
| 34 |
test_data=qarac.corpora.Batcher.Batcher(test)
|
| 35 |
print(model.evaluate(test_data))
|
| 36 |
model.save(filename)
|
|
|
|
| 30 |
model.compile(optimizer=optimizer,loss='sparse_categorical_crossentropy',metrics='accuracy')
|
| 31 |
model.fit(train_data,
|
| 32 |
epochs=100,
|
| 33 |
+
workers = 16,
|
| 34 |
+
use_multiprocessing=True)
|
| 35 |
test_data=qarac.corpora.Batcher.Batcher(test)
|
| 36 |
print(model.evaluate(test_data))
|
| 37 |
model.save(filename)
|