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
from openai import OpenAI | |
from dotenv import load_dotenv | |
import numpy as np | |
load_dotenv() | |
def chat_with_gpt(messages): | |
client = OpenAI() | |
try: | |
completion = client.chat.completions.create( | |
model="gpt-3.5-turbo", |
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
""" | |
MistralForCausalLM( | |
(model): MistralModel( | |
(embed_tokens): Embedding(131072, 5120) | |
(layers): ModuleList( | |
(0-39): 40 x MistralDecoderLayer( | |
(self_attn): MistralAttention( | |
(q_proj): Linear(in_features=5120, out_features=4096, bias=False) | |
(k_proj): Linear(in_features=5120, out_features=1024, bias=False) | |
(v_proj): Linear(in_features=5120, out_features=1024, bias=False) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# attribution : https://github.com/AgiFlow/llama31/blob/main/tool_calls.ipynb | |
from furiosa_llm import LLM, SamplingParams | |
prompt = """ | |
<|begin_of_text|> | |
<|start_header_id|>system<|end_header_id|> | |
You are a helpful assistant with tool calling capabilities. When you receive a tool call response, use the output to format an answer to the orginal use question. | |
If you are using tools, respond in the format {"name": function name, "parameters": dictionary of function arguments}. Do not use variables. |
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
Enter a number: 10 | |
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34] |
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
def fibonacci(n: int): | |
"""Return a fibonacci series upto the argument n""" | |
# As prefix, we provided the function proto, a docstring... | |
# <codestral will fill in the middle, i.e., the algorithm> | |
# ...and the invocation (the suffix) | |
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
def fibonacci(n: int): | |
"""Return a fibonacci series upto the argument n""" | |
if n == 0: | |
return [] | |
elif n == 1: | |
return [0] | |
elif n == 2: | |
return [0, 1] | |
else: |
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 | |
from mistralai.client import MistralClient | |
from mistralai.models.chat_completion import ChatMessage | |
import os | |
from mistralai.client import MistralClient | |
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
""" | |
Uses a combination of 'furiosactl info' and 'furiosa top' to collect temperature + power + NPU utilization over the entire run | |
""" | |
import subprocess | |
import time | |
import dateutil | |
from datetime import datetime | |
from dateutil.parser import parse | |
import csv |
NewerOlder