Data Generation and Parser from OpenGPT
jfResearchEng opened this issue Β· comments
π Feature
Generate data set for training using opengpt. And also create a parser to separate the coded from the context.
The starting points would be filtering techniques: e.g. Kalman Filter and IIR filter.
Convert:
An infinite impulse response (IIR) filter is a type of digital filter that can be used to implement a variety of different frequency response characteristics. It is characterized by its recursive structure, which allows it to have an impulse response that extends indefinitely into the past. Here is some sample code that demonstrates how to implement an IIR filter using a direct form II structure:
import numpy as np
class IIRFilter:
def __init__(self, b, a):
self.b = b
self.a = a
self.z = np.zeros(max(len(b), len(a)))
def filter(self, x):
y = np.zeros_like(x)
for n in range(len(x)):
y[n] = self.b[0] * x[n]
for m in range(1, len(self.b)):
if n-m >= 0:
y[n] += self.b[m] * x[n-m]
for m in range(1, len(self.a)):
if n-m >= 0:
y[n] -= self.a[m] * y[n-m]
self.z[0] = x[n]
self.z[1:] = self.z[:-1]
return y
to
result[0] = "An infinite impulse response (IIR) filter is a type of digital filter that can be used to implement a variety of different frequency response characteristics. It is characterized by its recursive structure, which allows it to have an impulse response that extends indefinitely into the past. Here is some sample code that demonstrates how to implement an IIR filter using a direct form II structure:"
result[1] =
import numpy as np
class IIRFilter:
def __init__(self, b, a):
self.b = b
self.a = a
self.z = np.zeros(max(len(b), len(a)))
def filter(self, x):
y = np.zeros_like(x)
for n in range(len(x)):
y[n] = self.b[0] * x[n]
for m in range(1, len(self.b)):
if n-m >= 0:
y[n] += self.b[m] * x[n-m]
for m in range(1, len(self.a)):
if n-m >= 0:
y[n] -= self.a[m] * y[n-m]
self.z[0] = x[n]
self.z[1:] = self.z[:-1]
return y
The example above is a transformer node.
For this issue, we would like to prioritize the following nodes (priority high to low):
- Transformer Node (e.g. IIRFilter)
- Source Node (e.g. Microphone integration)
- UI (e.g. Matplotlib-based plotting)
Additional context
- The code should be added at folder is https://github.com/facebookresearch/labgraph/tree/main/extensions/lgpilot
- Create setup.py and README.md, where example can be found at: https://github.com/facebookresearch/labgraph/tree/main/extensions/labgraph_viz
- Add github action support, reference: https://github.com/facebookresearch/labgraph/actions/workflows/main.yml
- Add proper license header.