亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

??
??
??
??? ?? ??? ?? ???? ??? ??????
??? ??
???? ? ??
????
????
Python? ??? ?? ? ?? ??
5.1 ?? ?? ??
5.2 ??? ??
5.3 Azure Machine Learning ?? ?? ???
5.4 ?? ?? ????(train.py)
5.5 Azure? ?? ??
.NET Core? ?? ??? ?? ??
6.1 .NET Core ? API ???? ??
6.2 ??? ??
6.3 ModelConsumerService.cs
6.4 LLMController.cs
6.5 .NET Core ?????? ??
Azure? ??
?? ??
??
? ??? ?? ??? ???? .NET Core, Python ? Azure? ???? LLM(?? ?? ??) ?? ??

.NET Core, Python ? Azure? ???? LLM(?? ?? ??) ?? ??

Jan 14, 2025 am 07:11 AM

Fine-Tuning Large Language Models (LLMs) with .NET Core, Python, and Azure

??

  1. ??
  2. ??? ?? ??? ?? ???? ??? ??????
  3. ??? ??
  4. ????
  5. Python? ??? ?? ? ?? ??
  6. .NET Core? ?? ??? ?? ??
  7. Azure? ??
  8. ?? ??
  9. ??

  1. ??

??? ?? ??(LLM)? ??? ??? ???? ???? ???? ???? ?? ??? ??? ?? ????. ??? ?? ???? ?? ???? ??? ??? ? ?? ??? ???? ??? ??? ??? ????. ?? ??? ?? ???? ??? ?? ??? ?? ???? ??? ?? ???? ???? ???? ?? ? ????.

? ????? ???? ???? ?? Python? ???? LLM? ?? ??? ?? ?? ??? .NET Core C# ??????? ?? ? ???? ??? ?????. ?? ??? Microsoft Azure?? ?????.


  1. ??? ?? ??? ?? ???? ??? ??????

  2. ??? ???: LLM? ??? ??, ?? ?? ?? ?? ??? ????? ?? ??? ? ????.

  3. ?? ??: ?? ??? ?? ???, ??, ?? ?? ?? ???? ??? ??? ???? ??? ??? ????.

  4. ?? ??: ???? ??? ???? ?? ??? ??? LLM? ??? ??? ? ????.

  5. ??? ??: ?? ??? ???? ???? ?? ??? ?? ????? ???? ???? ??? ????.


  1. ??? ??

???? ? ??

  1. ?? ??? ?? Python

    • ????? ???? ?????(?: Hugging Face Transformers, PyTorch)
    • ?? ??? ?? ?? ? ?? ???? ???
  2. ??? .NET Core C#

    • ?? ?? ??? ?? ??? ??? ?? API ??
    • ?? ?? ????? ??? ??? ??? ??
  3. Azure ???

      ?? ? ?? ??? ??
    • Azure Machine Learning
    • ??? ? ?? ????? ??
    • Azure Storage
    • .NET Core ?????? ???? ??
    • Azure App Service ?? Azure Function
    • ?? ?? ??? ??
    • Azure Key Vault(?? ??)

  1. ????

????

  • Azure ??: Machine Learning Workspace ? App Service? ?? ???? ???? ? ?????.
  • Python 3.8 : ?? ?? ??? ?? ??? ?????.
  • .NET 6/7/8 SDK: .NET Core C# ??????? ??? ???? ? ?????.
  • Visual Studio 2022 ?? Visual Studio Code: ?? IDE.
  • Azure CLI: ???? ?? Azure ???? ???? ???? ? ?????.
  • Docker(?? ??): ??? ?? ??????? ??????? ? ??? ? ????.

  1. Python? ??? ?? ? ?? ??

? ???? ?? ?? ???? LLM ?? ?? ????? ? ??? Hugging Face Transformers? ?????.

5.1 ?? ?? ??

<code>python -m venv venv
source venv/bin/activate  # 在 Windows 上:venv\Scripts\activate</code>

5.2 ??? ??

<code>pip install torch transformers azureml-sdk</code>

5.3 Azure Machine Learning ?? ?? ???

  1. ??? ?? ? ?? ??:
<code>   az group create --name LLMFinetuneRG --location eastus
   az ml workspace create --name LLMFinetuneWS --resource-group LLMFinetuneRG</code>
  1. ????? ??? ?? ??? ?????(config.json ?? ?? ?? ?? ??).

5.4 ?? ?? ????(train.py)

<code>import os
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, TrainingArguments, Trainer
from azureml.core import Workspace, Run

# 連接到 Azure ML
ws = Workspace.from_config()
run = Run.get_context()

model_name = "gpt2"  # 示例模型
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

# 加載自定義數(shù)據集(本地或來自 Azure 存儲)
# 示例:Azure ML 中的文本文件或數(shù)據集
train_texts = ["此處輸入您的特定領域文本..."]  # 簡化版
train_encodings = tokenizer(train_texts, truncation=True, padding=True)

class CustomDataset(torch.utils.data.Dataset):
    def __init__(self, encodings):
        self.encodings = encodings
    def __len__(self):
        return len(self.encodings["input_ids"])
    def __getitem__(self, idx):
        return {k: torch.tensor(v[idx]) for k, v in self.encodings.items()}

train_dataset = CustomDataset(train_encodings)

training_args = TrainingArguments(
    output_dir="./results",
    num_train_epochs=3,
    per_device_train_batch_size=2,
    save_steps=100,
    logging_steps=100
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=train_dataset,
)

trainer.train()

# 保存微調后的模型
trainer.save_model("./fine_tuned_model")
tokenizer.save_pretrained("./fine_tuned_model")</code>

5.5 Azure? ?? ??

<code>from azureml.core.model import Model

model = Model.register(
    workspace=ws,
    model_path="./fine_tuned_model",
    model_name="myFineTunedLLM"
)</code>

? ???? ?? ????? ??? ??? ? ??? ?? ??? ??? Azure Machine Learning? ?????.


  1. .NET Core? ?? ??? ?? ??

6.1 .NET Core ? API ???? ??

<code>dotnet new webapi -n FineTunedLLMApi
cd FineTunedLLMApi</code>

6.2 ??? ??

    Azure ?? ?? ?? ?? API ??? ??
  • HttpClient
  • Newtonsoft.Json(???? JSON.NET? ????? ??)
  • Azure ???? ?? ?? ???? ??
  • Azure.Storage.Blobs ?? Azure.Identity
<code>dotnet add package Microsoft.Extensions.Http
dotnet add package Microsoft.Azure.Storage.Blob
dotnet add package Newtonsoft.Json</code>

6.3 ModelConsumerService.cs

???? ??? ??? ? ???? ????? ?????(?: Azure Container Instance ?? Azure ML? ??? ?? ????? ??). ?? ?? ??? ???? ???? ?? ??? ????.

<code>using Newtonsoft.Json;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

public class ModelConsumerService
{
    private readonly HttpClient _httpClient;

    public ModelConsumerService(IHttpClientFactory httpClientFactory)
    {
        _httpClient = httpClientFactory.CreateClient("FineTunedModel");
    }

    public async Task<string> GetCompletionAsync(string prompt)
    {
        var requestBody = new { prompt = prompt };
        var content = new StringContent(
            JsonConvert.SerializeObject(requestBody),
            Encoding.UTF8, 
            "application/json");

        var response = await _httpClient.PostAsync("/predict", content);
        response.EnsureSuccessStatusCode();
        return await response.Content.ReadAsStringAsync();
    }
}</code>

6.4 LLMController.cs

<code>using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

[ApiController]
[Route("[controller]")]
public class LLMController : ControllerBase
{
    private readonly ModelConsumerService _modelService;

    public LLMController(ModelConsumerService modelService)
    {
        _modelService = modelService;
    }

    [HttpPost("complete")]
    public async Task<IActionResult> CompletePrompt([FromBody] PromptRequest request)
    {
        var result = await _modelService.GetCompletionAsync(request.Prompt);
        return Ok(new { Completion = result });
    }
}

public class PromptRequest
{
    public string Prompt { get; set; }
}</code>

6.5 .NET Core ?????? ??

Program.cs ?? Startup.cs:

<code>var builder = WebApplication.CreateBuilder(args);

// 注冊 HttpClient
builder.Services.AddHttpClient("FineTunedModel", client =>
{
    client.BaseAddress = new Uri("https://your-model-endpoint/");
});

// 注冊 ModelConsumerService
builder.Services.AddTransient<ModelConsumerService>();

builder.Services.AddControllers();
var app = builder.Build();

app.MapControllers();
app.Run();</code>

  1. Azure? ??

  2. Azure ? ???:

    • ?? .NET Core ??????? ?? ? ??? ?? ?? ?????.
    • Azure Portal ?? CLI? ?? ??? ? ?? ????.
<code>python -m venv venv
source venv/bin/activate  # 在 Windows 上:venv\Scripts\activate</code>
  1. Azure ?? (?? ??):

    • ??? ?????? ??? ?? ???? ??? ?? ??? ???? ? ?????.
  2. Azure Kubernetes Service(AKS) (??):

    • ??? ??? ?????.
    • Docker? ???? ??????? ??????? ACR(Azure Container Registry)? ?????.

  1. ?? ??

  2. ??? ???? ??: ?? ?? ?? ?? ????? ???? ???? ??? ?? ?????.

  3. ???? ? ??: Azure Application Insights? ???? ??? ?????? ???? ???? ?? ??? ?????.

  4. ??: Azure Key Vault? ???? ?(API ?, ?? ???)? ?????.

  5. ?? ?? ??: ??? ?? Azure ML?? ?? ??? ??? ?? ??? ???? ?? ???? ?????.

  6. ?? ?????: ??? ????? ?? ??? ???? ??? ??? ????.


  1. ??

Python ? Azure Machine Learning? ???? LLM? ?? ??? ?? ?? .NET Core ??????? ???? ??? ???? AI? ??? ? ????. ???. ? ??? Azure? ???? ???? ?? Python? AI ?????? .NET? ?????? ??? ????? ??? ??? ?????.

??, ??? ????, DevOps? ?? ??? ??? ?? ?? ?? ??? ???? ???? ?? ???? ???? ???? ?? ???? ?? ??????? ??? ???? ?? ??? ??? ? ????.

? ??? .NET Core, Python ? Azure? ???? LLM(?? ?? ??) ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1597
29
PHP ????
1488
72
???
??? ???? ??? ??? ???? ??? Jul 05, 2025 am 02:58 AM

???? Python ?? ?? ?????? ?? ????, "??? ?????, ?? ??"? ???? ??? ??? ??? ?? ??? ?????. 1. ???? ?? ? ??? ?? ?????. ?? ???? ?? ??? ???? ??? ? ? ????. ?? ??, Spoke () ?? ???? ??? ??? ?? ??? ?? ????? ?? ??? ??? ????. 2. ???? ?? ???? ??? ??? ?????? Draw () ???? ???? ????? ?? ???? ?? ??? ???? ??? ???? ?? ?? ?? ??? ????? ?? ?? ????? ?? ?????. 3. Python ?? ???? ???????. ?? ???? ??? ???? ?? ???? ??? ????? ??? ?? ???? ??? ???? ????. ??? ??? ??? ???? ? ??? "?? ??"??????. 4. ???? ? ???? ?? ??? ?????

??? ??? ? ???? ??????. ??? ??? ? ???? ??????. Jul 05, 2025 am 02:55 AM

???? __iter __ () ? __next __ () ???? ???? ?????. ???? ??? ? ??? ????, ?? ???? ?? ??? ??? ???? ?????. 1. ???? ?? () ?? ? ??? ??? ???? ? ?? ??? ?? ? ?? ???? ??? ????. 2. ???? ?? ??? ???? ??? ???? ???? ???? ???? ?? ???? ?????. 3. ???? ???? ?? ??? ?? ? ? ? ??? ?? ? ???????? ? ? ??? ?? ??? ??? ???? ?? ? ? ???? ??????. ?? : ??? ?? ???? ??? ???? ????. ???? ?? ?? ? ??? ?????? ???? ? ?? ?? ? ? ????.

????? API ??? ???? ?? ????? API ??? ???? ?? Jul 13, 2025 am 02:22 AM

API ??? ??? ??? ?? ??? ???? ???? ???? ????. 1. Apikey? ?? ??? ?? ????, ????? ?? ?? ?? URL ?? ??? ?????. 2. Basicauth? ?? ???? ??? Base64 ??? ??? ??? ??? ????? ?????. 3. OAUTH2? ?? Client_ID ? Client_Secret? ?? ??? ?? ?? ?? ??? BearEtroken? ???????. 4. ?? ??? ???? ?? ?? ?? ???? ????? ???? ?? ?? ? ????. ???, ??? ?? ??? ??? ???? ?? ??? ???? ???? ?? ?????.

? ?? ? ??? ???? ?? Python ? ?? ? ??? ???? ?? Python Jul 09, 2025 am 01:13 AM

????? ??? ? ??? ??? ?? ??? ???? ??? zip () ??? ???? ????.? ??? ?? ??? ???? ?? ??? ?? ????. ?? ??? ???? ?? ?? itertools.zip_longest ()? ???? ?? ?? ? ??? ?? ? ????. enumerate ()? ???? ??? ???? ?? ? ????. 1.zip ()? ???? ????? ?? ??? ??? ??? ?????. 2.zip_longest ()? ???? ?? ??? ?? ? ? ???? ?? ? ????. 3. Enumental (Zip ())? ??? ??? ????? ??? ???? ???? ?? ???? ?? ? ????.

??? ???? ?????? ??? ???? ?????? Jul 08, 2025 am 02:56 AM

inpython, iteratorsareobjectsthatlowloppingthroughcollections __ () ? __next __ ()

??? ??? ??????. ??? ??? ??????. Jul 07, 2025 am 12:14 AM

Assert? ????? ???? ???? ?? ? ???? ??? ???? ??? ?? ?? ????. ??? ??? ??? ?? ??? ?????, ?? ?? ?? ??, ?? ?? ?? ?? ?? ?? ??? ????? ?? ?? ??? ?? ???? ??? ? ??? ??? ??? ??? ?? ???????. ?? ??? ???? ?? ?? ???? ?? ????? ??? ? ????.

??? ?? ??? ?????? ??? ?? ??? ?????? Jul 07, 2025 am 02:55 AM

typehintsinpythonsolvetheproblemombiguityandpotentialbugsindynamicallytypedcodebyallowingdevelopscifyexpectiontypes. theyenhancereadability, enablearylybugdetection ? improvetoomingsupport.typehintsareaddedusingaColon (:) forvariblesAndAramete

Python Fastapi ???? Python Fastapi ???? Jul 12, 2025 am 02:42 AM

Python? ???? ????? ???? API? ???? Fastapi? ?????. ?? ??? ?? ????? ?????? ??? ??? ??? ???? ?? ? ? ????. Fastapi ? Asgi Server Uvicorn? ?? ? ? ????? ??? ??? ? ????. ??? ??, ?? ?? ?? ? ???? ?????? API? ???? ?? ? ? ????. Fastapi? ??? HTTP ??? ???? ?? ?? ? Swaggerui ? Redoc Documentation Systems? ?????. ?? ??? ?? URL ?? ??? ?? ? ??? ??, ?? ?? ??? ???? ???? ?? ?? ??? ??? ? ????. Pydantic ??? ???? ??? ?? ???? ???? ????? ? ??? ? ? ????.

See all articles