AI之LLM/MLM:Nvidia官網人工智能大模型工具合集(大語言模型/多模態模型,文本生成/圖像生成/視頻生成)的簡介、使用方法、案例應用之詳細攻略
NVIDIA NIM APIs讓開發者可以輕松地調用NVIDIA的AI模型,這些模型經過優化可以在GPU上高效運行。所以總體來說,這個網站是NVIDIA展示他們AI模型庫的平臺,讓開發者能方便地評估和應用這些模型,在產品和服務中集成人工智能功能。
官網地址:Try NVIDIA NIM APIs
>> 展示NVIDIA開源和內部訓練的不同領域的AI模型,如圖像生成、語言生成、視頻生成等。
>> 用戶可以在線試用這些模型,給出輸入看模型的輸出。
>> 提供每個模型的文檔和說明,了解它能做什么和如何調用。
>> 按照應用領域(如游戲、醫療等)和任務(如圖像識別、自然語言處理等)過濾模型。
>> 登陸后可能提供更高級功能,比如定制模型或將模型部署到用戶自己的服務器。
生成圖像
NVIDIA NIM
快速生成文本到圖像的模型,可以在單次網絡評估中從文本提示中合成逼真的圖像。
Sci-Fi Image Generator Prompt: Quantum Flux, Cyborg Oasis, Alien Metropolis, Galactic Nexus, Celestial Portal, Techno-Organic Fusion, Astral Frontier, Nano-Symbiosis, Cosmic Arcadia, Hyperdimensional Nexus, Synthetic Nebula, Bio-Mechanical Citadel, Virtual Cosmos, Transcendent Echoes, Futuristic Megalopolis, Exoplanetary Eden, Augmented Reality Dreamscape, Interstellar Beacon, Cybernetic Utopia, Robotic Serenity.
聊天
語言生成
前沿文本生成模型,能夠理解文本、進行轉換和生成代碼。
Certainly! Here's a prompt in English that you can use to generate Python machine learning code:
"Please create a Python script that implements a machine learning algorithm for classifying iris flowers based on the iris dataset. The script should include steps for data loading, preprocessing, model training, and evaluation using accuracy as the metric. Use a popular machine learning library such as scikit-learn, and provide comments in the code for clarity."
#Import necessary libraries
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
#Load the iris dataset
iris_data = pd.read_csv('iris.csv')
#Preprocess the data
X = iris_data.drop('species', axis=1)
y = iris_data['species']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
#Train the logistic regression model
model = LogisticRegression()
model.fit(X_train, y_train)
#Evaluate the model
y_pred = model.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
print('The accuracy of the model is:', accuracy)
from openai import OpenAI
client = OpenAI(
base_url = "https://integrate.api.nvidia.com/v1",
api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"
)
completion = client.chat.completions.create(
model="google/gemma-7b",
messages=[{"role":"user","content":"who are you?"}],
temperature=0.5,
top_p=1,
max_tokens=1024,
stream=True
)
for chunk in completion:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
聊天
語言生成
前沿的大型語言人工智能模型,能夠根據提示生成文本和代碼。
Please create a Python script that implements a machine learning algorithm for classifying iris flowers based on the iris dataset. The script should include steps for data loading, preprocessing, model training, and evaluation using accuracy as the metric. Use a popular machine learning library such as scikit-learn, and provide comments in the code for clarity.
#Import necessary libraries
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
#Load the iris dataset
iris = load_iris()
X = iris.data[:, :2] #we only take the first two features.
y = iris.target
#Split the dataset into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
#Scale the data using StandardScaler
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)
#Train an SVM model on the scaled training data
svm = SVC(kernel='linear', C=1)
svm.fit(X_train_scaled, y_train)
#Evaluate the model on the test data
y_pred = svm.predict(X_test_scaled)
accuracy = accuracy_score(y_test, y_pred)
print(f"Accuracy: {accuracy:.3f}")
#Use the trained model to make predictions on new data
new_data = [[5.1, 3.5]]
new_data = scaler.transform(new_data)
prediction = svm.predict(new_data)
print(f"Prediction: {prediction}")
from openai import OpenAI
client = OpenAI(
base_url = "https://integrate.api.nvidia.com/v1",
api_key = "$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC"
)
completion = client.chat.completions.create(
model="meta/llama2-70b",
messages=[{"role":"user","content":"Please create a Python script that implements a machine learning algorithm for classifying iris flowers based on the iris dataset. The script should include steps for data loading, preprocessing, model training, and evaluation using accuracy as the metric. Use a popular machine learning library such as scikit-learn, and provide comments in the code for clarity."}],
temperature=0.5,
top_p=1,
max_tokens=1024,
stream=True
)
for chunk in completion:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
Stable-Video-Diffusion
圖像到視頻
NVIDIA NIM
穩定視頻擴散(SVD)是一種生成擴散模型,利用單個圖像作為條件幀來合成視頻序列。
Mistral-7B-Instruct-v0.2
語言生成
NVIDIA NIM
這個LLM能夠遵循指令,完成請求,并生成創造性的文本。
聊天
代碼生成
NVIDIA NIM | llama3-70b
NVIDIA NIM | llama3-8b
持續更新中……