This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::borrow::Borrow; | |
use tch::nn::ModuleT; | |
use tch::nn::{self}; | |
use tch::{Kind, Tensor}; | |
#[derive(Debug)] | |
pub struct Dropout { | |
dropout_prob: f64, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod ml_thread; | |
use gdnative::prelude::{godot_print, methods, Method, NativeClass, Node as GDNode, InitHandle, godot_init}; | |
use ml_thread::start_language_model_thread; | |
use std::sync::mpsc::{channel, Receiver, RecvError, Sender, SendError}; | |
const MAX_INPUT_LENGTH: usize = 512; | |
const BATCH_SIZE: usize = 1; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
from tqdm import tqdm | |
import torch | |
import torch.nn.functional as F | |
from transformers import AutoTokenizer, AutoModel | |
from elasticsearch import Elasticsearch | |
class JsonlCollectionIterator: |