-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
1344 lines (940 loc) · 62.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.png">
<link rel="mask-icon" href="/images/logo.svg" color="#222">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
<script id="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {"hostname":"asswei7.github.io","root":"/","scheme":"Pisces","version":"7.7.2","exturl":false,"sidebar":{"position":"left","Sidebar Display (only for Muse | Mist), available values":["post expand on posts automatically. Default.","always expand for all pages automatically."],"display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
</script>
<meta name="description" content="篮球,计算机">
<meta property="og:type" content="website">
<meta property="og:title" content="Asswei's blog">
<meta property="og:url" content="https://asswei7.github.io/index.html">
<meta property="og:site_name" content="Asswei's blog">
<meta property="og:description" content="篮球,计算机">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="孙书玮">
<meta name="twitter:card" content="summary">
<link rel="canonical" href="https://asswei7.github.io/">
<script id="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: "",
isHome : true,
isPost : false,
lang : 'en'
};
</script>
<title>Asswei's blog</title>
<noscript>
<style>
.use-motion .brand,
.use-motion .menu-item,
.sidebar-inner,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
.use-motion .post-header,
.use-motion .post-body,
.use-motion .collection-header { opacity: initial; }
.use-motion .site-title,
.use-motion .site-subtitle {
opacity: initial;
top: initial;
}
.use-motion .logo-line-before i { left: initial; }
.use-motion .logo-line-after i { right: initial; }
</style>
</noscript>
<link rel="alternate" href="/atom.xml" title="Asswei's blog" type="application/atom+xml">
</head>
<body itemscope itemtype="http://schema.org/WebPage">
<div class="container use-motion">
<div class="headband"></div>
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-container">
<div class="site-nav-toggle">
<div class="toggle" aria-label="Toggle navigation bar">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
</div>
<div class="site-meta">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<h1 class="site-title">Asswei's blog</h1>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<div class="site-nav-right">
<div class="toggle popup-trigger">
</div>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section"><i class="fa fa-fw fa-home"></i>Home</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>About</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>Tags</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>Categories</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>Archives</a>
</li>
</ul>
</nav>
</div>
</header>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
<main class="main">
<div class="main-inner">
<div class="content-wrap">
<div class="content index">
<div class="posts-expand">
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/30/%E5%8F%A4%E5%B8%8C%E8%85%8A%E5%BB%BA%E7%AD%91/%E5%8F%A4%E5%B8%8C%E8%85%8A%E5%BB%BA%E7%AD%91/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/30/%E5%8F%A4%E5%B8%8C%E8%85%8A%E5%BB%BA%E7%AD%91/%E5%8F%A4%E5%B8%8C%E8%85%8A%E5%BB%BA%E7%AD%91/" class="post-title-link" itemprop="url">古希腊建筑</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-30 10:12:37" itemprop="dateCreated datePublished" datetime="2021-09-30T10:12:37+08:00">2021-09-30</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2021-10-09 09:52:28" itemprop="dateModified" datetime="2021-10-09T09:52:28+08:00">2021-10-09</time>
</span>
<span id="/2021/09/30/%E5%8F%A4%E5%B8%8C%E8%85%8A%E5%BB%BA%E7%AD%91/%E5%8F%A4%E5%B8%8C%E8%85%8A%E5%BB%BA%E7%AD%91/" class="post-meta-item leancloud_visitors" data-flag-title="古希腊建筑" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>233</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>古罗马是古希腊的继承者,从爱琴海文明转移到了地中海文明。<br><img src="/images/古希腊建筑/变迁.png" alt></p>
<p>建筑三原则:坚固、实用、美观</p>
<h2 id="古希腊柱式"><a href="#古希腊柱式" class="headerlink" title="古希腊柱式"></a>古希腊柱式</h2><p><img src="/images/古希腊建筑/三种柱子.png" alt><br>古希腊更多是前两种柱式:<br>经济原因:成本较低<br>思想原因:中庸克制</p>
<p>帕台农神庙:黄金比例</p>
<p>梁柱结构,三角眉式、柱廊</p>
<p>斯多葛学派(廊下学派):</p>
<h2 id="哥特式建筑"><a href="#哥特式建筑" class="headerlink" title="哥特式建筑"></a>哥特式建筑</h2><p>哥特式建筑:尖锐高耸</p>
<p>肋:复杂的肋<br>窗:大彩玻璃窗<br>拱:哥特尖拱<br>壁:飞扶壁<br>墙:薄墙</p>
<p>中世纪是宗教的时代,希望教堂就是人间的天堂,所以教堂都是封闭的</p>
<p>以前的教堂:低、胖(墙厚)、暗(窗户小)<br>哥特式教堂:高、瘦、亮</p>
<p>以线为主体,视觉引导,显得清瘦、高</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/29/Linux%E5%AD%A6%E4%B9%A0/Linux%E5%AD%A6%E4%B9%A0/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/29/Linux%E5%AD%A6%E4%B9%A0/Linux%E5%AD%A6%E4%B9%A0/" class="post-title-link" itemprop="url">Linux学习</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-29 09:02:57 / Modified: 09:04:18" itemprop="dateCreated datePublished" datetime="2021-09-29T09:02:57+08:00">2021-09-29</time>
</span>
<span id="/2021/09/29/Linux%E5%AD%A6%E4%B9%A0/Linux%E5%AD%A6%E4%B9%A0/" class="post-meta-item leancloud_visitors" data-flag-title="Linux学习" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>1.3k</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="vi的使用"><a href="#vi的使用" class="headerlink" title="vi的使用"></a>vi的使用</h2><p><strong>命令模式:</strong><br>输入i进入编辑模式,输入:进入底线命令模式,输入x类似于[del]删除光标处的字符<br>退出的话,如果没有改动需要:q!退出,改动了:wq退出。<br><strong>输入模式:</strong><br>G:移动到文件的最后一行<br>gg:移动到文件的第一行,相当于1G<br>n<\Enter>: 光标向下移动n行</p>
<p>/word:向光标之下</p>
<p>常用的复制粘贴:<br>复制光标这一行:yy</p>
<p>重复上一个动作:.(小数点)<br>撤销上一个动作:u</p>
<p>ESC切换到命令模式</p>
<p><strong>底线命令模式:</strong><br>q退出程序<br>w保存文件<br>按esc进入命令模式</p>
<p>Swap file “.test927.txt.swp” already exists!<br>使用vim编辑,先复制一份临时文件并映射到内存来编辑,编辑的是临时文件,当执行了:w是保存临时文件到原文件,执行:q后删除临时文件。</p>
<p>每次启动时会检索是否有临时文件。<br>使用ll -a会显示全部文件,包括一些隐藏文件,以及文件的详细信息。例如.test.txt.swp<br>rm-f删除文件</p>
<h2 id="服务器报错"><a href="#服务器报错" class="headerlink" title="服务器报错"></a>服务器报错</h2><p>CUDA Version: 11.2<br>pip install torch==1.5.0</p>
<p>RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED<br>运行报错,原因是cuda和pytorch版本不匹配,服务器上的cuda版本是11.2,而pytorch版本是1.5.0,<br>通过网站<a target="_blank" rel="noopener" href="https://pytorch.org/get-started/previous-versions/">https://pytorch.org/get-started/previous-versions/</a><br>可以看到cuda和pytorch对应的版本,对应cuda 9.2/10.1/10.2三个。</p>
<p>但是import torch, torch.version.cuda,输入版本为10.2</p>
<p>Traceback (most recent call last):<br> File “main.py”, line 365, in <\module><br> train_gat(args)<br> File “main.py”, line 194, in train_gat<br> torch.LongTensor(current_batch_2hop_indices)).cuda()<br>TypeError: expected torch.LongTensor (got torch.FloatTensor)</p>
<p>修改了对应文件的代码<br>current_batch_2hop_indices = torch.tensor<br>current_batch_2hop_indices = torch.LongTensor([])<br>tensor默认是float,改成Long应该可以</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">Socket error Event: 32 Error: 10053.</span><br><span class="line">Connection closing...Socket close.</span><br><span class="line"></span><br><span class="line">Connection closed by foreign host.</span><br><span class="line"></span><br><span class="line">Disconnected from remote host(3090) at 01:30:17.</span><br><span class="line"></span><br><span class="line">Type help to learn how to use Xshell prompt.</span><br></pre></td></tr></table></figure>
<p>cuda:Compute Unified Device Architecture统一计算架构,是nvidia推出的编程环境,包括</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/28/transformer/transformer/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/28/transformer/transformer/" class="post-title-link" itemprop="url">transformer</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-28 08:43:39" itemprop="dateCreated datePublished" datetime="2021-09-28T08:43:39+08:00">2021-09-28</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2021-10-09 09:52:32" itemprop="dateModified" datetime="2021-10-09T09:52:32+08:00">2021-10-09</time>
</span>
<span id="/2021/09/28/transformer/transformer/" class="post-meta-item leancloud_visitors" data-flag-title="transformer" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>310</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="位置编码"><a href="#位置编码" class="headerlink" title="位置编码"></a>位置编码</h2><p>由于transformer摒弃RNN结构,需要标记各个字之间的时序和位置关系。</p>
<p>首先的想法自然是取[0,1]之间的数分配给每个字,这样的问题是句子长度不同,在短句子中接近的两个字差值为0.1,长句子中相隔很远的两个字差值也是0.1.相同的差值,在不同的句子中含义不同,是不合适的。</p>
<p>另一个想法是线性地给每个时间步分配一个数字,第一个单词为1,第二个为2,这样的问题是1.比字嵌入的值大,会抢了字嵌入的风头。2.最后一个字比第一个字大太多,和字嵌入合并后会出现特征在数值上的倾斜。</p>
<p><strong>理想的情况:</strong></p>
<ul>
<li>为每个字输入唯一的编码,不是一个数字,而是包含句子特定信息的d维向量</li>
<li>不同长度的句子之间,任何两个字的差值保持一致</li>
<li>值应该是有界的</li>
</ul>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/27/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/27/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/" class="post-title-link" itemprop="url">参观党史展览馆</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-27 14:45:26" itemprop="dateCreated datePublished" datetime="2021-09-27T14:45:26+08:00">2021-09-27</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2021-09-28 14:44:30" itemprop="dateModified" datetime="2021-09-28T14:44:30+08:00">2021-09-28</time>
</span>
<span id="/2021/09/27/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/" class="post-meta-item leancloud_visitors" data-flag-title="参观党史展览馆" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>667</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>9月26日,跟着学校一起去参观了中国共产党历史展览馆,一点钟展览馆开门。我们一行是12.45左右到的,但是已经排起了很长的队伍。排的队分成背包的和没背包的两个队伍,没背包的队伍安检速度会快一点。很快一点钟了,安检的速度很快,虽然排队人很多,但是很快就进去了。<br>里面有公益讲解,内容也是涵盖的很广很全面,从1840年开始,一直到最近的脱贫攻坚。这个展馆最大的特点是,里面的东西我们多多少少地都了解过,都学习过。所以看到一些场面时会有所感触,这或许才是展览馆的意义。</p>
<p>我们对于一些历史背景或者说艺术流派有了一定的了解,但是没有那种亲眼见证的体会,这时展览馆才能发挥出它最大的价值。我回想起前几天去的故宫,由于每个宫殿都不让进去,从外面看每个宫殿的造型也是大同小异,很快就失去了游玩的兴趣,只看看这个殿是皇上休息的,那个宫是皇上睡觉的,根本体会不到其中的意义。反而是军机处让我留有印象。因为我很喜欢看《雍正王朝》,而中学历史书对雍正的介绍少之又少,夹在了最有名的康乾盛世中间,历史的考点只有一个,他创办了军机处,皇权达到了顶峰。而在雍正王朝中的军机处特别小,让人很难想象,最高级别的几个人讨论最重要的时期,和珅也是军机大臣,却挤在这么小的一间屋子。</p>
<p>又想到之前去卢浮宫参观,像什么断臂的维纳斯,蒙娜丽莎,一堆人围着,连走近观看都做不到。根本无法理解其中好在哪里。只有课本上的《自由领导人民》是我见过的,而且旁边没啥人,还能看一看,也没看出什么东西来。但看完了西方艺术史,了解了德拉克洛瓦的重要地位,了解了浪漫主义的前因后果,才能理解其的重要意义。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/27/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/27/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/" class="post-title-link" itemprop="url">参观党史展览馆</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-27 14:45:26 / Modified: 14:45:27" itemprop="dateCreated datePublished" datetime="2021-09-27T14:45:26+08:00">2021-09-27</time>
</span>
<span id="/2021/09/27/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/%E5%8F%82%E8%A7%82%E5%85%9A%E5%8F%B2%E5%B1%95%E8%A7%88%E9%A6%86/" class="post-meta-item leancloud_visitors" data-flag-title="参观党史展览馆" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>0</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/25/%E4%B8%89%E6%95%99%E6%9E%81%E7%AE%80%E5%8F%B2/%E4%B8%89%E6%95%99%E6%9E%81%E7%AE%80%E5%8F%B2/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/25/%E4%B8%89%E6%95%99%E6%9E%81%E7%AE%80%E5%8F%B2/%E4%B8%89%E6%95%99%E6%9E%81%E7%AE%80%E5%8F%B2/" class="post-title-link" itemprop="url">三教极简史</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-25 12:49:59" itemprop="dateCreated datePublished" datetime="2021-09-25T12:49:59+08:00">2021-09-25</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2021-10-09 09:52:22" itemprop="dateModified" datetime="2021-10-09T09:52:22+08:00">2021-10-09</time>
</span>
<span id="/2021/09/25/%E4%B8%89%E6%95%99%E6%9E%81%E7%AE%80%E5%8F%B2/%E4%B8%89%E6%95%99%E6%9E%81%E7%AE%80%E5%8F%B2/" class="post-meta-item leancloud_visitors" data-flag-title="三教极简史" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>0</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/24/%E7%B1%BB%E5%BA%93%E6%8E%A8%E8%8D%90%E9%A1%B9%E7%9B%AE/%E7%B1%BB%E5%BA%93%E6%8E%A8%E8%8D%90%E9%A1%B9%E7%9B%AE/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/24/%E7%B1%BB%E5%BA%93%E6%8E%A8%E8%8D%90%E9%A1%B9%E7%9B%AE/%E7%B1%BB%E5%BA%93%E6%8E%A8%E8%8D%90%E9%A1%B9%E7%9B%AE/" class="post-title-link" itemprop="url">类库推荐项目</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-24 09:27:11 / Modified: 10:31:55" itemprop="dateCreated datePublished" datetime="2021-09-24T09:27:11+08:00">2021-09-24</time>
</span>
<span id="/2021/09/24/%E7%B1%BB%E5%BA%93%E6%8E%A8%E8%8D%90%E9%A1%B9%E7%9B%AE/%E7%B1%BB%E5%BA%93%E6%8E%A8%E8%8D%90%E9%A1%B9%E7%9B%AE/" class="post-meta-item leancloud_visitors" data-flag-title="类库推荐项目" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>692</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="遇到的问题"><a href="#遇到的问题" class="headerlink" title="遇到的问题"></a>遇到的问题</h2><p>python对GitHub的爬虫特别不稳定,因为自己本地访问GitHub就不稳定,爬虫自然也难以稳定。想到了挂梯子,但是挂梯子后会报错:ValueError: check_hostname requires server_hostname</p>
<p>解决方法:要么取消梯子,要么可以降低requests库版本到2.7.0。<br>用conda命令行,python -m pip install —upgrade requests==2.7.0,但是pip之前还是得取消梯子。<br>成功解决这个问题。</p>
<h2 id="将表格中的元素变成链接"><a href="#将表格中的元素变成链接" class="headerlink" title="将表格中的元素变成链接"></a>将表格中的元素变成链接</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><el-table-column</span><br><span class="line"> prop="url"</span><br><span class="line"> label="Url"></span><br><span class="line"></el-table-column></span><br></pre></td></tr></table></figure>
<p>上面是原来的表格形式,改成如下格式。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><el-table-column</span><br><span class="line"> prop="url"</span><br><span class="line"> label="Url"></span><br><span class="line"> <template slot-scope="scope"></span><br><span class="line"> <a :href="scope.row.url" target="_blank" >{{scope.row.url}}</a></span><br><span class="line"> </template></span><br><span class="line"></el-table-column></span><br></pre></td></tr></table></figure></p>
<h2 id="子组件无法修改父组件传进来的值"><a href="#子组件无法修改父组件传进来的值" class="headerlink" title="子组件无法修改父组件传进来的值"></a>子组件无法修改父组件传进来的值</h2>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/23/%E7%9F%A5%E8%AF%86%E5%9B%BE%E8%B0%B1%E6%80%9D%E8%B7%AF/%E7%9F%A5%E8%AF%86%E5%9B%BE%E8%B0%B1%E6%80%9D%E8%B7%AF/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/23/%E7%9F%A5%E8%AF%86%E5%9B%BE%E8%B0%B1%E6%80%9D%E8%B7%AF/%E7%9F%A5%E8%AF%86%E5%9B%BE%E8%B0%B1%E6%80%9D%E8%B7%AF/" class="post-title-link" itemprop="url">知识图谱思路</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-23 14:48:36 / Modified: 16:25:19" itemprop="dateCreated datePublished" datetime="2021-09-23T14:48:36+08:00">2021-09-23</time>
</span>
<span id="/2021/09/23/%E7%9F%A5%E8%AF%86%E5%9B%BE%E8%B0%B1%E6%80%9D%E8%B7%AF/%E7%9F%A5%E8%AF%86%E5%9B%BE%E8%B0%B1%E6%80%9D%E8%B7%AF/" class="post-meta-item leancloud_visitors" data-flag-title="知识图谱思路" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>1.5k</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="知识图谱与预训练语言模型"><a href="#知识图谱与预训练语言模型" class="headerlink" title="知识图谱与预训练语言模型"></a>知识图谱与预训练语言模型</h1><h1 id="Focal-Loss"><a href="#Focal-Loss" class="headerlink" title="Focal Loss"></a>Focal Loss</h1><p>做机器学习分类问题,难免遇到Biased-Data-Problem, 例如</p>
<ul>
<li>CV的目标检测问题: 绝大多数检测框里都是 backgroud</li>
<li>NLP的异常文本检测: 绝大多数文本都是 normal</li>
<li>对此,以下套路可以缓解:</li>
<li>升/降采样, 或者调整样本权重</li>
<li>换个更鲁棒的loss函数 ,或者加正则</li>
<li>集成模型: Bagging, RandomForest …</li>
<li>利于外部先验知识: 预训练+微调</li>
<li>多任务联合学习</li>
</ul>
<p><img src="/images/知识图谱思路/CE.png" alt><br>可以看到如果label是1,p越接近1,损失就越小。</p>
<p>考前复习的时候,「他不会划重点,对所有知识点 “一视同仁”」。</p>
<p>如果教科书上有100道例题,包括: 90道加减乘除 + 10道 三角函数。CE同学就会吭哧吭哧的“平均用力”反复练习这100道例题,结果可想而知——他会精通那90道个位数加减乘除题目,然后其他题目基本靠蒙。那10道他不会的题,往往还是分值高的压轴题。</p>
<p>方法一:分科复习</p>
<p>每个【科目】的难度是不同的;你要花 30%的精力在四则运算,70%的精力在三角函数。—- 老师告诉CE同学 第一个技巧<br><img src="/images/知识图谱思路/way1.png" alt></p>
<p>方法二:刷题战术<br><img src="/images/知识图谱思路/way2.png" alt><br>当$p_t$越大,说明准确率越高,观察CE中的$p_t$,它反映了模型对这个样本的识别能力(即 “这个知识点掌握得有多好”);显然,对于$p_t$越大的样本,我们越要打压它对loss的贡献。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">from keras import backend as K</span><br><span class="line">def focal_loss(alpha=0.75, gamma=2.0):</span><br><span class="line"> """ 参考 https://blog.csdn.net/u011583927/article/details/90716942 """</span><br><span class="line"> def focal_loss_fixed(y_true, y_pred):</span><br><span class="line"> # y_true 是个一阶向量, 下式按照加号分为左右两部分</span><br><span class="line"> # 注意到 y_true的取值只能是 0或者1 (假设二分类问题),可以视为“掩码”</span><br><span class="line"> # 加号左边的 y_true*alpha 表示将 y_true中等于1的槽位置为标量 alpha</span><br><span class="line"> # 加号右边的 (ones-y_true)*(1-alpha) 则是将等于0的槽位置为 1-alpha</span><br><span class="line"> ones = K.ones_like(y_true)</span><br><span class="line"> alpha_t = y_true*alpha + (ones-y_true)*(1-alpha)</span><br><span class="line"></span><br><span class="line"> # 类似上面,y_true仍然视为 0/1 掩码</span><br><span class="line"> # 第1部分 `y_true*y_pred` 表示 将 y_true中为1的槽位置为 y_pred对应槽位的值</span><br><span class="line"> # 第2部分 `(ones-y_true)*(ones-y_pred)` 表示 将 y_true中为0的槽位置为 (1-y_pred)对应槽位的值</span><br><span class="line"> # 第3部分 K.epsilon() 避免后面 log(0) 溢出</span><br><span class="line"> p_t = y_true*y_pred + (ones-y_true)*(ones-y_pred) + K.epsilon()</span><br><span class="line"></span><br><span class="line"> # 就是公式的字面意思</span><br><span class="line"> focal_loss = -alpha_t * K.pow((ones-p_t),gamma) * K.log(p_t)</span><br><span class="line"> return focal_loss_fixed</span><br><span class="line"></span><br><span class="line">model = ...</span><br><span class="line">model.compile(..., loss=focal_loss(gamma=3, alpha=0.5))</span><br></pre></td></tr></table></figure>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/23/Nginx/Nginx/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/23/Nginx/Nginx/" class="post-title-link" itemprop="url">Nginx</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-23 10:05:22 / Modified: 10:14:39" itemprop="dateCreated datePublished" datetime="2021-09-23T10:05:22+08:00">2021-09-23</time>
</span>
<span id="/2021/09/23/Nginx/Nginx/" class="post-meta-item leancloud_visitors" data-flag-title="Nginx" title="Views">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">Views: </span>
<span class="leancloud-visitors-count"></span>
</span><br>
<span class="post-meta-item" title="Symbols count in article">
<span class="post-meta-item-icon">
<i class="fa fa-file-word-o"></i>
</span>
<span class="post-meta-item-text">Symbols count in article: </span>
<span>809</span>
</span>
<span class="post-meta-item" title="Reading time">
<span class="post-meta-item-icon">
<i class="fa fa-clock-o"></i>
</span>
<span class="post-meta-item-text">Reading time ≈</span>
<span>1 mins.</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="代理"><a href="#代理" class="headerlink" title="代理"></a>代理</h1><p>设计模式中的代理模式:给某个对象提供一个代理对象,并由代理对象控制原对象的引用。</p>
<p>理解为看房的中介。<br>当使用我们平台的用户越来越多了,并发量慢慢增大了,这时候一台服务器满足不了我们的需求了。于是我们横向扩展,又增加了服务器。这个时候几个项目启动在不同的服务器上,用户要访问,就需要增加一个代理服务器了,通过代理服务器来帮我们转发和处理请求。</p>
<p>我们希望这个代理服务器可以帮助我们接收用户的请求,然后将用户的请求按照规则帮我们转发到不同的服务器节点之上。这个过程用户是无感知的,用户并不知道是哪个服务器返回的结果,我们还希望他可以按照服务器的性能提供不同的权重选择。<br><img src="/images/Nginx/代理.png" alt></p>
<h1 id="正向代理"><a href="#正向代理" class="headerlink" title="正向代理"></a>正向代理</h1><p> 这里我再举一个例子:大家都知道,现在国内是访问不了 Google的,那么怎么才能访问 Google呢?我们又想,美国人不是能访问 Google吗(这不废话,Google就是美国的),如果我们电脑的对外公网 IP 地址能变成美国的 IP 地址,那不就可以访问 Google了。你很聪明,VPN 就是这样产生的。我们在访问 Google 时,先连上 VPN 服务器将我们的 IP 地址变成美国的 IP 地址,然后就可以顺利的访问了。</p>
<p> 这里的 VPN 就是做正向代理的。正向代理服务器位于客户端和服务器之间,为了向服务器获取数据,客户端要向代理服务器发送一个请求,并指定目标服务器,代理服务器将目标服务器返回的数据转交给客户端。这里客户端是要进行一些正向代理的设置的。</p>
<h1 id="反向代理"><a href="#反向代理" class="headerlink" title="反向代理"></a>反向代理</h1><p>正向和反向的区别在于:<strong>正向代理代理的是客户端,反向代理代理的是服务器</strong>。<br>所以,反向代理对客户端是无感知的,因为客户端不需要任何配置就可以访问。只需要将请求发送到反向代理服务器,由反向代理服务器去选择目标服务器获取数据后,再返回客户端。<br><img src="/images/Nginx/正向.png" alt><br><img src="/images/Nginx/反向.png" alt></p>
<p>理解这两种代理的关键在于代理服务器所代理的对象是什么,正向代理代理的是客户端,我们需要在客户端进行一些代理的设置。而反向代理代理的是服务器,作为客户端的我们是无法感知到服务器的真实存在的。</p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
<link itemprop="mainEntityOfPage" href="https://asswei7.github.io/2021/09/22/%E9%95%BF%E5%BE%81/%E9%95%BF%E5%BE%81/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/uploads/Champion_ka.png">
<meta itemprop="name" content="孙书玮">
<meta itemprop="description" content="篮球,计算机">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Asswei's blog">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
<a href="/2021/09/22/%E9%95%BF%E5%BE%81/%E9%95%BF%E5%BE%81/" class="post-title-link" itemprop="url">长征</a>
</h2>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2021-09-22 21:11:48" itemprop="dateCreated datePublished" datetime="2021-09-22T21:11:48+08:00">2021-09-22</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2021-09-23 19:06:55" itemprop="dateModified" datetime="2021-09-23T19:06:55+08:00">2021-09-23</time>