This file contains 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 torch | |
from transformers import AutoTokenizer, AutoModelForCausalLM | |
from accelerate import Accelerator | |
import os | |
import argparse | |
def main(): | |
# Parse command line arguments | |
args = parse_args() |
This file contains 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 time | |
import torch | |
from transformers import AutoModelForCausalLM, AutoTokenizer | |
def load_model_and_tokenizer(model_id): | |
""" | |
Load the tokenizer and model based on the specified model ID. | |
Model is set to use float16 for computation to reduce memory usage and improve performance. | |
""" | |
tokenizer = AutoTokenizer.from_pretrained(model_id) |
This file contains 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 | |
import sys | |
import torch | |
import glob | |
def load_parameters(directory): | |
""" Load model parameters from a JSON file. """ | |
with open(os.path.join(directory, 'params.json'), 'r') as file: | |
return json.load(file) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
{ | |
"last_node_id": 3, | |
"last_link_id": 2, | |
"nodes": [ | |
{ | |
"id": 2, | |
"type": "Call LLM Basic", | |
"pos": [ | |
42, | |
190 |
This file contains 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
// Read the content | |
var bodyBytes []byte | |
if r.Request.Body != nil { | |
bodyBytes, _ = ioutil.ReadAll(r.Request.Body) | |
} | |
// Restore the io.ReadCloser to its original state | |
r.Request.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes)) | |
// Use the content | |
requestMetrics.Body = string(bodyBytes) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. | |
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
This file contains 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
#https://gist.github.com/Chandler/fb7a070f52883849de35 SEE HERE | |
# MIT License | |
# Copyright (c) 2016 Chandler Abraham | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights |
NewerOlder